Guest User

Untitled

a guest
Jul 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.11 KB | None | 0 0
  1. dcmd_chiama(playerid, params[])
  2. {
  3. new number, s[128], calledid=-1;
  4. if (sscanf(params, "u", number)) SendClientMessage(playerid, COLOR_ALERT, "{33CCFF}[INFO:]{FFFFFF} /chiama [numero]");
  5. else if (PlayerInfo[playerid][pphonenumber]==0) SendClientMessage(playerid, COLOR_NO, "Non hai un Cellulare");
  6. else if(PlayerInfo[playerid][pphonecallstatus]) SendClientMessage(playerid, COLOR_ALERT, "Sei già in chiamata, devi prima riagganciare");
  7. else
  8. {
  9. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
  10. PlayerInfo[playerid][pphoneservice]=0;
  11. switch (number)
  12. {
  13. case 100://lista servizi
  14. {
  15. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 112 - Polizia");
  16. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 118 - Ospedale");
  17. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 404 - Traffico residuo");
  18. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 555 - Taxy");
  19. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 222 - PizzaBoy");
  20. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 444 - Meccanico");
  21. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  22. return 1;
  23. }
  24. case 112://puli
  25. {
  26. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo agente disponibile");
  27. PlayerInfo[playerid][pphoneservice]=112;
  28. for(new x=0;x<MAX_PLAYERS;x++)
  29. {
  30. if(IsPlayerConnected(x) && PlayerInfo[x][pfaction]==FACTION_POLICE && PlayerInfo[x][ponfactionduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  31. {
  32. calledid=x;
  33. break;
  34. }
  35. }
  36. if(calledid==-1)
  37. {
  38. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono agenti disponibili");
  39. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  40. return 1;
  41. }
  42. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di emergenza in arrivo");
  43. }
  44. case 118://medici
  45. {
  46. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo medico disponibile");
  47. PlayerInfo[playerid][pphoneservice]=118;
  48. for(new x=0;x<MAX_PLAYERS;x++)
  49. {
  50. if(IsPlayerConnected(x) && PlayerInfo[x][pfaction]==FACTION_MEDICS && PlayerInfo[x][ponfactionduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  51. {
  52. calledid=x;
  53. break;
  54. }
  55. }
  56. if(calledid==-1)
  57. {
  58. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono medici disponibili");
  59. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  60. return 1;
  61. }
  62. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di emergenza in arrivo");
  63. }
  64. case 555://taxy
  65. {
  66. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo tassista disponibile");
  67. for(new x=0;x<MAX_PLAYERS;x++)
  68. {
  69. if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_TAXY && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  70. {
  71. calledid=x;
  72. break;
  73. }
  74. }
  75. if(calledid==-1)
  76. {
  77. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono tassisti disponibili");
  78. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  79. return 1;
  80. }
  81. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
  82. }
  83. case 222://pizzaboy
  84. {
  85. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo pizzaboy disponibile");
  86. for(new x=0;x<MAX_PLAYERS;x++)
  87. {
  88. if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_PIZZABOY && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  89. {
  90. calledid=x;
  91. break;
  92. }
  93. }
  94. if(calledid==-1)
  95. {
  96. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono pizzaboy disponibili");
  97. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  98. return 1;
  99. }
  100. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
  101. }
  102. case 444://meccanico
  103. {
  104. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo meccanico disponibile");
  105. for(new x=0;x<MAX_PLAYERS;x++)
  106. {
  107. if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_MECHANICIAN && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  108. {
  109. calledid=x;
  110. break;
  111. }
  112. }
  113. if(calledid==-1)
  114. {
  115. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono meccanici disponibili");
  116. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  117. return 1;
  118. }
  119. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
  120. }
  121. case 404://traffico residuo
  122. {
  123. format(s,sizeof(s),"[SMS] 404: Traffico residuo %d$",PlayerInfo[playerid][pphonemoney]);
  124. SendClientMessage(playerid,COLOR_PHONESMS,s);
  125. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  126. return 1;
  127. }
  128. }
  129. if (PlayerInfo[playerid][pphonemoney]<PHONE_TALK_PRICE*2 && PlayerInfo[playerid][pphoneservice]==0)
  130. {
  131. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
  132. SendClientMessage(playerid, COLOR_NO, "Non hai abbastanza soldi nel cellulare");
  133. return 1;
  134. }
  135. new actiontext[MAX_CHATBUBBLE_LENGTH+1];
  136. format(s,sizeof(s),"* %s prende il cellulare, digita il numero e lo mette all'orecchio *",PlayerInfo[playerid][pname]);
  137. SendRangedMessage(playerid,COLOR_ME,s);
  138. format(actiontext,MAX_CHATBUBBLE_LENGTH,"* prende il suo cellulare e lo mette all'orecchio *");
  139. SetPlayerChatBubble(playerid,actiontext,COLOR_BUBBLE,30.0,10000);
  140. if(calledid==-1)
  141. {
  142. for(new x=0;x<MAX_PLAYERS;x++)
  143. {
  144. if(IsPlayerConnected(x) && PlayerInfo[x][pphonenumber]==number)
  145. {
  146. calledid=x;
  147. break;
  148. }
  149. }
  150. }
  151. if(calledid==-1)
  152. {
  153. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Il numero da lei chiamato e' inesistente");
  154. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  155. return 1;
  156. }
  157. else if(calledid==playerid) return SendClientMessage(playerid, COLOR_NO, "Non puoi chiamare te stesso");
  158. else if(PlayerInfo[calledid][pphonecallstatus]) return SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Numero occupato");
  159. SendClientMessage(playerid, COLOR_INFO, "Premi il tasto destro del mouse per riagganciare");
  160. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] -- Attendere --");
  161. PlayerInfo[playerid][pphonecallstatus]=1;
  162. PlayerInfo[playerid][pphonecallwith]=calledid;
  163. PlayerInfo[calledid][pphonecallstatus]=2;
  164. PlayerInfo[calledid][pphonecallwith]=playerid;
  165. PlayerInfo[playerid][pphonecalltry]=0;
  166. SetTimerEx("PlayerPhoneTo",4000,false,"dd",playerid,calledid);
  167. }
  168. return 1;
  169. }dcmd_chiama(playerid, params[])
  170. {
  171. new number, s[128], calledid=-1;
  172. if (sscanf(params, "u", number)) SendClientMessage(playerid, COLOR_ALERT, "{33CCFF}[INFO:]{FFFFFF} /chiama [numero]");
  173. else if (PlayerInfo[playerid][pphonenumber]==0) SendClientMessage(playerid, COLOR_NO, "Non hai un Cellulare");
  174. else if(PlayerInfo[playerid][pphonecallstatus]) SendClientMessage(playerid, COLOR_ALERT, "Sei già in chiamata, devi prima riagganciare");
  175. else
  176. {
  177. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
  178. PlayerInfo[playerid][pphoneservice]=0;
  179. switch (number)
  180. {
  181. case 100://lista servizi
  182. {
  183. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 112 - Polizia");
  184. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 118 - Ospedale");
  185. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 404 - Traffico residuo");
  186. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 555 - Taxy");
  187. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 222 - PizzaBoy");
  188. SendClientMessage(playerid,COLOR_PHONE,"[Cellulare] 100: 444 - Meccanico");
  189. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  190. return 1;
  191. }
  192. case 112://puli
  193. {
  194. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo agente disponibile");
  195. PlayerInfo[playerid][pphoneservice]=112;
  196. for(new x=0;x<MAX_PLAYERS;x++)
  197. {
  198. if(IsPlayerConnected(x) && PlayerInfo[x][pfaction]==FACTION_POLICE && PlayerInfo[x][ponfactionduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  199. {
  200. calledid=x;
  201. break;
  202. }
  203. }
  204. if(calledid==-1)
  205. {
  206. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono agenti disponibili");
  207. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  208. return 1;
  209. }
  210. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di emergenza in arrivo");
  211. }
  212. case 118://medici
  213. {
  214. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo medico disponibile");
  215. PlayerInfo[playerid][pphoneservice]=118;
  216. for(new x=0;x<MAX_PLAYERS;x++)
  217. {
  218. if(IsPlayerConnected(x) && PlayerInfo[x][pfaction]==FACTION_MEDICS && PlayerInfo[x][ponfactionduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  219. {
  220. calledid=x;
  221. break;
  222. }
  223. }
  224. if(calledid==-1)
  225. {
  226. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono medici disponibili");
  227. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  228. return 1;
  229. }
  230. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di emergenza in arrivo");
  231. }
  232. case 555://taxy
  233. {
  234. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo tassista disponibile");
  235. for(new x=0;x<MAX_PLAYERS;x++)
  236. {
  237. if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_TAXY && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  238. {
  239. calledid=x;
  240. break;
  241. }
  242. }
  243. if(calledid==-1)
  244. {
  245. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono tassisti disponibili");
  246. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  247. return 1;
  248. }
  249. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
  250. }
  251. case 222://pizzaboy
  252. {
  253. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo pizzaboy disponibile");
  254. for(new x=0;x<MAX_PLAYERS;x++)
  255. {
  256. if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_PIZZABOY && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  257. {
  258. calledid=x;
  259. break;
  260. }
  261. }
  262. if(calledid==-1)
  263. {
  264. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono pizzaboy disponibili");
  265. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  266. return 1;
  267. }
  268. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
  269. }
  270. case 444://meccanico
  271. {
  272. SendClientMessage(playerid,COLOR_PHONE,"[Centralino] Verrai messo in contatto con il primo meccanico disponibile");
  273. for(new x=0;x<MAX_PLAYERS;x++)
  274. {
  275. if(IsPlayerConnected(x) && PlayerInfo[x][pjob]==JOB_MECHANICIAN && PlayerInfo[x][ponjobduty] && PlayerInfo[x][pphonecallstatus]==0 && PlayerInfo[x][pphonenumber]!=0)
  276. {
  277. calledid=x;
  278. break;
  279. }
  280. }
  281. if(calledid==-1)
  282. {
  283. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Non ci sono meccanici disponibili");
  284. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  285. return 1;
  286. }
  287. SendClientMessage(calledid, COLOR_PHONE, "-Attenzione- Chiamata di lavoro in arrivo");
  288. }
  289. case 404://traffico residuo
  290. {
  291. format(s,sizeof(s),"[SMS] 404: Traffico residuo %d$",PlayerInfo[playerid][pphonemoney]);
  292. SendClientMessage(playerid,COLOR_PHONESMS,s);
  293. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  294. return 1;
  295. }
  296. }
  297. if (PlayerInfo[playerid][pphonemoney]<PHONE_TALK_PRICE*2 && PlayerInfo[playerid][pphoneservice]==0)
  298. {
  299. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
  300. SendClientMessage(playerid, COLOR_NO, "Non hai abbastanza soldi nel cellulare");
  301. return 1;
  302. }
  303. new actiontext[MAX_CHATBUBBLE_LENGTH+1];
  304. format(s,sizeof(s),"* %s prende il cellulare, digita il numero e lo mette all'orecchio *",PlayerInfo[playerid][pname]);
  305. SendRangedMessage(playerid,COLOR_ME,s);
  306. format(actiontext,MAX_CHATBUBBLE_LENGTH,"* prende il suo cellulare e lo mette all'orecchio *");
  307. SetPlayerChatBubble(playerid,actiontext,COLOR_BUBBLE,30.0,10000);
  308. if(calledid==-1)
  309. {
  310. for(new x=0;x<MAX_PLAYERS;x++)
  311. {
  312. if(IsPlayerConnected(x) && PlayerInfo[x][pphonenumber]==number)
  313. {
  314. calledid=x;
  315. break;
  316. }
  317. }
  318. }
  319. if(calledid==-1)
  320. {
  321. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Il numero da lei chiamato e' inesistente");
  322. SetTimerEx("SetPlayerSpecialActionStopCell",2000,false,"d",playerid);
  323. return 1;
  324. }
  325. else if(calledid==playerid) return SendClientMessage(playerid, COLOR_NO, "Non puoi chiamare te stesso");
  326. else if(PlayerInfo[calledid][pphonecallstatus]) return SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] Numero occupato");
  327. SendClientMessage(playerid, COLOR_INFO, "Premi il tasto destro del mouse per riagganciare");
  328. SendClientMessage(playerid, COLOR_PHONE, "[CENTRALINO] -- Attendere --");
  329. PlayerInfo[playerid][pphonecallstatus]=1;
  330. PlayerInfo[playerid][pphonecallwith]=calledid;
  331. PlayerInfo[calledid][pphonecallstatus]=2;
  332. PlayerInfo[calledid][pphonecallwith]=playerid;
  333. PlayerInfo[playerid][pphonecalltry]=0;
  334. SetTimerEx("PlayerPhoneTo",4000,false,"dd",playerid,calledid);
  335. }
  336. return 1;
  337. }
Add Comment
Please, Sign In to add comment