20.05.2018, 16:35
PHP код:
public OnPlayerConnect(playerid)
{
SetPVarInt(playerid, "PSPAM", 0);
return 1;
}
public OnPlayerDisconnect(playerid)
{
SetPVarInt(playerid, "PSPAM", 0); //reset spam on disconnect
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success)
{
SetPVarInt(playerid, "PSPAM", 1); //spam to 1 use pvars so other scripts wont let you spam too
SetTimerEx("SpamDelay", 1000, false, "i", playerid); //delay
}
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(GetPVarInt(playerid, "PSPAM") == 1) //if spam still on
{
SendClientMessage(playerid, 0xFF0000FF, "Do not spam!");
return 0; //do not execute the command
}
return 1;
}
forward SpamDelay(playerid);
public SpamDelay(playerid)
{
SetPVarInt(playerid, "PSPAM", 0); //setting to no spam after 1 second
}