Killing a timer on repeat.
#8

You would add the timer under OnPlayerConnect, and then under your timer function loop through all the players and check if the any players are connected. Heres the example. This should work.
pawn Code:
new Timer;

forward YourFunction();
public YourFunction() // Every 5 seconds....
{
    // Object Code here
    for(new i = 0; i < MAX_PLAYERS; i++) // Loops through all the players
    {
       
        if(!IsPlayerConnected(i)) // If IsPlayerConnected for all players returns false.
        {
            KillTimer(Timer); // Then kill the timer.
        }
    }
    return 1;
}
public OnPlayerConnect(playerid)
{
    Timer = SetTimer("YourFunction",5000,true); // Repeats a timer of 5 seconds
    return 1;
}
Reply


Messages In This Thread
Killing a timer on repeat. - by Robert_Crawford - 01.03.2012, 17:06
Re: Killing a timer on repeat. - by [XST]O_x - 01.03.2012, 17:19
Re: Killing a timer on repeat. - by Robert_Crawford - 01.03.2012, 17:28
Re: Killing a timer on repeat. - by aco_SRBIJA - 01.03.2012, 17:32
Re: Killing a timer on repeat. - by Robert_Crawford - 02.03.2012, 01:21
Re: Killing a timer on repeat. - by Walsh - 02.03.2012, 01:28
Re: Killing a timer on repeat. - by Robert_Crawford - 02.03.2012, 02:15
Re: Killing a timer on repeat. - by Walsh - 02.03.2012, 02:43
Re: Killing a timer on repeat. - by Robert_Crawford - 02.03.2012, 03:55
Re: Killing a timer on repeat. - by Walsh - 02.03.2012, 04:05

Forum Jump:


Users browsing this thread: 1 Guest(s)