03.09.2018, 18:57
Quote:
If you're using zcmd, it is the code:
Код:
public OnPlayerCommandReceived(playerid, cmdtext[]){ if(GetPVarInt(playerid, "AntiSpam") > gettime())//checking if 3 seconds is elapsed { new string[128]; format(string, 128, "Wait %d seconds to use a command again!", GetPVarInt(playerid, "AntSpam")-gettime()); SendClientMessage(playerid, -1, string); return 0; } return 1; } public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if(success) { //When the command is valid, anti spam is enable SetPVarInt(playerid, "AntiSpam", gettime()+3);//It gets the current time and add 3 seconds } } |
SetPVarInt(playerid, "AntiSpam", gettime()+3);
to
SetPVarInt(playerid, "AntiSpam", (gettime()+3));
if(GetPVarInt(playerid, "AntiSpam") > gettime())
to
if((gettime() - GetPVarInt(playerid, "AntiSpam")) > 3)