Time delay on commands
#1

Hi there,

I was just wondering if this is the best way to put a time delay on a command:

Код:
forward AllowCommand(playerid);
new StopCommand[MAX_PLAYERS]; //at the top of the script

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true) == 0)
	{
        if(StopCommand != 1)
        {
		     // Do something here

             StopCommand[playerid] = 1;
             SetTimerEx("AllowCommand", 1000, 0, "i", playerid);
             return 1;
        }
	}
	return 0;
}

public AllowCommand(playerid)
{
    StopCommand[playerid] = 0;
}
Or is there a better way? If not then what's the best way to go about putting a time delay on multiple commands using this method without declaring an array (StopCommand[MAX_PLAYERS] in my example) for every single command you have

Many thanks.
Reply


Messages In This Thread
Time delay on commands - by lol2112 - 26.05.2009, 21:20
Re: Time delay on commands - by Simon - 27.05.2009, 11:49
Re: Time delay on commands - by lol2112 - 27.05.2009, 12:01
Re: Time delay on commands - by yom - 27.05.2009, 12:10
Re: Time delay on commands - by lol2112 - 27.05.2009, 12:26
Re: Time delay on commands - by yom - 27.05.2009, 12:45
Re: Time delay on commands - by lol2112 - 27.05.2009, 13:25
Re: Time delay on commands - by yom - 27.05.2009, 14:06
Re: Time delay on commands - by lol2112 - 27.05.2009, 14:33
Re: Time delay on commands - by yom - 27.05.2009, 14:37

Forum Jump:


Users browsing this thread: 4 Guest(s)