02.09.2018, 14:48
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 } }