Advertisement
iRTK

Untitled

Jun 25th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.41 KB | None | 0 0
  1. public OnPlayerText(playerid, text[])
  2. {
  3. if(TutTime[playerid] >= 1 || RegistrationStep[playerid] >= 1) return 0;
  4. new string[256];
  5. if(PlayerInfo[playerid][pMuted] == 1)
  6. {
  7. 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]);
  8. else format(string, sizeof(string), "You are now muted! You will be able to talk again in %d seconds.",PlayerInfo[playerid][pMuteTime]);
  9. SendClientMessage(playerid, COLOR_DARKPINK, string);
  10. return 0;
  11. }
  12. // -- ANTI SPAM -- //
  13. if(!strcmp(text, LastText[playerid]) && strlen(LastText[playerid]) > 0) return 0;
  14. strcpy(LastText[playerid], text, 128);
  15. if(LastTextTime[playerid] >= GetTickCount())
  16. {
  17. TextCount[playerid]++;
  18. if(TextCount[playerid] > 5)
  19. {
  20. PlayerInfo[playerid][pMuted] = 1;
  21. PlayerInfo[playerid][pMuteTime] += 10;
  22. TextCount[playerid] = 0;
  23. mysql_format(SQL,string,sizeof(string),"UPDATE users SET `Muted`='1',`MuteTime`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMuteTime], PlayerInfo[playerid][pNormalName]);
  24. mysql_tquery(SQL,string,"","");
  25. SendClientMessage(playerid, COLOR_DARKPINK, "You have been auto-muted for spamming. You will be unmuted in 10 seconds.");
  26. return 0;
  27. }
  28. }
  29. LastTextTime[playerid] = GetTickCount() + 1000*3;
  30. // -- ANTI SPAM -- //
  31. ///----- CHAT LOGS -----///
  32. new var100[300],resulttt[300],result3[300],namename[30];
  33. GetPlayerName(playerid, namename, sizeof(namename));
  34. if(Mobile[playerid] != -1)
  35. {
  36. format(result3, sizeof(result3),"(cellphone) %s: %s", namename, text);
  37. }
  38. else
  39. {
  40. format(result3, sizeof(result3),"%s: %s", namename, text);
  41. }
  42. mysql_real_escape_string(result3, resulttt);
  43. mysql_format(SQL, var100, sizeof(var100), "INSERT INTO chat_logs (`playerid`,`text`,`where`) VALUES ('%d','%s','chat')", PlayerInfo[playerid][pSQLID], resulttt);
  44. mysql_tquery(SQL,var100,"","");
  45. ///----- CHAT LOGS -----///
  46. new word[30];
  47. new Cache: adv = mysql_query(SQL, "SELECT * FROM `adv`");
  48. for(new ix, jx = cache_get_row_count (); ix != jx; ++ix)
  49. {
  50. cache_get_field_content(ix, "word", word);
  51. if(strfind(text, word, true) != -1)
  52. {
  53. if(PlayerInfo[playerid][pAdmin] < 6)
  54. {
  55. new strrr[128],nameee[30];
  56. GetPlayerName(playerid, nameee, sizeof(nameee));
  57. format(strrr, sizeof(strrr), "%s (%d, level %d) may be server advertising (word found %s):", nameee, playerid, PlayerInfo[playerid][pLevel], word);
  58. ABroadCast(COLOR_RED2, strrr, 1);
  59. ABroadCast(COLOR_RED2, text, 1);
  60. 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!");
  61. return 0;
  62. }
  63. }
  64. }
  65. cache_delete(adv);
  66.  
  67. new sendername[MAX_PLAYER_NAME];
  68. new tmp[256];
  69. format(string, sizeof(string), "\"%s\"", text);
  70. SetPlayerChatBubble(playerid, text, COLOR_CHATBUBBLE, 10.0, 10000);
  71. if(TalkingLive[playerid] != 0)
  72. {
  73. GetPlayerName(playerid, sendername, sizeof(sendername));
  74. if(PlayerInfo[playerid][pLeader] == 9 || PlayerInfo[playerid][pMember] == 9)
  75. {
  76. format(string, sizeof(string), "NR %s: %s", sendername, text);
  77. OOCNews(COLOR_LIGHTGREEN, string);
  78. }
  79. else
  80. {
  81. format(string, sizeof(string), "LivePlayer %s: %s", sendername, text);
  82. OOCNews(COLOR_LIGHTGREEN, string);
  83. }
  84. return 0;
  85. }
  86. if(Mobile[playerid] != -1)
  87. {
  88. new idx;
  89. tmp = strtok(text, idx);
  90. GetPlayerName(playerid, sendername, sizeof(sendername));
  91. format(string, sizeof(string), "(cellphone) %s: %s", sendername, text);
  92. ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  93. if(Mobile[playerid] != -2 && Mobile[playerid] != -3 && Mobile[playerid] != -4)
  94. {
  95. if(IsPlayerConnected(Mobile[playerid]))
  96. {
  97. if(Mobile[Mobile[playerid]] == playerid)
  98. {
  99. if(PlayerInfo[Mobile[playerid]][pSpeaker] == 1)
  100. {
  101. ProxDetector(20.0, Mobile[playerid], string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  102. }
  103. else
  104. {
  105. SendClientMessage(Mobile[playerid], COLOR_YELLOW,string);
  106. }
  107. }
  108. }
  109. else
  110. {
  111. SendClientMessage(playerid, COLOR_YELLOW,"Theres nobody there.");
  112. }
  113. }
  114. else
  115. {
  116. if(Mobile[playerid] == -2)
  117. {
  118. if(!strcmp(text, "LSPD", true) || !strcmp(text, "police", true))
  119. {
  120. Mobile[playerid] = -3;
  121. SendClientMessage(playerid, COLOR_WHITE, "(cellphone) 112: You have reached the Los Santos Police emergency hotline; can you describe the crime?");
  122. }
  123. else if(!strcmp(text, "LSFMD", true) || !strcmp(text, "medic", true) || !strcmp(text, "ambulance", true))
  124. {
  125. Mobile[playerid] = -4;
  126. SendClientMessage(playerid, COLOR_WHITE, "(cellphone) 112: This is the Los Santos Fire & Medic Department emergency hotline; describe the emergency, please.");
  127. }
  128. else SendClientMessage(playerid, COLOR_WHITE, "(cellphone) 112: Sorry, I didn't quite understand that... speak again?");
  129. }
  130. else if(Mobile[playerid] == -3)
  131. {
  132. new location[MAX_ZONE_NAME], name[30], strings[128];
  133. GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  134. GetPlayerName(playerid, name, sizeof(name));
  135. format(strings, sizeof(strings), "Dispatch: %s has reported: '%s' (10-20 %s)", name, text, location);
  136. SendTeamMessage(8, COLOR_LIGHTBLUE, strings);
  137. SendTeamMessage(3, COLOR_LIGHTBLUE, strings);
  138. SendTeamMessage(2, COLOR_LIGHTBLUE, strings);
  139. SendTeamMessage(1, COLOR_LIGHTBLUE, strings);
  140. SendClientMessage(playerid, COLOR_WHITE, "(cellphone) 112: Thank you for reporting this incident; a patrol unit is now on its way.");
  141. SendClientMessage(playerid, COLOR_WHITE, "Your call has been terminated by the other party.");
  142. RemovePlayerAttachedObject(playerid, 4);
  143. Mobile[playerid] = -1;
  144. CellTime[playerid] = 0;
  145. PlayerInfo[playerid][pSpeaker] = 0;
  146. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  147. }
  148. else if(Mobile[playerid] == -4)
  149. {
  150. new location[MAX_ZONE_NAME], name[30], strings[128];
  151. GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  152. GetPlayerName(playerid, name, sizeof(name));
  153. format(strings, sizeof(strings), "Dispatch: %s has reported '%s' (10-20 %s)", name, text, location);
  154. SendTeamMessage(14, COLOR_ALLDEPT, strings);
  155. SendClientMessage(playerid, COLOR_WHITE, "(cellphone) 112: Thank you for reporting this incident; we are on our way.");
  156. SendClientMessage(playerid, COLOR_WHITE, "Your call has been terminated by the other party.");
  157. RemovePlayerAttachedObject(playerid, 4);
  158. Mobile[playerid] = -1;
  159. CellTime[playerid] = 0;
  160. PlayerInfo[playerid][pSpeaker] = 0;
  161. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  162. }
  163. }
  164. format(string, sizeof(string), "(cellphone) \"%s\"", text);
  165. SetPlayerChatBubble(playerid, string, COLOR_CHATBUBBLE, 10.0, 10000);
  166. return 0;
  167. }
  168. if (realchat)
  169. {
  170. if(gPlayerLogged[playerid] == 0)
  171. {
  172. return 0;
  173. }
  174. //GetPlayerName(playerid, sendername, sizeof(sendername));
  175. //format(string, sizeof(string), "%s: %s", sendername, text);
  176. //ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  177.  
  178. new szMessage[1000];
  179. new szPlayerName[32];
  180. GetPlayerName(playerid, szPlayerName, 32);
  181. if(PlayerInfo[playerid][pAdmin] > 5)
  182. {
  183. format(szMessage, sizeof(szMessage), "{99FFFF}[Co-Owner]{FFFFFF}%s:{FFFFFF} %s", szPlayerName, text);
  184. }
  185. if(PlayerInfo[playerid][pAdmin] > 6)
  186. {
  187. format(szMessage, sizeof(szMessage), "{CC0000}[Owner]{FFFFFF}%s:{FFFFFF} %s", szPlayerName, text);
  188. }
  189. if(PlayerInfo[playerid][pAdmin] > 7)
  190. {
  191. format(szMessage, sizeof(szMessage), "{CC0000}[Fondator]{FFFFFF}%s:{FFFFFF} %s", szPlayerName, text);
  192. }
  193. if(PlayerInfo[playerid][pPaintBallG] > 0)
  194. {
  195. format(szMessage,sizeof(szMessage),"{BA3FC1}%s [%d kills]{FFFFFF}: %s",szPlayerName,PlayerInfo[playerid][pPaintBallKills],text);
  196. foreach(new idd : Player)
  197. {
  198. if(PlayerInfo[idd][pPaintBallG] == PlayerInfo[playerid][pPaintBallG])
  199. {
  200. SendSplitMessage(idd, COLOR_WHITE, szMessage);
  201. }
  202. }
  203. }
  204. if(PlayerInfo[playerid][pPaintBallG] == 0)
  205. {
  206. if(AdminDuty[playerid] > 0 && PlayerInfo[playerid][pAdmin] > 0)
  207. {
  208. format(szMessage, sizeof(szMessage), "(( Admin %s says: %s ))", szPlayerName, text);
  209. ProxDetector(100.0, playerid, szMessage, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
  210. }
  211. else
  212. {
  213. format(szMessage, sizeof(szMessage), "%s",text);
  214. //MESSAGE SPLIT
  215. new len = strlen(szMessage),
  216. _iL = len / EX_SPLITLENGTHH;
  217. if( ( len % EX_SPLITLENGTHH ) ) _iL++;
  218. new _Line[EX_SPLITLENGTHH+5];
  219. new _:_i@Index;
  220. while( _i@Index < _iL )
  221. {
  222. if( _i@Index == 0 )
  223. strmid( _Line, szMessage, ( _i@Index * EX_SPLITLENGTHH ), ( _i@Index * EX_SPLITLENGTHH ) + EX_SPLITLENGTHH );
  224. else
  225. strmid( _Line, szMessage, ( _i@Index * EX_SPLITLENGTHH ), ( _i@Index * EX_SPLITLENGTHH ) + EX_SPLITLENGTHH );
  226.  
  227. if( _iL > 1 )
  228. {
  229. if( _i@Index > 0 )
  230. {
  231. format( _Line, sizeof _Line, "... %s", _Line );
  232. }
  233. }
  234. ChatMessage(25.0, playerid, _Line);
  235. _i@Index++;
  236. }
  237. }
  238. }
  239. format(szMessage, sizeof(szMessage), "\"%s\"", text);
  240. SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 15.0, 10000);
  241. return 0;
  242. }
  243. return 1;
  244. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement