[HELP]How to make a timer.works as per cmd
#2

pawn Код:
new bool:MyBoolean; // Declare "MyBoolean" as a boolean
CMD:race(playerid, params[])
{
    MyBoolean = false; // Sets "MyBoolean" to false
    SetTimer("MyPublic", 30000, false);
    // "MyPublic" is the public we call when the timer ends
    // "30000" is the time before the timer ends in milliseconds, 1 second = 1000 ms
    // "false" a boolean to toggle if the timer should repeat itself, or not, for this it shouldn't repeat, just play once
}
Pretty simple, now the callback is just as simple:
pawn Код:
forward MyPublic(); // Forwards "MyPublic" as a public function
public MyPublic() // Creates "MyPublic" as a public function, which the timer will call when it ends
{
    MyBoolean = true; // Sets "MyBoolean" to true
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)