15.03.2010, 14:10
Quote:
|
Originally Posted by _Jay_
I wouldn't recommend using a timer for this. Try GetTickCount()
Код:
static n_PlayerLastUsedCommand[MAX_PLAYERS];
public OnPlayerDisconnect(playerid)
{
n_PlayerLastUsedCommand[playerid] = 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/somecmd"))
{
if(n_PlayerLastUsedCommand[playerid] != 0 && GetTickCount() - n_PlayerLastUsedCommand[playerid] < 5*60*1000)
{
SendClientMessage(playerid, COLOR_RED, "You can only use this once every 5 minutes.");
return 1;
}
n_PlayerLastUsedCommand[playerid] = GetTickCount();
// rest of the cmd
}
}
|

