26.05.2018, 15:16
Hi friends
My spam and anti advertising not works and i think some error in my script, Please help me.
Here are the all codes of OnPlayerText from my script.
Thank You pls help.
My spam and anti advertising not works and i think some error in my script, Please help me.
Here are the all codes of OnPlayerText from my script.
Код:
public OnPlayerText(playerid, text[]) { //============================================================================== // Vip Chat //============================================================================== if(text[0] == '*' && AccInfo[playerid][pVip] >= 1) { new string[128]; GetPlayerName(playerid,string,sizeof(string)); format(string,sizeof(string),"[Vip Chat] %s (%d): %s",string,playerid,text[1]); MessageToPlayerVIP(0xDC686BAA,string); SaveIn("ChatVipLog",string); return 0; } //============================================================================== // Administration Chat //============================================================================== if(text[0] == '@' && AccInfo[playerid][Level] >= 1) { new string[128]; GetPlayerName(playerid,string,sizeof(string)); format(string,sizeof(string),"[ADMIN CHAT] %s (%d): %s",string,playerid,text[1]); MessageToAdmins(green,string); #if ADM_CHAT_LOG == true SaveIn("AdmChatLog",string); #endif return 0; } //============================================================================== // Team Chat //============================================================================== if(text[0] == '!) { new string[156]; GetPlayerName(playerid,string,sizeof(string)); format(string,sizeof(string),"[Team Chat]: %s (%d): %s", string, playerid, text[1]); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid)) { SendClientMessage(i, yellow, string); } } return 0; } // Ask CHAT if(text[0] == '#') { if(AccInfo[playerid][Level] < 1) { new playername[MAX_PLAYER_NAME],msg[128]; GetPlayerName(playerid,playername,sizeof(playername)); format(msg,sizeof(msg),""COL_WHITE">> ["COL_RED"HELP"COL_WHITE"/"COL_RED"Question"COL_WHITE"] %s (%d) : "COL_YELLOW"%s",playername, playerid, text[1]); for(new i=0;i<MAX_PLAYERS;++i) { if(IsPlayerConnected(i) && (AccInfo[i][Level] > 0)) SendClientMessage(i,-1,msg); } SendClientMessage(playerid,purple, "* You question has been successfully send to our online administrative staff."); } else SendClientMessage(playerid,red,"You cannot send question because you are already admin."); return 0; } //============================================================================== // Math Quiz Answer //============================================================================== if(strval(text) == MathQuizTest && MathQuizTest != -1) { CorrectAnswer(playerid); return 0; } //============================================================================== // Chat Disabled //============================================================================== if(ServerInfo[DisableChat] == 1) { SendClientMessage(playerid,red,"[ Chat has been Disabled, contact an admin if you have queries. ]"); return 0; } //============================================================================== // Player Muted //============================================================================== if(AccInfo[playerid][Muted] == 1) { AccInfo[playerid][MuteWarnings]++; new string[128]; if(AccInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings]) { format(string, sizeof(string),"[ ATTENTION: You are Muted, you cannot talk (Warnings: %d/%d), contact an admin if you have queries. ]",AccInfo[playerid][MuteWarnings],ServerInfo[MaxMuteWarnings]); SendClientMessage(playerid,red,string); } else { SendClientMessage(playerid,red,"[ ADMIN: You have been Automatically Kicked. | Reason: Exceeding Mute Warnings. ]"); format(string, sizeof(string),"[ Player %s (Id: %d) has been Automatically Kicked. | Reason: Exceeding Mute Warnings. ]",PlayerName2(playerid),playerid); SendClientMessageToAll(grey,string); SaveIn("KickLog",string); Kick(playerid); } } else { //============================================================================== // Player SayS //============================================================================== if(AccInfo[playerid][LoggedIn] == 1) { new string[128]; GetPlayerName(playerid, string, sizeof(string)); format(string, sizeof(string), "%s (%d): "COL_WHITE"%s", string, playerid, text[0]); SendClientMessageToAll(GetPlayerColor(playerid), string); if(AccInfo[playerid][ChatBubbles] == 1) { new MeMsg[MAX_CHATBUBBLE_LENGTH+1]; format(MeMsg,MAX_CHATBUBBLE_LENGTH,"%s",text[0]); SetPlayerChatBubble(playerid,MeMsg,white,35.0,10000); SetTimerEx("Delete3DChatBubble", 5000, false, "i", playerid); } } else SendClientMessage(playerid, red, "* You need to Login to your account to use chat!"); return 0; } //============================================================================== // Flood/Spam Protection //============================================================================== if(AccInfo[playerid][Level] == 0 && !IsPlayerAdmin(playerid)) { if(AccInfo[playerid][SpamCount] == 0) AccInfo[playerid][SpamTime] = gettime(); AccInfo[playerid][SpamCount]++; if(gettime() - AccInfo[playerid][SpamTime] > SPAM_TIMELIMIT) { AccInfo[playerid][SpamCount] = 0; AccInfo[playerid][SpamTime] = gettime(); } else if(gettime() - AccInfo[playerid][SpamTime] < SPAM_TIMELIMIT) { new string[200]; format(string,sizeof(string),"* "COL_RED"Warning received (%d/%d)! Reason: Spam.",AccInfo[playerid][SpamCount],SPAM_MAX_MSGS); SendClientMessage(playerid,white,string); } else if(AccInfo[playerid][SpamCount] == SPAM_MAX_MSGS) { new name[24]; new string[200]; GetPlayerName(playerid,name,24); format(string,sizeof(string),"• "OWNER_NAME" has muted %s (%d) for %d Minutes. Reason: Spam.", name, playerid, AutoUnmuteTime); SendClientMessageToAll(ADMINCOLOR,string); SendClientMessage(playerid,red,"* Spam level reached, You have received your final warning (3/3)! Reason: Spam."); AccInfo[playerid][Muted] = 1; SetTimerEx("AutoUnMute",AutoUnmuteTime*60000,false,"i",playerid); printf("[MUTED] %s (%d) has been muted for 2 minutes reason spamming.", name, playerid); return 0; } } //============================================================================== // Anti Advertisements //============================================================================== if(ServerInfo[AntiAds] == 1) { if(AdvertisementCheck(text) && AccInfo[playerid][Level] < 3) { AccInfo[playerid][MaxAdv]++; new string[128], playername[MAX_PLAYER_NAME]; format(string,sizeof(string),"* ATTENTION: Suspected advertisements in your message, (Warnings: %d/%d).",AccInfo[playerid][MaxAdv], MAX_ADV_WARNINGS); SendClientMessage(playerid, red,string); if(AccInfo[playerid][MaxAdv] == MAX_ADV_WARNINGS) { GetPlayerName(playerid, playername, sizeof(playername)); format(string,sizeof(string),"* You are Automatically muted. | Reason: Many advertisements in your Messages (%d/%d).",AccInfo[playerid][MaxAdv], MAX_ADV_WARNINGS); SendClientMessage(playerid, lightred,string); format(string,sizeof(string),"• "OWNER_NAME" has muted %s (%d) for 5 Minutes. Reason: Advertisements.",playername,playerid); SendClientMessageToAll(ADMINCOLOR, string); AccInfo[playerid][Muted] = 1; SetTimerEx("AutoUnMute2",5*60000,false,"i",playerid); print(string); } } return 0; } //============================================================================== // Send Admin in front of name //============================================================================== #if ADM_InMSG == true if (AccInfo[playerid][Hide] == 0) { if(AccInfo[playerid][Level] > 0) { new str3[256]; format(str3, 256, "(Admin): %s", text); for(new gz=0;gz<200;gz++) if(IsPlayerConnected(gz)) SendPlayerMessageToPlayer(gz, playerid, str3); else SendPlayerMessageToPlayer(gz, playerid, text); } return 0; } #endif //============================================================================== // Forbidden Words //============================================================================== if(ServerInfo[AntiSwear] == 1 && AccInfo[playerid][Level] < ServerInfo[MaxAdminLevel]) for(new s = 0; s < BadWordsCount; s++) { new pos; while((pos = strfind(text,BadWords[s],true)) != -1) for(new i = pos, j = pos + strlen(BadWords[s]); i < j; i++) text[i] = '*'; } //============================================================================== // Block CapsLock //============================================================================== if(AccInfo[playerid][Caps] == 1) UpperToLower(text); if(ServerInfo[NoCaps] == 1) UpperToLower(text); //============================================================================== // Chat Lines (Console) //============================================================================== for(new i = 1; i < MAX_CHAT_LINES-1; i++) Chat[i] = Chat[i+1]; new ChatSTR[128]; GetPlayerName(playerid,ChatSTR,sizeof(ChatSTR)); format(ChatSTR,128,"[CHAT]%s: %s",ChatSTR, text[0]); Chat[MAX_CHAT_LINES-1] = ChatSTR; return 1; }