timer wont stop
#4

Replace 'new timer1;' with this:
Код:
new timer1[MAX_PLAYERS];
new rainbowing[MAX_PLAYERS];
Then replace the IF statement with:
Код:
if(strcmp(cmd, "/rainbow", true) == 0) 
{
  if(rainbowing[playerid] == 1)
  {
    KillTimer(timer1[playerid]);
    rainbowing[playerid] = 0;
  }else{
    timer1[playerid] = SetTimerEx("rainbow", 50, 1, "i", playerid);
    rainbowing[playerid] = 1;
  }
  return 1;
}
This has changed it so every player has a timer variable of their own. Each player also has a variable that checks to see if their vehicle is currently "rainbowing" or not. If you do not have MAX_PLAYERS defined, change it to the amount of players allowed in the server at the same time. This might not be the most efficient way of doing it but it might get it working. *fingers crossed*

EDIT: oh and feel free to change the variable name "rainbowing", couldn't think of a more appropriate one
Reply


Messages In This Thread
timer wont stop - by dice7 - 14.04.2009, 15:55
Re: timer wont stop - by Benjo - 14.04.2009, 16:23
Re: timer wont stop - by dice7 - 14.04.2009, 16:35
Re: timer wont stop - by Benjo - 14.04.2009, 16:49
Re: timer wont stop - by Nero_3D - 14.04.2009, 17:15
Re: timer wont stop - by dice7 - 14.04.2009, 17:29
Re: timer wont stop - by Benjo - 14.04.2009, 17:47

Forum Jump:


Users browsing this thread: 1 Guest(s)