Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerText(playerid, text[])
- {
- if(InRegister[playerid] > 0) return 0;
- new string[256];
- if(PlayerInfo[playerid][pMuted] == 1)
- {
- if(PlayerInfo[playerid][pLanguage] == 2) format(string, sizeof(string), "Nu poti scrie pe chat momentan(mute). Vei putea scrie pe chat peste %d secunde.",PlayerInfo[playerid][pMuteTime]);
- else format(string, sizeof(string), "You are now muted! You will be able to talk again in %d seconds.",PlayerInfo[playerid][pMuteTime]);
- SendClientMessage(playerid, COLOR_DARKPINK, string);
- return 0;
- }
- // -- ANTI SPAM -- //
- if(!strcmp(text, LastText[playerid]) && strlen(LastText[playerid]) > 0) return 0;
- strcpy(LastText[playerid], text, 128);
- if(LastTextTime[playerid] >= GetTickCount())
- {
- TextCount[playerid]++;
- if(TextCount[playerid] > 5)
- {
- PlayerInfo[playerid][pMuted] = 1;
- PlayerInfo[playerid][pMuteTime] += 10;
- TextCount[playerid] = 0;
- mysql_format(SQL,string,sizeof(string),"UPDATE users SET `Muted`='1',`MuteTime`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMuteTime], PlayerInfo[playerid][pNormalName]);
- mysql_tquery(SQL,string,"","");
- SendClientMessage(playerid, COLOR_DARKPINK, "You have been auto-muted for spamming. You will be unmuted in 10 seconds.");
- return 0;
- }
- }
- LastTextTime[playerid] = GetTickCount() + 1000*3;
- // -- ANTI SPAM -- //
- ///----- CHAT LOGS -----///
- new var100[300],resulttt[300],result3[300],namename[30];
- GetPlayerName(playerid, namename, sizeof(namename));
- if(Mobile[playerid] != -1)
- {
- format(result3, sizeof(result3),"(cellphone) %s: %s", namename, text);
- }
- else
- {
- format(result3, sizeof(result3),"%s: %s", namename, text);
- }
- mysql_real_escape_string(result3, resulttt);
- mysql_format(SQL, var100, sizeof(var100), "INSERT INTO chat_logs (`playerid`,`text`,`where`) VALUES ('%d','%s','chat')", PlayerInfo[playerid][pSQLID], resulttt);
- mysql_tquery(SQL,var100,"","");
- CheckChatLogs(playerid);
- assert(AntiFlood_Check(playerid));
- ///----- CHAT LOGS -----///
- new word[30];
- new Cache: adv = mysql_query(SQL, "SELECT * FROM `adv`");
- for(new ix, jx = cache_get_row_count (); ix != jx; ++ix)
- {
- cache_get_field_content(ix, "word", word);
- if(strfind(text, word, true) != -1)
- {
- if(PlayerInfo[playerid][pAdmin] < 6)
- {
- new strrr[128],nameee[30];
- GetPlayerName(playerid, nameee, sizeof(nameee));
- format(strrr, sizeof(strrr), "%s (%d, level %d) may be server advertising (word found %s):", nameee, playerid, PlayerInfo[playerid][pLevel], word);
- ABroadCast(COLOR_RED2, strrr, 1);
- ABroadCast(COLOR_RED2, text, 1);
- SS(playerid, COLOR_LIGHTGREEN3, "Este interzis sa discuti despre alte servere sau sa faci reclama altor servere.", "You are not allowed to advertise other servers!");
- return 0;
- }
- }
- }
- cache_delete(adv);
- new sendername[MAX_PLAYER_NAME];
- new tmp[256];
- if(TalkingLive[playerid] != 0)
- {
- GetPlayerName(playerid, sendername, sizeof(sendername));
- if(PlayerInfo[playerid][pLeader] == 9 || PlayerInfo[playerid][pMember] == 9)
- {
- format(string, sizeof(string), "NR %s: %s", sendername, text);
- OOCNews(COLOR_LIGHTGREEN, string);
- }
- else
- {
- format(string, sizeof(string), "LivePlayer %s: %s", sendername, text);
- OOCNews(COLOR_LIGHTGREEN, string);
- }
- return 0;
- }
- if(Mobile[playerid] != -1)
- {
- new idx;
- tmp = strtok(text, idx);
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "(cellphone) %s: %s", sendername, text);
- ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
- if(Mobile[playerid] != -2 && Mobile[playerid] != -3 && Mobile[playerid] != -4)
- {
- if(IsPlayerConnected(Mobile[playerid]))
- {
- if(Mobile[Mobile[playerid]] == playerid)
- {
- if(PlayerInfo[Mobile[playerid]][pSpeaker] == 1)
- {
- ProxDetector(20.0, Mobile[playerid], string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
- }
- else
- {
- SendClientMessage(Mobile[playerid], COLOR_YELLOW,string);
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_YELLOW,"Theres nobody there.");
- }
- }
- format(string, sizeof(string), "(cellphone) \"%s\"", text);
- SetPlayerChatBubble(playerid, string, COLOR_CHATBUBBLE, 10.0, 10000);
- return 0;
- }
- if (realchat)
- {
- if(gPlayerLogged[playerid] == 0)
- {
- return 0;
- }
- new szMessage[1000];
- new szPlayerName[32];
- GetPlayerName(playerid, szPlayerName, 32);
- if(PlayerInfo[playerid][pPaintBallG] > 0)
- {
- format(szMessage,sizeof(szMessage),"{A9C4E4}(Jucator){FFFFFF}%s{FFFFFF}{FFFF00}(%s){FFFFFF}: %s",szPlayerName,PlayerInfo[playerid][pPaintBallRankName], text);
- foreach(new idd : Player)
- {
- if(PlayerInfo[idd][pPaintBallG] == PlayerInfo[playerid][pPaintBallG])
- {
- SendSplitMessage(idd, COLOR_WHITE, szMessage);
- }
- }
- }
- if(PlayerInfo[playerid][pPaintBallG] == 0)
- {
- if(AdminDuty[playerid] > 0 && PlayerInfo[playerid][pAdmin] > 0)
- {
- format(szMessage, sizeof(szMessage), "(( Admin %s says: %s ))", szPlayerName, text);
- ProxDetector(100.0, playerid, szMessage, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
- }
- else
- {
- format(szMessage, sizeof(szMessage), "%s ",text);
- //MESSAGE SPLIT
- new len = strlen(szMessage),
- _iL = len / EX_SPLITLENGTHH;
- if( ( len % EX_SPLITLENGTHH ) ) _iL++;
- new _Line[EX_SPLITLENGTHH+5];
- new _:_i@Index;
- while( _i@Index < _iL )
- {
- if( _i@Index == 0 )
- strmid( _Line, szMessage, ( _i@Index * EX_SPLITLENGTHH ), ( _i@Index * EX_SPLITLENGTHH ) + EX_SPLITLENGTHH );
- else
- strmid( _Line, szMessage, ( _i@Index * EX_SPLITLENGTHH ), ( _i@Index * EX_SPLITLENGTHH ) + EX_SPLITLENGTHH );
- if( _iL > 1 )
- {
- if( _i@Index > 0 )
- {
- format( _Line, sizeof _Line, "... %s", _Line );
- }
- }
- ChatMessage(25.0, playerid, _Line);
- _i@Index++;
- }
- }
- }
- format(szMessage, sizeof(szMessage), "\"%s\"", text);
- SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 15.0, 10000);
- return 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement