Quote:
Originally Posted by Lordz™
pawn Код:
//A function called "DetectAdv" which will detect if an IP is found on the str.
stock DetectAdv(stradv[]) { new temp_Count; for(new i; stradv[i] != 0; ++i) { if(('0' <= stradv[i] <= '9') || stradv[i] == '.' || stradv[i] == ':') { if((stradv[i] == '.') && (stradv[i + 1] != '.') && ('0' <= stradv[i - 1] <= '9')) { ++temp_Count; } continue; } } return (temp_Count > 2); }
//An array called "badwords" which contains a list of badwords.
new badwords[][] = { {"fuck"}, {"bitch"}, {"asshole"}}; //You can add more, the last word doesn't need to have a , .
public OnPlayerText(playerid, text[]) { new bool:Found = false; for(new i; i< sizeof(badwords); i++) //Looping around the array which contains badwords. { //If the chat contains any words specified on the array, it will detect. if(strfind(text, badwords[i], true) != -1) Found = true; } if(DetectAdv(text)) Found = true; //Or if an IP is pasted, it will detect. if(Found == true) //If detected! { new string[128], Lname[MAX_PLAYER_NAME]; //Getting the player's name to show it to admins. GetPlayerName(playerid, Lname, sizeof(Lname)); //Formatting the text to show it to admin with player's name and ID! format(string, sizeof(string), "%s(ID:%d) : %s", Lname, playerid, text); for(new i; i< GetMaxPlayers(); i++) //Looping through all players. { if(!IsPlayerConnected(i)) continue; //If not connected, it will skip. if(!IsPlayerAdmin(i)) continue; //The same goes here too. SendClientMessage(i, -1, string); //Sends to online RCON admins. } return !SendClientMessage(playerid, 0xFF0000FF, "Warning! You're not allowed to use forbidden chat!"); } return 1; }
Haven't tested on game, but it seems to be working.
|
I modificated it, and it works, but if player write "f u ck" and smthg like that, it not useful.. Can U fix it? Thank you.