28.10.2013, 21:25
Код:
public OnPlayerText(playerid, text[]) { SetPlayerChatBubble(playerid, text, 0xFFFFFFFF, 100.0, 10000); CallLocalFunction("StoreChatLine", "ds", playerid, text); if(text[0] == ADMCHATKEY && pInfo[playerid][pLevel] >= 1) { format(Jstring,sizeof(Jstring),">> [Admin Chat] %s(%d): %s",GetName(playerid), playerid,text[1]); foreach(Player, i) if(pInfo[i][pLevel] >= 1) SendClientMessage(i,Admchat,Jstring); WriteToLog(Jstring,"AdminChat"); return 0; } if(pInfo[playerid][Muted] == 1) { SendClientMessage(playerid,red,">> You are muted, you are not allowed to talk!"); return 0; } if(text[0] == DONATORCHATKEY && pInfo[playerid][pLevel] >= 1) { format(Jstring,sizeof(Jstring),">> [V.I.P Chat] %s(%d): %s",GetName(playerid), playerid,text[1]); foreach(Player, i) if(pInfo[i][pLevel] >= 1) SendClientMessage(i,Admchat,Jstring); WriteToLog(Jstring,"VIPChatLog"); return 0; } if(IsDisabledChat == 1) { format(Jstring,sizeof(Jstring),"***Chat is disabled by %s",AdmName); SendClientMessage(playerid,red,Jstring); return 0; } if(AntiSpam == 1 && pInfo[playerid][Muted] == 0) { GetPVarString(playerid, "ChatMsg",CTMSG,128); if(!strcmp(CTMSG, text, false)) { pInfo[playerid][SpamWarns]++; if(pInfo[playerid][SpamWarns] < MAX_SPAM_WARNS)SendClientMessage(playerid,red,">> WARNING: Do not repeat or you will be muted!"); if(pInfo[playerid][SpamWarns] >= MAX_SPAM_WARNS) { format(Jstring,sizeof(Jstring),">> %s(%d) has been automatically muted for %d seconds | REASON: Spam ",GetName(playerid),playerid,AUTO_MUTE_TIME); SendClientMessageToAll(red, Jstring); pInfo[playerid][Muted] = 1; SetTimerEx("UnmutePlayer",AUTO_MUTE_TIME*1000,false,"d",playerid); return 0; } } else pInfo[playerid][SpamWarns] = 0; SetPVarString(playerid,"ChatMsg",text); } if(AntiForbiddenWords == 1 && IsBadWord(text)) for(new i = WordSt, l = WordSt + WordEn; i < l; i++) text[i] = '•'; if(AntiAdv == 1) { if(IsAdvertisement(text)) { if(AdminImmunity == 1 && pInfo[playerid][pLevel] >= 2) return 1; ShowPlayerDialog(playerid,JDIALOGS+200,DIALOG_STYLE_MSGBOX,"{FF0000}Advertising is NOT allowed on this server","{FF0000}You have been kicked from the server | REASON : \"Advertising\"","OK",""); SetTimerEx("KickPlayer",100,false,"d",playerid); format(Jstring,sizeof(Jstring),"%s(%d) has been kicked | REASON: \"Advertising\"",GetName(playerid),playerid); SendClientMessageToAll(red, Jstring); format(Jstring,sizeof(Jstring),"%s(%d) has been automatically kicked for 'Advertising' (%s)",GetName(playerid),playerid,text); SendToAdmins(orange,Jstring); format(Jstring,sizeof(Jstring),"[SYSTEM KICK] %s has been kicked for 'Advertising' (%s)",GetName(playerid),text); WriteToLog(Jstring,"KickLog"); return 0; } } return 1; }