Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.18 KB | None | 0 0
  1. public OnPlayerText(playerid, text[])
  2. {
  3.  
  4. if(InRegister[playerid] > 0) return 0;
  5. new string[256];
  6. if(PlayerInfo[playerid][pMuted] == 1)
  7. {
  8. 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]);
  9. else format(string, sizeof(string), "You are now muted! You will be able to talk again in %d seconds.",PlayerInfo[playerid][pMuteTime]);
  10. SendClientMessage(playerid, COLOR_DARKPINK, string);
  11. return 0;
  12. }
  13. // -- ANTI SPAM -- //
  14. if(!strcmp(text, LastText[playerid]) && strlen(LastText[playerid]) > 0) return 0;
  15. strcpy(LastText[playerid], text, 128);
  16. if(LastTextTime[playerid] >= GetTickCount())
  17. {
  18. TextCount[playerid]++;
  19. if(TextCount[playerid] > 5)
  20. {
  21. PlayerInfo[playerid][pMuted] = 1;
  22. PlayerInfo[playerid][pMuteTime] += 10;
  23. TextCount[playerid] = 0;
  24. mysql_format(SQL,string,sizeof(string),"UPDATE users SET `Muted`='1',`MuteTime`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMuteTime], PlayerInfo[playerid][pNormalName]);
  25. mysql_tquery(SQL,string,"","");
  26. SendClientMessage(playerid, COLOR_DARKPINK, "You have been auto-muted for spamming. You will be unmuted in 10 seconds.");
  27. return 0;
  28. }
  29. }
  30. LastTextTime[playerid] = GetTickCount() + 1000*3;
  31. // -- ANTI SPAM -- //
  32.  
  33. ///----- CHAT LOGS -----///
  34. new var100[300],resulttt[300],result3[300],namename[30];
  35. GetPlayerName(playerid, namename, sizeof(namename));
  36. if(Mobile[playerid] != -1)
  37. {
  38. format(result3, sizeof(result3),"(cellphone) %s: %s", namename, text);
  39. }
  40. else
  41. {
  42. format(result3, sizeof(result3),"%s: %s", namename, text);
  43. }
  44. mysql_real_escape_string(result3, resulttt);
  45. mysql_format(SQL, var100, sizeof(var100), "INSERT INTO chat_logs (`playerid`,`text`,`where`) VALUES ('%d','%s','chat')", PlayerInfo[playerid][pSQLID], resulttt);
  46. mysql_tquery(SQL,var100,"","");
  47. CheckChatLogs(playerid);
  48. assert(AntiFlood_Check(playerid));
  49. ///----- CHAT LOGS -----///
  50. new word[30];
  51. new Cache: adv = mysql_query(SQL, "SELECT * FROM `adv`");
  52. for(new ix, jx = cache_get_row_count (); ix != jx; ++ix)
  53. {
  54. cache_get_field_content(ix, "word", word);
  55. if(strfind(text, word, true) != -1)
  56. {
  57. if(PlayerInfo[playerid][pAdmin] < 6)
  58. {
  59. new strrr[128],nameee[30];
  60. GetPlayerName(playerid, nameee, sizeof(nameee));
  61. format(strrr, sizeof(strrr), "%s (%d, level %d) may be server advertising (word found %s):", nameee, playerid, PlayerInfo[playerid][pLevel], word);
  62. ABroadCast(COLOR_RED2, strrr, 1);
  63. ABroadCast(COLOR_RED2, text, 1);
  64. 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!");
  65. return 0;
  66. }
  67. }
  68. }
  69. cache_delete(adv);
  70.  
  71. new sendername[MAX_PLAYER_NAME];
  72. new tmp[256];
  73. if(TalkingLive[playerid] != 0)
  74. {
  75. GetPlayerName(playerid, sendername, sizeof(sendername));
  76. if(PlayerInfo[playerid][pLeader] == 9 || PlayerInfo[playerid][pMember] == 9)
  77. {
  78. format(string, sizeof(string), "NR %s: %s", sendername, text);
  79. OOCNews(COLOR_LIGHTGREEN, string);
  80. }
  81. else
  82. {
  83. format(string, sizeof(string), "LivePlayer %s: %s", sendername, text);
  84. OOCNews(COLOR_LIGHTGREEN, string);
  85. }
  86. return 0;
  87. }
  88. if(Mobile[playerid] != -1)
  89. {
  90. new idx;
  91. tmp = strtok(text, idx);
  92. GetPlayerName(playerid, sendername, sizeof(sendername));
  93. format(string, sizeof(string), "(cellphone) %s: %s", sendername, text);
  94. ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  95. if(Mobile[playerid] != -2 && Mobile[playerid] != -3 && Mobile[playerid] != -4)
  96. {
  97. if(IsPlayerConnected(Mobile[playerid]))
  98. {
  99. if(Mobile[Mobile[playerid]] == playerid)
  100. {
  101. if(PlayerInfo[Mobile[playerid]][pSpeaker] == 1)
  102. {
  103. ProxDetector(20.0, Mobile[playerid], string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  104. }
  105. else
  106. {
  107. SendClientMessage(Mobile[playerid], COLOR_YELLOW,string);
  108. }
  109. }
  110. }
  111. else
  112. {
  113. SendClientMessage(playerid, COLOR_YELLOW,"Theres nobody there.");
  114. }
  115. }
  116. format(string, sizeof(string), "(cellphone) \"%s\"", text);
  117. SetPlayerChatBubble(playerid, string, COLOR_CHATBUBBLE, 10.0, 10000);
  118. return 0;
  119. }
  120. if (realchat)
  121. {
  122. if(gPlayerLogged[playerid] == 0)
  123. {
  124. return 0;
  125. }
  126.  
  127. new szMessage[1000];
  128. new szPlayerName[32];
  129. GetPlayerName(playerid, szPlayerName, 32);
  130. if(PlayerInfo[playerid][pPaintBallG] > 0)
  131. {
  132. format(szMessage,sizeof(szMessage),"{A9C4E4}(Jucator){FFFFFF}%s{FFFFFF}{FFFF00}(%s){FFFFFF}: %s",szPlayerName,PlayerInfo[playerid][pPaintBallRankName], text);
  133. foreach(new idd : Player)
  134. {
  135. if(PlayerInfo[idd][pPaintBallG] == PlayerInfo[playerid][pPaintBallG])
  136. {
  137. SendSplitMessage(idd, COLOR_WHITE, szMessage);
  138. }
  139. }
  140. }
  141. if(PlayerInfo[playerid][pPaintBallG] == 0)
  142. {
  143. if(AdminDuty[playerid] > 0 && PlayerInfo[playerid][pAdmin] > 0)
  144. {
  145. format(szMessage, sizeof(szMessage), "(( Admin %s says: %s ))", szPlayerName, text);
  146. ProxDetector(100.0, playerid, szMessage, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
  147. }
  148. else
  149. {
  150. format(szMessage, sizeof(szMessage), "%s ",text);
  151. //MESSAGE SPLIT
  152. new len = strlen(szMessage),
  153. _iL = len / EX_SPLITLENGTHH;
  154. if( ( len % EX_SPLITLENGTHH ) ) _iL++;
  155. new _Line[EX_SPLITLENGTHH+5];
  156. new _:_i@Index;
  157. while( _i@Index < _iL )
  158. {
  159. if( _i@Index == 0 )
  160. strmid( _Line, szMessage, ( _i@Index * EX_SPLITLENGTHH ), ( _i@Index * EX_SPLITLENGTHH ) + EX_SPLITLENGTHH );
  161. else
  162. strmid( _Line, szMessage, ( _i@Index * EX_SPLITLENGTHH ), ( _i@Index * EX_SPLITLENGTHH ) + EX_SPLITLENGTHH );
  163.  
  164. if( _iL > 1 )
  165. {
  166. if( _i@Index > 0 )
  167. {
  168. format( _Line, sizeof _Line, "... %s", _Line );
  169. }
  170. }
  171. ChatMessage(25.0, playerid, _Line);
  172. _i@Index++;
  173. }
  174. }
  175. }
  176. format(szMessage, sizeof(szMessage), "\"%s\"", text);
  177. SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 15.0, 10000);
  178. return 0;
  179. }
  180. return 1;
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement