[HELP] How can i do a command with time?
#3

Quote:
Originally Posted by -xy!
will be more like https://sampwiki.blast.hk/wiki/SetTimerEx since you will have to give along the playerid to the timer...

Код:
new CmdTimer[MAX_PLAYERS];
new bool:CanUseCmd[MAX_PLAYERS];
forward releasecmd(playerid);
in the public OnPlayerConnect(playerid):

Код:
CanUseCmd[playerid] = true;
in the OnPlayerCommandText:

Код:
if (strcmp("/yourcommand", cmdtext, true) == 0)
{
	if(CanUseCmd[playerid] == true)
	{
		// let your command do what is must do... +
		CanUseCmd[playerid] = false;
		CmdTimer[playerid] = SetTimerEx("releasecmd", 15000, false, "i", 1, playerid);
	} else {
		//let the player know he has to wait...
	}
	return 1;
}
and finaly:

Код:
stock releasecmd(playerid)
{
   CanUseCmd[playerid] = true;
   KillTimer(CmdTimer[playerid]); //suggest you place this line in the onplayerdisconnect as well
}
havent tested this, so i dont know if it will work. at least it sets you in the right direction...

Reply


Messages In This Thread
[HELP] How can i do a command with time? - by akis_tze - 22.11.2009, 21:00
Re: [HELP] How can i do a command with time? - by -xy! - 22.11.2009, 21:02
Re: [HELP] How can i do a command with time? - by ExoSanty - 23.11.2009, 04:59
Re: [HELP] How can i do a command with time? - by Abernethy - 23.11.2009, 05:33
Re: [HELP] How can i do a command with time? - by ExoSanty - 23.11.2009, 16:04
Re: [HELP] How can i do a command with time? - by Donny_k - 23.11.2009, 16:54

Forum Jump:


Users browsing this thread: 2 Guest(s)