24.12.2014, 16:47
Use an antispam FS, like this one. The player gets kicked from server if spams 3 times
PHP код:
/*
# ========================= #
# SA-MP Simple Anti-Spam #
# ------------------------- #
# @Authour(s): ChristopherM #
# ========================= #
*/
#include <a_samp>
forward ResetCount(playerid);
forward ResetCommandCount(playerid);
#define SpamLimit (3000)
public OnFilterScriptInit()
{
printf("[*] ChristopherM's Anti-Spam Loaded. Limit: %d", SpamLimit);
return 1;
}
public OnFilterScriptExit()
{
print("[*] ChristopherM's Anti-Spam Unloaded.");
return 1;
}
public OnPlayerText(playerid, text[])
{
new TCount, KMessage[128];
TCount = GetPVarInt(playerid, "TextSpamCount");
TCount++;
SetPVarInt(playerid, "TextSpamCount", TCount);
if(TCount == 2) {
SendClientMessage(playerid, 0xFFFFFF, "[Anti-Spam]: Warning you are one message away from being kicked!");
}
else if(TCount == 3) {
GetPlayerName(playerid, KMessage, sizeof(KMessage));
format(KMessage, sizeof(KMessage), "[Anti-Spam]: %s has been kicked for chat spamming.", KMessage);
SendClientMessageToAll(0xFFFFFF, KMessage);
print(KMessage);
Kick(playerid);
}
SetTimerEx("ResetCount", SpamLimit, false, "i", playerid);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new TCount, KMessage[128];
TCount = GetPVarInt(playerid, "CommandSpamCount");
TCount++;
SetPVarInt(playerid, "CommandSpamCount", TCount);
if(TCount == 2) {
SendClientMessage(playerid, 0xFFFFFF, "[Anti-Spam]: Warning you are one command away from being kicked!");
}
else if(TCount == 3) {
GetPlayerName(playerid, KMessage, sizeof(KMessage));
format(KMessage, sizeof(KMessage), "[Anti-Spam]: %s has been kicked for command spamming.", KMessage);
SendClientMessageToAll(0xFFFFFF, KMessage);
print(KMessage);
Kick(playerid);
}
SetTimerEx("ResetCommandCount", SpamLimit, false, "i", playerid);
}
public ResetCount(playerid)
{
SetPVarInt(playerid, "TextSpamCount", 0);
}
public ResetCommandCount(playerid)
{
SetPVarInt(playerid, "CommandSpamCount", 0);
}