18.08.2010, 08:55
Try to put this on every command
and this as an public
Код:
if(FindIP(text)) { new advertiser[MAX_PLAYER_NAME]; GetPlayerName(playerid, advertiser, sizeof(advertiser)); format(string, sizeof(string), "AdmCmd: %s was warned & kicked by AdmBOT, reason: Server Advertising",advertiser); SendClientMessageToAll(COLOR_LIGHTRED,string); KickLog(string); PlayerInfo[playerid][pWarns] += 1; Kick(playerid); return 1; }
Код:
FindIP(StrToChk[]) { new IpLevel = 0; for(new a = 0; a < strlen(StrToChk); a++) { switch(IpLevel) { case 0: { if(IsNum(StrToChk[a])) IpLevel++; } case 1, 2: { if(IsNum(StrToChk[a])) IpLevel++; else if(StrToChk[a] == '.') IpLevel = 4; else IpLevel = 0; } case 3: { if(StrToChk[a] == '.') IpLevel++; else IpLevel = 0; } case 4: { if(IsNum(StrToChk[a])) IpLevel++; else IpLevel = 0; } case 5, 6: { if(IsNum(StrToChk[a])) IpLevel++; else if(StrToChk[a] == '.') IpLevel = 8; else IpLevel = 0; } case 7: { if(StrToChk[a] == '.') IpLevel++; else IpLevel = 0; } case 8: { if(IsNum(StrToChk[a])) IpLevel++; else IpLevel = 0; } case 9, 10:{ if(IsNum(StrToChk[a])) IpLevel++; else if(StrToChk[a] == '.') IpLevel = 12; else IpLevel = 0; } case 11: { if(StrToChk[a] == '.') IpLevel++; else IpLevel = 0; } case 12: { if(IsNum(StrToChk[a])) return 1; else IpLevel = 0; } } } return 0; }