21.12.2013, 18:41
Hello, how to make something like this "You must wait 3 seconds before using command again."? Please an example.
new
Player_ACS[MAX_PLAYERS];
// OnPlayerConnect:
Player_ACS[playerid] = 0;
// in a command you want it:
if (gettime() - Player_ACS[playerid] < 3) return // error about waiting..
// code..
Player_ACS[playerid] = gettime();
And what if i want it for every commands so that i must not paste it into all my commands?
|
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (gettime() - Player_ACS[playerid] < 3)
{
SendClientMessage(playerid, 0xFF0000FF, "You must wait 3 seconds before using command again.");
return 0;
}
Player_ACS[playerid] = gettime();
return 1;
}