19.02.2012, 21:15
Edited:
Easy to read?
pawn Код:
public OnPlayerText(playerid, text[])
{
if(stringContainsIP(text))
{
new sendername[MAX_PLAYER_NAME], string[128];
// ^ Remove this line if sendername & string is already defined.
GetPlayerName(playerid, sendername, 24);
format(string, sizeof string, "AdmCmd: %s was kicked, reason: Server Advertise", sendername);
SendClientMessageToAll(COLOR_LIGHTRED, string);
KickLog(string);
Kick(playerid);
return 0;
}
//Other stuff..
return 1;
}
stock stringContainsIP(const szStr[])
{
new
iDots,
i
;
while(szStr[i] != EOS)
{
if('0' <= szStr[i] <= '9')
{
do
{
if(szStr[i] == '.')
iDots++;
i++;
}
while(('0' <= szStr[i] <= '9') || szStr[i] == '.' || szStr[i] == ':');
}
if(iDots > 2)
return 1;
else
iDots = 0;
i++;
}
return 0;
}