26.05.2009, 21:20
Hi there,
I was just wondering if this is the best way to put a time delay on a command:
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.
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;
}

Many thanks.


