14.02.2011, 22:30
pawn Код:
stock AntiAdvertising(playerid, text[], chances)
{
new Chance[MAX_PLAYERS] = 0;
new var, pos, oldpos;
oldpos = strfind(text, ".", true);
if(strval(text[oldpos - 1]) == 0) return 1;
while((pos = strfind(text, ".", true, pos + 1)) != -1 && pos - oldpos <= 4)
{
var++;
if(strval(text[pos + 1]) == 0 || text[pos + 1] == ' ') return 1;
oldpos = pos;
if(var == 3 && (pos = strfind(text, ":", true, pos + 1)) != -1)
{
if(strval(text[pos + 1]) == 0 || text[pos + 1] == ' ') return 1;
Chance[playerid]++;
if(Chance[playerid] > chances)
{
BanEx(playerid, "Advertising");
return 0;
}
}
}
return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
AntiAdvertising(playerid, text, 5); //Gives he 5 chances, If he Type a Server IP more that 5 times ge get banned.
return 1;
}