Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Robd on February 03, 2011, 05:40:45 pm
-
Timer's have been giving me a lot of syntax errors, could someone please explain the criteria for a timer to work?
-
:-\ like what any idea? could u gave us any script idea
Well timer don't works on
public bla(playerid)
{
Bla bla bla
}
which include playerid or else
it should be cleared like ()
public Whatever()
{
Never Mind
}
SetTimer("Whatever",5000,false);
Whatever is Variable that Runs
and 5000 is Time settings 5000 = 5secs
and false thing is loop the timer you can use True/False or 1/0
-
sometimes when i do a function like
stock test()
{
SendClientMessageToAll(COLOR_GREEN,"blablabla");
ServerInfo[0][variable] = 1;
}
SetTimer("test",10000,0");
it gives me syntax errors
-
sometimes when i do a function like
stock test()
{
SendClientMessageToAll(COLOR_GREEN,"blablabla");
ServerInfo[0][variable] = 1;
}
SetTimer("test",10000,0"); //<----- This line
it gives me syntax errors
Theres a syntax error in the line i specified.
It should be:
SetTimer("test",10000,false);
true means timer runs infinite times...
false means timer runs only one time.
Integers have no effect in the 3rd parameter, it runs infinite times if u put integers.....better use true/false
-
use Public instead of stock
stock test()
{
SendClientMessageToAll(COLOR_GREEN,"blablabla");
ServerInfo[0][variable] = 1;
}
SetTimer("test",10000,0"); //
To
public test()
{
SendClientMessageToAll(COLOR_GREEN,"blablabla");
ServerInfo[0][variable] = 1;
}
SetTimer("test",10000,0"); //
-
Thank you :)
One more question, sometimes when using timers with variables like
public test(playerid);
{
PlayerInfo[playerid][test] = 1;
}
I get the same errors, is there anything i can do to avoid that?
-
You cannot pass parameters in functions when using timers.
It has to be:
public test()
{
...
return 1;
}
For using timers applicable only on certain variables you have to use SetTimerEx, which doesnt exists in VCMP.
-
which doesnt exists in VCMP.
XD ;D
-
hmmm, glad i figured out a solution for this...
if anyone's interested i have an idea that would include using ServerInfo before the timer and then reading that in the actual function for later use...
-
aXXo...you made it with playerid...Why just dont help him with playerid at timers?