27.01.2010, 01:01
Hello all, thanks for helping me here
My problem is that I made a timer that starts when you type a command, and it stills repeating, than I made another command that kills the timer, but it's not working properly.
Like this, sometimes, you type the command and the timer stops, but other times, its bugs and you can type the command the many times you want, and the timer just doesnt stop.
I dont know why, can anyone help me please?
Anyone can please help me? Thanks
My problem is that I made a timer that starts when you type a command, and it stills repeating, than I made another command that kills the timer, but it's not working properly.
Like this, sometimes, you type the command and the timer stops, but other times, its bugs and you can type the command the many times you want, and the timer just doesnt stop.
I dont know why, can anyone help me please?
Код:
new TimerCores; new CoresAuto[MAX_PLAYERS]; OnPlayerDisconnect CoresAuto[playerid] = 0; OnPlayerCommandText if(strcmp(cmd, "/cores", true) == 0) //This Starts the Timer { if(IsPlayerConnected(playerid)) { if(CoresAuto[playerid] == 0) { if(IsPlayerInAnyVehicle(playerid)) { CoresAuto[playerid] = 1; TimerCores = SetTimerEx("Rainbow", 100, true, "i", playerid); SendClientMessage(playerid, COLOR_GREEN, "Cores automбticas ATIVADO!"); SendClientMessage(playerid,cinza,"Para parar as cores automбticas, digite /pararcores."); } else { SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб em um veнculo!"); } return 1; } else if(CoresAuto[playerid] == 1) { SendClientMessage(playerid, COLOR_RED, "Cores automбticas jб estб ativado!"); return 1; } } } if(strcmp(cmd, "/pararcores", true) == 0) //This kill the timer { CoresAuto[playerid] = 0; KillTimer(TimerCores); SendClientMessage(playerid, COLOR_RED, "Cores automбticas DESATIVADO!"); return 1; } public AutoCores(playerid) //This is the public that the timer will use { new rand = random(252)+0; new rand1 = random(252)+0; new iVehicleID = GetPlayerVehicleID(playerid); ChangeVehicleColor(iVehicleID,rand,rand1); return 1; }