ANTI SPAM For Commands
#2

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
	}
}
Reply


Messages In This Thread
ANTI SPAM For Commands - by Cezar98 - 02.09.2018, 14:15
Re: ANTI SPAM For Commands - by iHollyZinhO - 02.09.2018, 14:48
Re: ANTI SPAM For Commands - by Cezar98 - 02.09.2018, 17:29
Re: ANTI SPAM For Commands - by ShihabSoft - 03.09.2018, 18:57

Forum Jump:


Users browsing this thread: 1 Guest(s)