24.04.2017, 06:36
Read through this! This was posted by RIDE2DAY on the y_timers thread. This might help
Код:
/* Set all cells to -1 */ new Timer:myTimer[MAX_PLAYERS] = {Timer:-1, ...}; /* Start the timer */ CMD:mycommand(playerid, params[]) { myTimer[playerid] = repeat MyOwnFunction(playerid); /* MyOwnFunction will be called 1 second after we type the command, due the delay parameter from timer, that's how it works. */ return 1; } /* Declare MyOwnFunction as a timer */ timer MyOwnFunction[1000](playerid) { printf("The player who started timer %d has the ID %d.", _:myTimer[playerid], playerid); // This function will print the same message every second. } /* Stop the timer */ COMMAND:stoptimer(playerid, params[]) { if(myTimer[playerid] != Timer:-1) { stop myTimer[playerid]; myTimer[playerid] = Timer:-1; } else { // The timer isn't running. } return 1; }