10.08.2010, 18:13
Ant-Spawn:
No Final :
pawn Код:
#define SPAM_PROTECTION 1
#define SPAM_MAX_MSGS 3
#define SPAM_TIMELIMIT 3 // Segundos que o player pode falar :
pawn Код:
public OnPlayerText(playerid)
{
new string[256];
format(string,sizeof(string),"[ID:%d]: %s",playerid,text);
SendPlayerMessageToAll(playerid,string);
#if SPAM_PROTECTION
SpamProtection(playerid);
#endif
return 0;
}
No Final :
pawn Код:
stock SpamProtection(playerid)
{
new string[64];
if(gSpamCount[playerid][0] == 0) { gSpamCount[playerid][1] = TimeStamp();
}
gSpamCount[playerid][0]++;
if(TimeStamp() - gSpamCount[playerid][1] > SPAM_TIMELIMIT)
{
gSpamCount[playerid][0] = 1;
gSpamCount[playerid][1] = TimeStamp();
}
else if(gSpamCount[playerid][0] == SPAM_MAX_MSGS) {
format(string,sizeof(string)," %s Foi Kickado (Flood/Spam Proteзгo)",GetName(playerid));
SendClientMessageToAll(0xC8BEBEAA,string);
Kick(playerid);
}
return 1;
}
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}