Global Timer
#5

There's no direct way to do that, however you can make a boolean variable and set it to true everytime you start the timer, inside the timer function set it to false.

Functions that you call with timers get called once the time ends, as an example:

PHP Code:
new bool:IsTimerRunnin;
forward taimer();
public 
taimer()
{
    
IsTimerRunnin false// set the boolean value to false, indicating that the timer just stopped and the function was executed
    // rest of your functions
}
// This is only an example, i'm using zcmd
CMD:timerstaruto(playerid)
{
    if(
IsTimerRunnin == true) return SendClientMessage(playerid,color,"The timer is already runnin!"); // if the timer is running, stop the function here and return a message
    
IsTimerRunnin true// set the boolean of the timer to true, indicating that the timer is running
    
SetTimer("taimer",3000,false); // The function inside the taimer callback will get executed after 3 seconds
    
return 1;

Reply


Messages In This Thread
Global Timer - by ElMaestro123 - 18.03.2017, 23:02
Re: Global Timer - by Toroi - 18.03.2017, 23:13
Re: Global Timer - by ElMaestro123 - 19.03.2017, 12:40
Re: Global Timer - by ElMaestro123 - 19.03.2017, 13:23
Re: Global Timer - by Toroi - 19.03.2017, 13:30
Re: Global Timer - by Bolex_ - 19.03.2017, 13:32
Re: Global Timer - by Logic_ - 19.03.2017, 13:58

Forum Jump:


Users browsing this thread: 1 Guest(s)