20.10.2017, 11:12
i made timer for using command, they have to wait 3 seconds to use the command again but i wanna disable it for admins bec there is slap cmd and i wanna spam it but i can't bec i have to wait 3 secs so i want to disable it for admins only
code :
code :
PHP код:
new lastcommand[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason)
{
lastcommand[playerid]=0; //reset command cooldown time
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
new string[128];
format(string, sizeof(string), "{FF6600}[DBot]: {FFFFFF}Command {FF0000}%s{FFFFFF} not found, Type {FF6600}/cmds {FFFFFF}to see server commands", cmdtext);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(success)
{
lastcommand[playerid]=gettime();
}
return 1;
}
public OnPlayerCommandReceived(playerid, cmdtext[]) //command cooldown
{
if(lastcommand[playerid] != 0 && gettime()-lastcommand[playerid] < 3)
{
SendClientMessage(playerid, COLOR_RED, "Please wait {AFAFAF}3 {FF0000}seconds before using any command again!");
return 0;
}
return 1;
}