Timer help?
#8

Quote:
Originally Posted by Kruno88
Посмотреть сообщение
Hmmmm,can anybody send me an example?I can't get it to work,....
You can also assign a timer to a callback which increments a variable by one every second.

Код:
new raceTimer[MAX_PLAYERS];
new raceTime[MAX_PLAYERS];

forward CountSeconds (playerid);

public CountSeconds (playerid)
{
	raceTime[playerid]++;
	return 1;
}
When the race starts, do the following:

Код:
raceTimer[playerid] = SetTimerEx("CountSeconds", 1000, true, "i", playerid);
When the race ends, do the following:

Код:
KillTimer (raceTimer[playerid]);
new string[256];
format (string, sizeof(string), "ID %i took %i seconds to complete the race!", playerid, raceTime[playerid]);
SendClientMessageToAll (-1, string);
raceTime[playerid] = 0;
Reply


Messages In This Thread
Timer help? - by Kruno88 - 13.04.2017, 23:31
Re: Timer help? - by GangstaSunny. - 14.04.2017, 00:11
Re: Timer help? - by Kruno88 - 14.04.2017, 00:13
Re: Timer help? - by GangstaSunny. - 14.04.2017, 00:18
Re: Timer help? - by DRIFT_HUNTER - 14.04.2017, 01:32
Re: Timer help? - by GangstaSunny. - 14.04.2017, 08:20
Re: Timer help? - by Kruno88 - 14.04.2017, 11:38
Re: Timer help? - by LEOTorres - 14.04.2017, 12:35
Re: Timer help? - by GangstaSunny. - 14.04.2017, 12:49

Forum Jump:


Users browsing this thread: 1 Guest(s)