just as i thought
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: stormeus on Feb 28, 2015, 06:42 PMOne note I will make is that the length of the unique ID is 40 characters and not 25.its 39 tried this at onPlayerJoin
local id = player.UniqueID;
print(id.len());
Quote from: Sk on Feb 28, 2015, 12:52 PMAnd i removed that == 1 condition because anything which is not 0, false and null will return true.Make sure you remember that.
Quote from: S.L.C on Feb 28, 2015, 05:17 PMExactly just as S.L.C said how can you use the variable even before defining it?Quote from: Beztone on Feb 28, 2015, 04:53 PMI've Got This Error Seems Timer Not Created
Move the code at line 125 above the one at 124. The order of operations is wrong in that case since the 'gate_timer' variable is created after it's being used.
function onScriptLoad()
{
gate <- CreateObject( 310, 1, -276.618, -495.992, 10.2778, 255 );
gate_timer<-NewTimer("gatesystem", 500, 0 );
//Using Global array for timer so that timer should not be running when no player is online of no one spawned.
gate_timer.Stop(); // No one will be spawned on startup so no need for that.
g_Spawned<-array(1,101); // This is the global array to insert the id of player who are spawned.
}
function onPlayerSpawn(player){
//and then onPlayerSpawn insert the id of spawned player by calling Add_p function
Add_p(player);
//you stuff after this.
}
// and then call this function Remove_p where player dies or leaves.
onPlayerDeath( player, reason )
{
Remove_p(player);
//you stuff after this.
}
onPlayerKill( killer, player, reason, bodypart )
{
Remove_p(player);
//you stuff after this.
}
onPlayerTeamKill( killer, player, reason, bodypart )
{
Remove_p(player);
//you stuff after this.
}
onPlayerPart(player,reason)
{
Remove_p(player);
//you stuff after this.
}
function Add_p(player)
{
local id = player.ID;
g_Spawned.push(id); //pushing the id of player who just spawned.
if (gate_timer.Paused) // if the timer was stopped or wasn't started.
{
gate_timer.Start(); //Start the timer as one or someone is spawned.
}
}
function Remove_p(player)
{
local id = player.ID;
if (g_Spawned.find(id)) //if player's id was inside the spawned players array.
{
local i = g_Spawned.find(id);
// array.find(val) returns the slot or index of the array where val is present.
g_Spawned.remove(i);
// removing player's id from the array.
}
//now to decrease further lag we will stop the timer if no one is spawned.
if (g_Spawned.len()<2) gate_timer.Stop();
//Smaller then 2 equals 1 which means no one is spawned and now we can stop the timer.
//as i have already created an extra value in array 101 at index 0.
}
//So now you can use your function something like this.
function gatesystem()
{
local gatestatus = 0;
foreach(i in g_Spawned ) //This will get the value from each array.
{
if (i < 100)
{
local player = FindPlayer( i);
if ( player )
{
if ( InPoly( player.Pos.x, player.Pos.y, -276.2,-503.462,-268.675,-502.296,-268.887,-488.42,-276.471,-487.991 ) ) gatestatus = 1;
}
}
}
if ( gatestatus ) gate.MoveTo( Vector( -268.576, -495.99, 10.2778 ), 2800 );
else gate.MoveTo( Vector( -276.618, -495.992, 10.2778 ), 2800 );
}
And i removed that == 1 condition because anything which is not 0, false and null will return true.Quote from: Nihongo on Feb 26, 2015, 03:32 PMSO i its mean i should want to rescript right ? mean script new codes
Quote from: ysc3839 on Feb 26, 2015, 12:17 PMYou needn't convert it unless you see any error.
Quote from: S.L.C on Feb 26, 2015, 12:34 PMhahaQuote from: Nihongo on Feb 26, 2015, 12:16 PMis there any Site that convert the coding ?
Yeah sure, this can be found here http://www.easy-script-converter.net/vcmp-03-to-04?optimize=1
function ScriptLoad()
{
CPlayer.Kills<-0;
// same result with rawset
}
#now when the player joins the instance is created this object is auto added to the player instance but i can't change it ( some how its read-only):(.
function onPlayerJoin(player)
{
player.Kills = 10;
}
but if i use my command "kills" it still shows 0 kills
function onPlayerCommand(player,CMD,text)
{
local cmd = CMD.tolower();
if (cmd == "kills") PrivMessage(player,"Your Kills are "+player.Kills);
}
just wondering if there was any way to change their values.
function onPlayerTeamKill(player,killer,reason,bodypart)
{
if ( player.Team == 255 ) onPlayerKill(player,killer,reason,bodypart);
// calling it manually.
}
sorry if the syntax is not correct i am on mobile :c.