1
0

OnPlayerText.inc 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. //Needs cleaning up
  2. static str[144], tmp[144], sendername[MAX_PLAYER_NAME+1], giveplayer[MAX_PLAYER_NAME+1];
  3. public OnPlayerText(playerid, text[])
  4. {
  5. if(gPlayerLogged[playerid] == 0)
  6. {
  7. SendClientMessage(playerid, COLOR_GREY, "You are not logged in.");
  8. return 0;
  9. }
  10. if(PlayerInfo[playerid][pMuted] == 1)
  11. {
  12. SendClientMessage(playerid, COLOR_GREY, "You can't speak while muted.");
  13. return 0;
  14. }
  15. if(pDeathState[playerid] == PLAYER_STATE_INHOSP || WatchingTV[playerid] == true || OnCCTV[playerid] != -1) return 0;
  16. // Gagged
  17. if(IsPlayerGagged(playerid)) {
  18. SendClientMessage(playerid, COLOR_GREY, "The gag in your mouth makes you unable to speak...");
  19. new gagStr[128];
  20. format(gagStr, sizeof(gagStr), "* %s tries to mumble something.", PlayerICName(playerid));
  21. SetPlayerChatBubble(playerid, gagStr, COLOR_PURPLE, 20.0, 15000);
  22. return 0;
  23. }
  24. // Watching PD CCTV
  25. if(watchingPDCCTV[playerid]) {
  26. SendClientMessage(playerid, COLOR_GREY, "You can't speak while watching the PD CCTV.");
  27. return 0;
  28. }
  29. //anti server ad
  30. if(PlayerInfo[playerid][pAdmin] < 1)
  31. {
  32. if(strfind(text, ":", true) != -1)
  33. {
  34. new i_numcount, i_period, i_pos;
  35. while(text[i_pos])
  36. {
  37. if('0' <= text[i_pos] <= '9') i_numcount++;
  38. else if(text[i_pos] == '.') i_period++;
  39. i_pos++;
  40. }
  41. if(i_numcount >= 8 && i_period >= 3)
  42. {
  43. format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s [%d] has attempted to advertise another server.", PlayerICName(playerid), playerid);
  44. ABroadCast(COLOR_WHITE, str, 1);
  45. format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: '%s'", text);
  46. ABroadCast(COLOR_GRAD3, str, 1);
  47. return 0;
  48. }
  49. }
  50. }
  51. if(MarriageCeremoney[playerid] > 0)
  52. {
  53. new idx;
  54. tmp = strtok(text, idx);
  55. if((strcmp("yes", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("yes")))
  56. {
  57. if(GotProposedBy[playerid] < 999)
  58. {
  59. if(IsPlayerConnected(GotProposedBy[playerid]))
  60. {
  61. strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
  62. GetPlayerICName(GotProposedBy[playerid], giveplayer, sizeof(giveplayer));
  63. format(str, sizeof(str), "Priest: %s do you take %s as your lovely Wife? (type 'yes', anything else will reject the Marriage).", giveplayer, sendername);
  64. SendClientMessage(GotProposedBy[playerid], COLOR_WHITE, str);
  65. MarriageCeremoney[GotProposedBy[playerid]] = 1;
  66. MarriageCeremoney[playerid] = 0;
  67. GotProposedBy[playerid] = 999;
  68. }
  69. else
  70. {
  71. MarriageCeremoney[playerid] = 0;
  72. GotProposedBy[playerid] = 999;
  73. return 1;
  74. }
  75. }
  76. else if(ProposedTo[playerid] < 999)
  77. {
  78. if(IsPlayerConnected(ProposedTo[playerid]))
  79. {
  80. strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
  81. GetPlayerICName(ProposedTo[playerid], giveplayer, sizeof(giveplayer));
  82. if(PlayerInfo[playerid][pSex] == 1 && PlayerInfo[ProposedTo[playerid]][pSex] == 2)
  83. {
  84. format(str, sizeof(str), "Priest: %s and %s i pronounce you now...Husband & Wife, you may kiss the Bride.", sendername, giveplayer);
  85. SendClientMessage(playerid, COLOR_WHITE, str);
  86. format(str, sizeof(str), "Priest: %s and %s i pronounce you now...Husband & Wife, you may kiss the Groom.", giveplayer, sendername);
  87. SendClientMessage(ProposedTo[playerid], COLOR_WHITE, str);
  88. format(str, sizeof(str), "Marriage News: We have a new lovely couple, %s & %s have been married at the church in Jefferson.", sendername, giveplayer);
  89. OOCNews(COLOR_WHITE, str);
  90. }
  91. else if(PlayerInfo[playerid][pSex] == 1 && PlayerInfo[ProposedTo[playerid]][pSex] == 1)
  92. {
  93. format(str, sizeof(str), "Priest: %s and %s i pronounce you now...Husband & Husband, you may kiss the Groom.", sendername, giveplayer);
  94. SendClientMessage(playerid, COLOR_WHITE, str);
  95. format(str, sizeof(str), "Priest: %s and %s i pronounce you now...Husband & Husband, you may kiss the Groom.", giveplayer, sendername);
  96. SendClientMessage(ProposedTo[playerid], COLOR_WHITE, str);
  97. format(str, sizeof(str), "Marriage News: We have a new Gay couple, %s & %s have been married at the church in Jefferson.", sendername, giveplayer);
  98. OOCNews(COLOR_WHITE, str);
  99. Accent[playerid] = "Gay";
  100. Accent[ProposedTo[playerid]] = "Gay";
  101. }
  102. else if(PlayerInfo[playerid][pSex] == 2 && PlayerInfo[ProposedTo[playerid]][pSex] == 2)
  103. {
  104. format(str, sizeof(str), "Priest: %s and %s i pronounce you now...Wife & Wife, you may kiss the Bride.", sendername, giveplayer);
  105. SendClientMessage(playerid, COLOR_WHITE, str);
  106. format(str, sizeof(str), "Priest: %s and %s i pronounce you now...Wife & Wife, you may kiss the Bride.", giveplayer, sendername);
  107. SendClientMessage(ProposedTo[playerid], COLOR_WHITE, str);
  108. format(str, sizeof(str), "Marriage News: We have a new Lesbian couple, %s & %s have been married at the church in Jefferson.", sendername, giveplayer);
  109. OOCNews(COLOR_WHITE, str);
  110. }
  111. MarriageCeremoney[ProposedTo[playerid]] = 0;
  112. MarriageCeremoney[playerid] = 0;
  113. format(str, sizeof(str), "%s", sendername);
  114. strmid(PlayerInfo[ProposedTo[playerid]][pMarriedTo], str, 0, strlen(str), 255);
  115. format(str, sizeof(str), "%s", giveplayer);
  116. strmid(PlayerInfo[playerid][pMarriedTo], str, 0, strlen(str), 255);
  117. GiveMoney(playerid, -100000);
  118. PlayerInfo[playerid][pMarried] = 1;
  119. PlayerInfo[ProposedTo[playerid]][pMarried] = 1;
  120. ProposedTo[playerid] = 999;
  121. MarriageCeremoney[playerid] = 0;
  122. return 1;
  123. }
  124. else
  125. {
  126. MarriageCeremoney[playerid] = 0;
  127. ProposedTo[playerid] = 999;
  128. return 1;
  129. }
  130. }
  131. }
  132. else
  133. {
  134. if(GotProposedBy[playerid] < 999)
  135. {
  136. if(IsPlayerConnected(GotProposedBy[playerid]))
  137. {
  138. strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
  139. GetPlayerICName(GotProposedBy[playerid], giveplayer, sizeof(giveplayer));
  140. format(str, sizeof(str), "* You didn't want to Marry %s, no 'yes' was said.", giveplayer);
  141. SendClientMessage(playerid, COLOR_YELLOW, str);
  142. format(str, sizeof(str), "* %s did't want to Marry you, no 'yes' was said.", sendername);
  143. SendClientMessage(GotProposedBy[playerid], COLOR_YELLOW, str);
  144. return 1;
  145. }
  146. else
  147. {
  148. MarriageCeremoney[playerid] = 0;
  149. GotProposedBy[playerid] = 999;
  150. return 1;
  151. }
  152. }
  153. else if(ProposedTo[playerid] < 999)
  154. {
  155. if(IsPlayerConnected(ProposedTo[playerid]))
  156. {
  157. strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
  158. GetPlayerICName(ProposedTo[playerid], giveplayer, sizeof(giveplayer));
  159. format(str, sizeof(str), "* You didn't want to Marry %s, no 'yes' was said.", giveplayer);
  160. SendClientMessage(playerid, COLOR_YELLOW, str);
  161. format(str, sizeof(str), "* %s didn't want to Marry you, no 'yes' was said.", sendername);
  162. SendClientMessage(ProposedTo[playerid], COLOR_YELLOW, str);
  163. return 1;
  164. }
  165. else
  166. {
  167. MarriageCeremoney[playerid] = 0;
  168. ProposedTo[playerid] = 999;
  169. return 1;
  170. }
  171. }
  172. }
  173. return 1;
  174. }
  175. if(SAPDClearing[playerid] != 0)
  176. {
  177. if(SAPDClearing[playerid] == 1)
  178. {
  179. new idx;
  180. tmp = strtok(text, idx);
  181. new playa;
  182. playa = ReturnUser(tmp);
  183. if(IsPlayerConnected(playa))
  184. {
  185. if(playa != INVALID_PLAYER_ID)
  186. {
  187. if(PlayerInfo[playa][pWantedLevel] > 0)
  188. {
  189. strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
  190. strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME);
  191. PlayerInfo[playa][pWantedLevel] = 0;
  192. SetPlayerToTeamColor(playa);
  193. SAPDClearing[playerid] = 0;
  194. TogglePlayerControllable(playerid, true);
  195. format(str, sizeof(str), "* You cleared the records and wanted points of %s.", giveplayer);
  196. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  197. format(str, sizeof(str), "* %s %s has cleared your records and wanted points.", GetPlayerRank(playerid), sendername);
  198. SendClientMessage(playa, COLOR_LIGHTBLUE, str);
  199. format(str, sizeof(str), "HQ: %s %s has cleared %s's records and wanted points.", GetPlayerRank(playerid), sendername, giveplayer);
  200. SendDepartmentMessage(TEAM_BLUE_COLOR, str);
  201. isBOLO[playa] = 0;
  202. new query[128];
  203. mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `newcrimes` SET `CrimeEnabled` = 0 WHERE `CrimePID` = '%d'", PlayerInfo[playa][pID]);
  204. mysql_pquery(sqlGameConnection, query);
  205. }
  206. else
  207. {
  208. SendClientMessage(playerid, COLOR_GREY, "That player is currently not wanted.");
  209. SAPDClearing[playerid] = 0;
  210. TogglePlayerControllable(playerid, true);
  211. return 0;
  212. }
  213. }
  214. }
  215. else
  216. {
  217. SendClientMessage(playerid, COLOR_GREY, "Invalid ID.");
  218. SAPDClearing[playerid] = 0;
  219. TogglePlayerControllable(playerid, true);
  220. return 0;
  221. }
  222. return 0;
  223. }
  224. if(SAPDClearing[playerid] == 2)
  225. {
  226. new idx;
  227. tmp = strtok(text, idx);
  228. new playa;
  229. playa = ReturnUser(tmp);
  230. if(IsPlayerConnected(playa))
  231. {
  232. if(playa != INVALID_PLAYER_ID)
  233. {
  234. if(PlayerInfo[playa][pJailed] > 0)
  235. {
  236. strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
  237. strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME);
  238. PlayerInfo[playa][pWantedLevel] = 0;
  239. SetPlayerToTeamColor(playa);
  240. SAPDClearing[playerid] = 0;
  241. isBOLO[playa] = 0;
  242. new query[128];
  243. mysql_format(sqlGameConnection, query, sizeof(query), "UPDATE `newcrimes` SET `CrimeEnabled` = 0 WHERE `CrimePID` = '%d'", PlayerInfo[playa][pID]);
  244. mysql_pquery(sqlGameConnection, query);
  245. if(PlayerInfo[playa][pAdminJailed] == 1)
  246. {
  247. if(PlayerInfo[playa][pJailed] >= 1)
  248. {
  249. format(str, sizeof(str), "This player was jailed by an admin, you may not release them.");
  250. SendClientMessage(playerid, COLOR_GREY, str);
  251. format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has attempted to release %s from admin jail/prison.", sendername, giveplayer);
  252. ABroadCast(COLOR_WHITE, str, 1);
  253. SAPDClearing[playerid] = 0;
  254. TogglePlayerControllable(playerid, true);
  255. return 0;
  256. }
  257. }
  258. else if(PlayerInfo[playa][pJailed] == 1)
  259. {
  260. SetPlayerPos(playa, -2204.19, 842.05, 9999.26);
  261. SetPlayerInterior(playa, 0);
  262. SetPlayerVirtualWorld(playa, 0);
  263. format(str, sizeof(str), "* You have cleared %s's Wanted Points and released them from Jail.", giveplayer);
  264. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  265. format(str, sizeof(str), "* %s %s has cleared your Wanted Points and released you from Jail.", GetPlayerRank(playerid), sendername);
  266. SendClientMessage(playa, COLOR_LIGHTBLUE, str);
  267. format(str, sizeof(str), "HQ: %s %s has cleared %s's Wanted Points and released them from Jail.", GetPlayerRank(playerid), sendername, giveplayer);
  268. SendDepartmentMessage(TEAM_BLUE_COLOR, str);
  269. displayCenterHUDInfo(playa, "~g~Released~n~~w~Try to be a better citizen.", 8); //display for 8 seconds
  270. }
  271. else if(PlayerInfo[playa][pJailed] == 2) //Adjusted - prison system
  272. {
  273. SetPlayerPos(playa, 202.2571, 1865.2544, 13.1406);
  274. SetPlayerFacingAngle(playa, 265.4817);
  275. Timer_FreezePlayer(playa, FREEZE, ENTER_FREEZE);
  276. SetPlayerSkin(playa, PlayerInfo[playa][pModel]);
  277. PlayerInfo[playa][pJailnumber] = 0;
  278. UpdateDynamic3DTextLabelText(PNumber3D[playa], COLOR_WHITE, "");
  279. DestroyDynamic3DTextLabel(PNumber3D[playa]);
  280. format(str, sizeof(str), "* You have cleared %s's Wanted Points and released them from Prison.", giveplayer);
  281. SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  282. format(str, sizeof(str), "* %s %s has cleared your Wanted Points and released you from Prison.", GetPlayerRank(playerid), sendername);
  283. SendClientMessage(playa, COLOR_LIGHTBLUE, str);
  284. format(str, sizeof(str), "HQ: %s %s has cleared %s's Wanted Points and released them from Prison.", GetPlayerRank(playerid), sendername, giveplayer);
  285. SendDepartmentMessage(TEAM_BLUE_COLOR, str);
  286. displayCenterHUDInfo(playa, "~g~Released~n~~w~Try to be a better citizen.", 8); //display for 8 seconds
  287. SetPlayerPos(playa, -2204.19, 842.05, 9999.26);
  288. SetPlayerInterior(playa, 0);
  289. SetPlayerVirtualWorld(playa, 0);
  290. }
  291. PlayerInfo[playa][pJailed] = 0;
  292. PlayerInfo[playa][pJailTime] = 0;
  293. TogglePlayerControllable(playerid, true);
  294. SetPlayerToTeamColor(playa);
  295. SetCameraBehindPlayer(playerid);
  296. }
  297. else
  298. {
  299. SendClientMessage(playerid, COLOR_GREY, "That player is currently not in jail.");
  300. SAPDClearing[playerid] = 0;
  301. TogglePlayerControllable(playerid, true);
  302. return 0;
  303. }
  304. }
  305. }
  306. else
  307. {
  308. SendClientMessage(playerid, COLOR_GREY, "Invalid ID.");
  309. SAPDClearing[playerid] = 0;
  310. TogglePlayerControllable(playerid, true);
  311. return 0;
  312. }
  313. return 0;
  314. }
  315. }
  316. if(CallLawyer[playerid] == 111)
  317. {
  318. new idx;
  319. tmp = strtok(text, idx);
  320. if((strcmp("yes", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("yes")))
  321. {
  322. strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
  323. format(str, sizeof(str), "** %s is in Jail, and needs a Lawyer. Go to the Police Station.", sendername);
  324. SendJobMessage(2, TEAM_AZTECAS_COLOR, str);
  325. SendClientMessage(playerid, COLOR_LIGHTRED, "A message has been sent to all available Lawyers, please wait.");
  326. WantLawyer[playerid] = 0;
  327. CallLawyer[playerid] = 0;
  328. return 0;
  329. }
  330. else
  331. {
  332. SendClientMessage(playerid, COLOR_LIGHTRED, "There is no Lawyer available to you anymore, Jail Time started.");
  333. WantLawyer[playerid] = 0;
  334. CallLawyer[playerid] = 0;
  335. return 0;
  336. }
  337. }
  338. if(TalkingLive[playerid] != 255)
  339. {
  340. strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
  341. foreach( new i: Player )
  342. {
  343. if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i))
  344. {
  345. new Float: x[3];
  346. GetPlayerPos(playerid, x[0], x[1], x[2]);
  347. if(IsPlayerInRangeOfPoint(i, 20.0, x[0], x[1], x[2]))
  348. {
  349. if(i == playerid)
  350. {
  351. format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s: %s", PlayerOOCName(i), text);
  352. }
  353. else
  354. {
  355. format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings: %s", PlayerOOCName(i), text);
  356. }
  357. if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
  358. {
  359. SendBuggedMessage(COLOR_ORANGE, str);
  360. SendS9BuggedMessage(COLOR_ORANGE, str);
  361. }
  362. else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
  363. // that s9 bugged them
  364. }
  365. }
  366. }
  367. if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9)
  368. {
  369. format(str, sizeof(str), "Reporter %s: %s", sendername, text);
  370. OOCNews(COLOR_LIGHTGREEN, str);
  371. }
  372. else
  373. {
  374. format(str, sizeof(str), "%s: %s", LiveName[playerid], text);
  375. OOCNews(COLOR_LIGHTGREEN, str);
  376. }
  377. return 0;
  378. }
  379. if(Mobile[playerid] != 999)
  380. {
  381. new idx;
  382. tmp = strtok(text, idx);
  383. foreach( new i: Player )
  384. {
  385. if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i))
  386. {
  387. new Float: x[3];
  388. GetPlayerPos(playerid, x[0], x[1], x[2]);
  389. if(IsPlayerInRangeOfPoint(i, 20.0, x[0], x[1], x[2]))
  390. {
  391. if(i == playerid)
  392. {
  393. if(strcmp(Accent[i], "none", true, 3)) format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s (cellphone): [%s Accent] %s", PlayerOOCName(i), Accent[i], text);
  394. else format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s (cellphone): %s", PlayerOOCName(i), text);
  395. }
  396. else
  397. {
  398. if(strcmp(Accent[playerid], "none", true, 3)) format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings: [%s Accent] %s", PlayerOOCName(i), Accent[playerid], text);
  399. else format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings: %s", PlayerOOCName(i), text);
  400. }
  401. if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
  402. {
  403. SendBuggedMessage(COLOR_ORANGE, str);
  404. SendS9BuggedMessage(COLOR_ORANGE, str);
  405. }
  406. else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
  407. // that s9 bugged them
  408. }
  409. }
  410. }
  411. format(str, sizeof(str), "%s says (cellphone): ", PlayerICName(playerid));
  412. if(!IsPlayerInAnyVehicle(playerid))
  413. {
  414. NewProxDetector(playerid, 15.0, str, text, COLOR_FADE1);
  415. }
  416. else
  417. {
  418. if(VehicleHasWindows(GetPlayerVehicleID(playerid)))
  419. {
  420. if(windowsDown[GetPlayerVehicleID(playerid)] == false)
  421. {
  422. if(strcmp(Accent[playerid], "none", true, 3))format(str, sizeof(str), "(vehicle) %s says (cellphone): [%s Accent] %s", PlayerICName(playerid), Accent[playerid], text);
  423. else format(str, sizeof(str), "(vehicle) %s says (cellphone): %s", PlayerICName(playerid), text);
  424. CarMessage(playerid, COLOR_GREY, str);
  425. }
  426. else
  427. {
  428. NewProxDetector(playerid, 15.0, str, text, COLOR_FADE1);
  429. }
  430. }
  431. else
  432. {
  433. NewProxDetector(playerid, 15.0, str, text, COLOR_FADE1);
  434. }
  435. }
  436. if(Mobile[playerid] == 914)
  437. {
  438. if(!strlen(tmp))
  439. {
  440. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Paramedic Dispatch: Sorry I don't understand.");
  441. return 0;
  442. }
  443. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Paramedic Dispatch: We have alerted all units in the area.");
  444. if(callerID[playerid] == false)format(str, sizeof(str), "911 Call; Paramedic - Caller: %s", PlayerICName(playerid));
  445. else format(str, sizeof(str), "911 Call; Paramedic - Caller: Unknown (Blocked Caller ID)");
  446. SendParaMessage(COLOR_DOCTOR, str);
  447. format(str, sizeof(str), "Situation: %s", text);
  448. SendParaMessage(COLOR_DOCTOR, str);
  449. SendClientMessage(playerid, COLOR_GRAD2, "They hung up...");
  450. Mobile[playerid] = 999;
  451. SetAllFiremanCheckpoint(playerid);
  452. detachPhoneFromPlayer(playerid);
  453. return 0;
  454. }
  455. if(Mobile[playerid] == 916)
  456. {
  457. if(!strlen(tmp))
  458. {
  459. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Firemen: Hello? Are you there? I couldn't catch that, could you repeat?");
  460. return 0;
  461. }
  462. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Firemen: We'll send someone out immediately.");
  463. if(callerID[playerid] == false)format(str, sizeof(str), "911 Call; Fire - Caller: %s", PlayerICName(playerid));
  464. else format(str, sizeof(str), "911 Call; Fire - Caller: Unknown (Blocked Caller ID)");
  465. SendParaMessage(COLOR_DOCTOR, str);
  466. format(str, sizeof(str), "Situation: %s", text);
  467. SendParaMessage(COLOR_DOCTOR, str);
  468. SendClientMessage(playerid, COLOR_GRAD2, "They hung up...");
  469. Mobile[playerid] = 999;
  470. SetAllFiremanCheckpoint(playerid);
  471. detachPhoneFromPlayer(playerid);
  472. return 0;
  473. }
  474. if(Mobile[playerid] == 913)
  475. {
  476. new zone[MAX_ZONE_NAME];
  477. GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
  478. if(!strlen(tmp))
  479. {
  480. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Police Dispatch: Sorry I don't understand.");
  481. return 0;
  482. }
  483. if((strcmp("no", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("no")))
  484. {
  485. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Police Dispatch: We have alerted all units in the area, a police officer should be with you shortly.");
  486. format(str, sizeof(str), "|____________Emergency call____________|");
  487. SendCopMessage(TCOLOR_NAVYBLUE, str);
  488. if(callerID[playerid] == true)format(str, sizeof(str), "Caller: Unknown, Phone: Unknown, Trace: %s", zone);
  489. else format(str, sizeof(str), "Caller: %s, Phone: %d, Trace: %s", PlayerICName(playerid), PlayerInfo[playerid][pPnumber], zone);
  490. SendCopMessage(TCOLOR_NAVYBLUE, str);
  491. format(str, sizeof(str), "Services Required: Police");
  492. SendCopMessage(TCOLOR_NAVYBLUE, str);
  493. format(str, sizeof(str), "Location: %s", text);
  494. SendCopMessage(TCOLOR_NAVYBLUE, str);
  495. format(str, sizeof(str), "Situation: %s", CallDescription[playerid]);
  496. SendCopMessage(TCOLOR_NAVYBLUE, str);
  497. SendClientMessage(playerid, COLOR_GRAD2, "They hung up...");
  498. Mobile[playerid] = 999;
  499. if(PlayerInfo[playerid][pWantedLevel] < 6)
  500. {
  501. Called911[playerid] = 1;
  502. SetAllCopCheckpoint(playerid);
  503. }
  504. detachPhoneFromPlayer(playerid);
  505. return 0;
  506. }
  507. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Police Dispatch: We have alerted all units in the area, a police officer should be with you shortly.");
  508. format(str, sizeof(str), "|____________Emergency call____________|");
  509. SendCopMessage(TCOLOR_NAVYBLUE, str);
  510. if(callerID[playerid] == true) format(str, sizeof(str), "Caller: Unknown, Phone: Unknown, Trace: %s", zone);
  511. else format(str, sizeof(str), "Caller: %s, Phone: %d, Trace: %s", PlayerICName(playerid), PlayerInfo[playerid][pPnumber], zone);
  512. SendCopMessage(TCOLOR_NAVYBLUE, str);
  513. format(str, sizeof(str), "Services Required: Police");
  514. SendCopMessage(TCOLOR_NAVYBLUE, str);
  515. format(str, sizeof(str), "Location: %s", text);
  516. SendCopMessage(TCOLOR_NAVYBLUE, str);
  517. format(str, sizeof(str), "Situation: %s", CallDescription[playerid]);
  518. SendCopMessage(TCOLOR_NAVYBLUE, str);
  519. SendClientMessage(playerid, COLOR_GRAD2, "They hung up...");
  520. Mobile[playerid] = 999;
  521. PlayerCalledPD[playerid] = 1;
  522. if(PlayerInfo[playerid][pWantedLevel] != 6)
  523. {
  524. Called911[playerid] = 1;
  525. SetAllCopCheckpoint(playerid);
  526. }
  527. detachPhoneFromPlayer(playerid);
  528. return 0;
  529. }
  530. if(Mobile[playerid] == 912)
  531. {
  532. if(!strlen(tmp))
  533. {
  534. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Police Dispatch: Sorry I don't understand.");
  535. return 0;
  536. }
  537. strmid(CallDescription[playerid], text, 0, strlen(text), 255);
  538. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Police Dispatch: What's your location?");
  539. Mobile[playerid] = 913;
  540. return 0;
  541. }
  542. if(Mobile[playerid] == 63971)
  543. {
  544. if(!strlen(tmp))
  545. {
  546. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Operator: Sorry, I didn't quite understand that. Please state your query.");
  547. return 0;
  548. }
  549. else
  550. {
  551. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Operator: Thank you, we'll be in contact as soon as possible!");
  552. format(str, sizeof(str), "[SAN Hotline - Ph: %d (( %s ))] %s", PlayerInfo[playerid][pPnumber], PlayerICName(playerid), text);
  553. SendHotlineMessage(COLOR_YELLOW, str);
  554. SendClientMessage(playerid, COLOR_GRAD2, "They hung up...");
  555. Mobile[playerid] = 999;
  556. detachPhoneFromPlayer(playerid);
  557. }
  558. }
  559. if(Mobile[playerid] == 911)
  560. {
  561. if(!strlen(tmp))
  562. {
  563. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) 911 Operator: Sorry I don't understand, police, paramedic or fire?");
  564. return 0;
  565. }
  566. else if(strfind(tmp, "police", true, 0) != -1)
  567. {
  568. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) 911 Operator: I am patching you to Police HQ, please hold.");
  569. Mobile[playerid] = 912;
  570. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Police Dispatch: Please give me a short description of the crime.");
  571. return 0;
  572. }
  573. else if(strfind(tmp, "paramedic", true, 0) != -1)
  574. {
  575. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) 911 Operator: I am patching you to Paramedic HQ, please hold.");
  576. Mobile[playerid] = 914;
  577. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Paramedic Dispatch: Please give me a short description of the Incident.");
  578. return 0;
  579. }
  580. else if(strfind(tmp, "fire", true, 0) != -1)
  581. {
  582. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) 911 Operator: I am patching you to the Fire Department, please hold.");
  583. Mobile[playerid] = 916;
  584. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) Firemen: Please provide a short description of the incident, is there a fire? Where is it?");
  585. return 0;
  586. }
  587. else
  588. {
  589. SendClientMessage(playerid, COLOR_YELLOW, "(cellphone) 911 Operator: Sorry I don't understand, police, paramedic or fire?");
  590. return 0;
  591. }
  592. }
  593. if(IsPlayerConnected(Mobile[playerid]))
  594. {
  595. if(Mobile[Mobile[playerid]] == playerid)
  596. {
  597. if(!strmatch(Accent[playerid], "none"))
  598. {
  599. if(usePayphone[playerid] == -1)format(str, sizeof(str), "(cellphone) %s says: [%s Accent] %s", CallerIDName(playerid, callerID[playerid]), Accent[playerid], text);
  600. else format(str, sizeof(str), "Stranger says (cellphone): [%s Accent] %s", Accent[playerid], text);
  601. }
  602. else
  603. {
  604. if(usePayphone[playerid] == -1)format(str, sizeof(str), "(cellphone) %s says: %s", CallerIDName(playerid, callerID[playerid]), text);
  605. else format(str, sizeof(str), "Stranger says (cellphone): %s", text);
  606. }
  607. if(PlayerInfo[Mobile[playerid]][pSpeakPhone] == 1)
  608. {
  609. if(windowsDown[GetPlayerVehicleID(playerid)] == false)
  610. {
  611. ProxDetector(20.0, Mobile[playerid], str, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
  612. }
  613. else
  614. {
  615. CarMessage(playerid, COLOR_GREY, str);
  616. }
  617. }
  618. else
  619. {
  620. SendClientMessage(Mobile[playerid], COLOR_YELLOW, str);
  621. }
  622. }
  623. }
  624. else
  625. {
  626. if(Mobile[playerid] != 999)
  627. {
  628. SendClientMessage(playerid, COLOR_GREY, "There's nobody there...");
  629. }
  630. }
  631. return 0;
  632. }
  633. if(pDeathState[playerid] == PLAYER_STATE_REVIVE) //injured players cannot speak
  634. {
  635. SendClientMessage(playerid, -1, "You're too tired to say anything.");
  636. format(str, sizeof(str), "* %s tries to mumble something", PlayerICName(playerid));
  637. SetPlayerChatBubble(playerid, str, COLOR_PURPLE, 20.0, 15000);
  638. return 0;
  639. }
  640. else
  641. {
  642. foreach( new i: Player )
  643. {
  644. if(PlayerInfo[i][pWire] == 1 && !CheckForJammer(playerid) && !CheckForJammer(i))
  645. {
  646. new Float: x[3];
  647. GetPlayerPos(playerid, x[0], x[1], x[2]);
  648. if(IsPlayerInRangeOfPoint(i, 20.0, x[0], x[1], x[2]))
  649. {
  650. if(i == playerid)
  651. {
  652. if(strcmp(Accent[i], "none", true, 3)) format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s: [%s Accent] %s", PlayerOOCName(i), Accent[i], text);
  653. else format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s: %s", PlayerOOCName(i), text);
  654. }
  655. else
  656. {
  657. if(strcmp(Accent[playerid], "none", true, 3)) format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings: [%s Accent] %s", PlayerOOCName(i), Accent[playerid], text);
  658. else format(str, sizeof(str), "{8D8DFF}(BUGGED){AFAFAF} %s's surroundings: %s", PlayerOOCName(i), text);
  659. }
  660. if(PlayerInfo[i][pMember] != 2) // if player isn't FBI, send to both FBI and S9
  661. {
  662. SendBuggedMessage(COLOR_ORANGE, str);
  663. SendS9BuggedMessage(COLOR_ORANGE, str);
  664. }
  665. else SendS9BuggedMessage(COLOR_ORANGE, str); // if player is FBI, send to S9 only, this is to avoid FBI figuring out
  666. // that s9 bugged them
  667. }
  668. }
  669. }
  670. if(!IsPlayerInAnyVehicle(playerid))
  671. {
  672. if(strcmp(Accent[playerid], "none", true, 3)) format(str, sizeof(str), "%s says: [%s Accent] ", PlayerICName(playerid), Accent[playerid]);
  673. else format(str, sizeof(str), "%s says: ", PlayerICName(playerid));
  674. }
  675. else
  676. {
  677. if(VehicleHasWindows(GetPlayerVehicleID(playerid)))
  678. {
  679. if(windowsDown[GetPlayerVehicleID(playerid)] == false)
  680. {
  681. if(strcmp(Accent[playerid], "none", true, 3))format(str, sizeof(str), "{FFFF66}(vehicle) %s says: [%s Accent] %s", PlayerICName(playerid), Accent[playerid], text);
  682. else format(str, sizeof(str), "{FFFF66}(vehicle) %s says: %s", PlayerICName(playerid), text);
  683. }
  684. else
  685. {
  686. if(strcmp(Accent[playerid], "none", true, 3))format(str, sizeof(str), "%s says: [%s Accent] ", PlayerICName(playerid), Accent[playerid]);
  687. else format(str, sizeof(str), "%s says: ", PlayerICName(playerid));
  688. }
  689. }
  690. else
  691. {
  692. if(strcmp(Accent[playerid], "none", true, 3))format(str, sizeof(str), "%s says: [%s Accent] ", PlayerICName(playerid), Accent[playerid]);
  693. else format(str, sizeof(str), "%s says: ", PlayerICName(playerid));
  694. }
  695. }
  696. }
  697. if(!IsPlayerInAnyVehicle(playerid))
  698. {
  699. NewProxDetector(playerid, 15.0, str, text, COLOR_FADE1);
  700. }
  701. else
  702. {
  703. if(windowsDown[GetPlayerVehicleID(playerid)] == false)
  704. {
  705. if(!VehicleHasWindows(GetPlayerVehicleID(playerid)))
  706. {
  707. NewProxDetector(playerid, 15.0, str, text, COLOR_FADE1);
  708. }
  709. else
  710. {
  711. CarMessage(playerid, COLOR_GREY, str);
  712. }
  713. }
  714. else
  715. {
  716. NewProxDetector(playerid, 15.0, str, text, COLOR_FADE1);
  717. }
  718. }
  719. //random animation
  720. if(autoChat[playerid] > 0)
  721. {
  722. //printf("anim is %d", GetPlayerAnimationIndex(playerid));
  723. if(GetPlayerAnimationIndex(playerid) == 1189 || GetPlayerAnimationIndex(playerid) == 1186 || GetPlayerAnimationIndex(playerid) == 1275) //idle animation
  724. {
  725. new strlength = strlen(text);
  726. new animLength = strlength; //calculate time based on str input length
  727. if(animLength < 5) //short word
  728. {
  729. autoChatTime[playerid] = 2;
  730. }
  731. else if(animLength > 10 && animLength < 15) //medium word
  732. {
  733. autoChatTime[playerid] = 4;
  734. }
  735. else //long words
  736. {
  737. autoChatTime[playerid] = 5;
  738. }
  739. new rand = random(6);
  740. switch(rand)
  741. {
  742. case 0:
  743. {
  744. ApplyAnimationEx(playerid, "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 1, 1, 0);
  745. }
  746. case 1:
  747. {
  748. ApplyAnimationEx(playerid, "GANGS", "prtial_gngtlkB", 4.1, 1, 0, 0, 1, 1, 0);
  749. }
  750. case 2:
  751. {
  752. ApplyAnimationEx(playerid, "GANGS", "prtial_gngtlkE", 4.1, 1, 0, 0, 1, 1, 0);
  753. }
  754. case 3:
  755. {
  756. ApplyAnimationEx(playerid, "GANGS", "prtial_gngtlkF", 4.1, 1, 0, 0, 1, 1, 0);
  757. }
  758. case 4:
  759. {
  760. ApplyAnimationEx(playerid, "GANGS", "prtial_gngtlkG", 4.1, 1, 0, 0, 1, 1, 0);
  761. }
  762. case 5:
  763. {
  764. ApplyAnimationEx(playerid, "GANGS", "prtial_gngtlkH", 4.1, 1, 0, 0, 1, 1, 0);
  765. }
  766. }
  767. }
  768. }
  769. if(pCommandUsed[playerid] == false)
  770. {
  771. KillTimer(AFK_Timer[playerid]);
  772. pCommandUsed[playerid] = true;
  773. AFK_Timer[playerid] = SetTimerEx("Timer_stopCMD", 600000, false, "i", playerid); // 10 minutes
  774. }
  775. if(checkingBackground[playerid] == 1) {
  776. if(!IsPlayerInRangeOfPoint(playerid, 5.0, -2206.77, 835.14, 9999.28)) {
  777. checkingBackground[playerid] = 0;
  778. return 0;
  779. }
  780. // Cancel the background check
  781. if(!strcmp(text, "no", true) || !strcmp(text, "no.", true)) {
  782. SendClientMessage(playerid, -1, "Receptionist says: Have a nice day.");
  783. checkingBackground[playerid] = 0;
  784. return 0;
  785. }
  786. // Start background check (text = name)
  787. else {
  788. // Format name
  789. new checkName[MAX_PLAYER_NAME + 1];
  790. format(checkName, sizeof(checkName), "%s", text);
  791. if(strfind(checkName, " ", true) != -1) {
  792. strmid(checkName, str_replace(' ', '_', checkName), 0, MAX_PLAYER_NAME);
  793. }
  794. // Do query for SQL ID
  795. new query[128], rows, fields, Cache:result;
  796. mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `players` WHERE name = '%e' LIMIT 1", checkName);
  797. result = mysql_query(sqlGameConnection, query);
  798. cache_get_data(rows, fields, sqlGameConnection);
  799. if(!rows) {
  800. SendClientMessage(playerid, -1, "Receptionist says: Sorry, I have no criminal records of this person.");
  801. checkingBackground[playerid] = 0;
  802. cache_delete(Cache:result, sqlGameConnection);
  803. return 0;
  804. }
  805. else
  806. {
  807. if(GetMoney(playerid) < 100000) {
  808. SendClientMessage(playerid, COLOR_GREY, "You cannot afford to pay for the public background check.");
  809. cache_delete(Cache:result, sqlGameConnection);
  810. return 0;
  811. }
  812. cache_get_field_content(0, "Name", checkingName[playerid]);
  813. checkingID[playerid] = cache_get_field_content_int(0, "ID");
  814. checkingBackground[playerid] = 0;
  815. GiveMoney(playerid, -100000);
  816. new bgStr[128];
  817. format(bgStr, sizeof(bgStr), "* The receptionist hands you a copy of %s's criminal record. (/checkrecord)", checkingName[playerid]);
  818. SendClientMessage(playerid, COLOR_LIGHTBLUE, bgStr);
  819. cache_delete(Cache:result, sqlGameConnection);
  820. return 0;
  821. }
  822. }
  823. }
  824. return 0;
  825. }