Player timers and Player timers with variable
#2

Quote:
Originally Posted by NoteND
View Post
Hey!

I got a question about timers.. basically I'm not sure when should I use for example..

First option:

Code:
new timer[MAX_PLAYERS];
timer[playerid] = SetTimerEx("Test", 2000, 0, "d", playerid);
or

Second Option:

Code:
SetTimerEx("Test", 2000, 0, "d", playerid);
Because what happens if for example during the time timer is valid, player disconnects? I guess timer gets bugged and next time that ID connects it bugs him out or something?

Because lets say I use the second option for multiple player id's.. I guess I gotta use first option if I use it for more player id's than one.. or ?
You should do something like this to prevent conflicts of player ids when player disconnect.

PHP Code:
new timer[MAX_PLAYERS];
timer[playerid] = SetTimerEx("Test"20000"d"playerid); 
PHP Code:
OnPlayerDisconnect(playeridreason)
{
  
KillTimer(timer[playerid]);
  return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)