[HELP]How to make a timer.works as per cmd
#10

Quote:
Originally Posted by fuckingcruse
Посмотреть сообщение
Dude , you misunderstood me., when someone type /race , all thw players who type /race will be spawned , I made that , but they can only type /race under the 30 seconds , and after the race is finished again they can type /race .. you thought that after the /race after 30 seconds they can type /race again..
Well, I do as follows and it works well. All you need is to define two booleans and a simple timer.

Код:
new bool:racestart = false;  // if true blocks /race for everybody
new bool:timerset = false;  // needed for starting timer only once

forward RaceTimer();

public RaceTimer()
{
	racestart = true;
	timerset = false;
}
In your command start testing the booleans:

Код:
CMD:race(playerid, params[])
{
	// test if is valid playerid & params
	//...
	if (racestart) SendClientMessage(playerid,-1,"Sorry, race's started!");
	if (!timerset)
	{
		SetTimer("RaceTimer",30000,false);
		timerset = true;
	}
	// the rest of your command here
	//...
	return 1;
}
When your race ends don't forget to reset racestart:

Код:
racestart = false;
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)