02.03.2012, 02:43
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;
}