Advertisement
Guest User

MDC

a guest
Jan 23rd, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.39 KB | None | 0 0
  1. #define DIALOG_MDC 1000
  2. #define DIALOG_RICERCAPERSONA 1001
  3. #define DIALOG_RICERCAVEICOLO 1002
  4. #define DIALOG_FEDINE 1003
  5. #define DIALOG_INFOPERSONA 1004
  6. #define DIALOG_INFOVEICOLO 1005
  7. // Tazer
  8. new ptazer[MAX_PLAYERS];
  9. new pammo[MAX_PLAYERS];
  10. new pweap[MAX_PLAYERS];
  11.  
  12. OnPlayerConnect
  13. // Tazer
  14. ptazer[playerid] = 0;
  15. pammo[playerid] = 0;
  16. pweap[playerid] = 0;
  17.  
  18. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  19. {
  20. if (newkeys & KEY_FIRE) {
  21. if(ptazer[playerid] == 1) {
  22. ClearAnimations(playerid, 0);
  23. ApplyAnimation(playerid, "COLT45", "colt45_reload", 4.1, 0, 0, 0, 0, 1, 1);
  24. cmd_pta(playerid, "");
  25. }
  26. return 1;
  27. }
  28. return 1;
  29. }
  30.  
  31. OnDialogResponse
  32. // MDC
  33. if(dialogid == DIALOG_MDC)
  34. {
  35. if(!response) return 1;
  36. if(listitem == 0)
  37. {
  38. ShowPlayerDialog(playerid, DIALOG_RICERCAPERSONA, DIALOG_STYLE_INPUT, "|| Mobile Data Computer:", "Inserisci il nome di un player (anche offline!) per controllare le sue informazioni.\nNOTA: Le multe non vengono visualizzate qui.", "Cerca", "Indietro");
  39. }
  40. if(listitem == 1)
  41. {
  42. ShowPlayerDialog(playerid, DIALOG_RICERCAVEICOLO, DIALOG_STYLE_INPUT, "|| Mobile Data Computer:", "Inserisci l'ID di un veicolo per controllare le sue informazioni.", "Cerca", "Indietro");
  43. }
  44. if(listitem == 2)
  45. {
  46. ShowPlayerDialog(playerid, DIALOG_FEDINE, DIALOG_STYLE_INPUT, "|| Mobile Data Computer:", "Inserisci il nome di un player (anche offline!) per controllare la sua fedina penale.\nNOTA: Le informazioni generali non vengono visualizzate qui.", "Cerca", "Indietro");
  47. }
  48. return 1;
  49. }
  50. if(dialogid == DIALOG_RICERCAPERSONA)
  51. {
  52. if(!response) return ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_LIST, "|| Mobile Data Computer:", "Ricerca Persona (tramite Nome)\nRicerca Veicolo (tramite ID)\nFedina Penale (tramite Nome)", "Seleziona", "Annulla");
  53. new path[256];
  54. new tizio [256];
  55. format(tizio, sizeof(tizio), "%s", inputtext);
  56. format(path, sizeof(path), ACCOUNT, tizio);
  57. if(!dini_Exists(path)) return ShowPlayerDialog(playerid, DIALOG_RICERCAPERSONA, DIALOG_STYLE_INPUT, "|| Mobile Data Computer:", "ERRORE, il nome digitato non è presente nel Database!\nInserisci il nome di un player (anche offline!) per controllare le sue informazioni.\nNOTA: Le multe non vengono visualizzate qui.", "Cerca", "Indietro");
  58. format(stringa, sizeof(stringa), " * | Risultati ricerca '%s' | *", inputtext);
  59. format(stringa1, sizeof(stringa1), "Dati Anagrafici | Nome e Cognome: %s | Età: %d | Recapito Telefonico: %d | N° Civico: 23 Fort Carson", inputtext, dini_Int(path, "Score"), dini_Int(path, "Punti"));
  60. ShowPlayerDialog(playerid, DIALOG_INFOPERSONA, DIALOG_STYLE_MSGBOX, stringa, stringa1, "Indietro", "");
  61. return 1;
  62. }
  63. if(dialogid == DIALOG_RICERCAVEICOLO)
  64. {
  65. if(!response) return ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_LIST, "|| Mobile Data Computer:", "Ricerca Persona (tramite Nome)\nRicerca Veicolo (tramite ID)\nFedina Penale (tramite Nome)", "Seleziona", "Annulla");
  66. format(stringa, sizeof(stringa), "Proprietario: %s\nTarga: %s\n e tutte le informazioni possibili",   ");
  67. ShowPlayerDialog(playerid, DIALOG_INFOVEICOLO, DIALOG_STYLE_MSGBOX, "|| Risultati Ricerca Veicolo:", stringa, "Indietro", "");
  68. return 1;
  69. }
  70. if(dialogid == DIALOG_FEDINE)
  71. {
  72. if(!response) return ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_LIST, "|| Mobile Data Computer:", "Ricerca Persona (tramite Nome)\nRicerca Veicolo (tramite ID)\nFedina Penale (tramite Nome)", "Seleziona", "Annulla");
  73. new path[256];
  74. new tizio[256];
  75. format(tizio, sizeof(tizio), "%s", inputtext);
  76. format(path, sizeof(path), FEDINE, tizio);
  77. format(stringa, sizeof(stringa), " * | Mobile Data Computer, risultati ricerca '%s' | *", inputtext);
  78. SendClientMessage(playerid, COLORE_ROSSO, stringa);
  79. if(!dini_Exists(path)) return SendClientMessage(playerid, -1, " * Questa persona ha la fedina penale pulita!");
  80. ReadFile(playerid, path);
  81. return 1;
  82. }
  83.  
  84. // Comandi MDC - Pistol Tazer
  85. // MDC
  86. CMD:mdc(playerid, params[])
  87. {
  88. ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_LIST, "|| Mobile Data Computer:", "Ricerca Persona (tramite Nome)\nRicerca Veicolo (tramite ID)\nFedina Penale (tramite Nome)", "Seleziona", "Annulla");
  89. return 1;
  90. }
  91. CMD:pta(playerid, params[])
  92. {
  93. // PREMESSA, se il player ha una 9mm, avrà più munizioni di tale arma
  94. if(ptazer[playerid] == 0){
  95. ptazer[playerid] = 1;
  96. new arma, munizioni;
  97. new deagle = GetWeaponSlot(24);
  98. //new 9mm = GetWeaponSlot(23);
  99. GetPlayerWeaponData(playerid, deagle, arma, munizioni);
  100. pweap[playerid] = arma;
  101. pammo[playerid] = munizioni;
  102. GivePlayerWeapon(playerid, 23, 1);
  103. SendClientMessage(playerid, COLORE_VERDE, "[INFO]: Hai attivato il pistol-tazer!");
  104. } else {
  105. ptazer[playerid] = 0;
  106. SendClientMessage(playerid, COLORE_VERDE, "[INFO]: Hai disattivato il pistol-tazer!");
  107. GivePlayerWeapon(playerid, pweap[playerid], pammo[playerid]);
  108. pweap[playerid] = 0;
  109. pammo[playerid] = 0;
  110. }
  111. return 1;
  112. }
  113. // Da aggiungere al comando /multa
  114. new anno,mese,giorno, ora,minuti,secondi;
  115. getdate(anno, mese, giorno); gettime(ora, minuti, secondi);
  116. format(path, sizeof(path), FEDINE, GetName(tizio));
  117. new File:handle = fopen(path, io_append);
  118. if(fexist(path)) {
  119. format(stringa, sizeof(stringa), "[MULTA] (%d/%d/%d ora: %d:%d) %s è stato multato(%d$) da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), ammonto, GetName(playerid), ragione);
  120. fwrite(handle, stringa);
  121. fclose(handle);
  122. } else {
  123. //fcreate(handle);
  124. format(stringa, sizeof(stringa), "[MULTA] (%d/%d/%d ora: %d:%d) %s è stato multato(%d$) da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), ammonto, GetName(playerid), ragione);
  125. fwrite(handle, stringa);
  126. fclose(handle);
  127. }
  128. return 1;
  129. }
  130. // Da aggiungere al comando /su (sospetta)
  131. format(path, sizeof(path), FEDINE, GetName(tizio));
  132. new File:handle = fopen(path, io_append);
  133. if(fexist(path)) {
  134. format(stringa, sizeof(stringa), "[CRIMINE] (%d/%d/%d ora: %d:%d) %s è stato incriminato da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), GetName(playerid), ragione);
  135. fwrite(handle, stringa);
  136. fclose(handle);
  137. } else {
  138. //fcreate(handle);
  139. format(stringa, sizeof(stringa), "[CRIMINE] (%d/%d/%d ora: %d:%d) %s è stato incriminato da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), GetName(playerid), ragione);
  140. fwrite(handle, stringa);
  141. fclose(handle);
  142. }
  143. // Da aggiungere al comando /arresta, aggiungere se si può il minuto "-1", per ruolare eventuali ergastoli
  144. format(path, sizeof(path), FEDINE, GetName(tizio));
  145. new File:handle = fopen(path, io_append);
  146. if(fexist(path)) {
  147. format(stringa, sizeof(stringa), "[ARRESTO] (%d/%d/%d ora: %d:%d) %s è stato arrestato da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), GetName(playerid), ragione);
  148. fwrite(handle, stringa);
  149. fclose(handle);
  150. } else {
  151. //fcreate(handle);
  152. format(stringa, sizeof(stringa), "[ARRESTO] (%d/%d/%d ora: %d:%d) %s è stato arresto da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), GetName(playerid), ragione);
  153. fwrite(handle, stringa);
  154. fclose(handle);
  155. }
  156.  
  157. // Pistol Tazer
  158. public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
  159. {
  160. // Piccolo bug nella mia GM, non so se nella vostra funziona
  161. new Float:heal;
  162. GetPlayerHealth(damagedid, heal);
  163. if(ptazer[playerid] == 0) {}
  164. if(ptazer[playerid] == 1 && GetPlayerWeapon(playerid) == 23) {
  165. TogglePlayerControllable(damagedid, 0);
  166. SendClientMessage(damagedid, COLORE_ROSSO, "[INFO]: Sei stato TAZERATO per 20 secondi!");
  167. SetTimerEx("tazertimer", 20000, false, "i", damagedid);
  168. SetPlayerHealth(damagedid, heal+amount);
  169. }
  170. return 1;
  171. }
  172.  
  173. // Lettura Logs
  174. stock ReadFile(playerid, fname[])
  175. {
  176. new File:file = fopen(fname, io_read), string[800];
  177. if(file) {
  178. while(fread(file, string))
  179. SendClientMessage(playerid, -1, string);
  180. fclose(file); }
  181. }
  182. // Tazer - Per controllare se un'arma è nello slot di un player, utile per rimpiazzare le munizioni di deagle quando si toglie il tazer
  183. stock GetWeaponSlot(weaponid)
  184. {
  185. new slot;
  186. switch(weaponid)
  187. {
  188. case 0,1: slot = 0;
  189. case 2 .. 9: slot = 1;
  190. case 10 .. 15: slot = 10;
  191. case 16 .. 18, 39: slot = 8;
  192. case 22 .. 24: slot =2;
  193. case 25 .. 27: slot = 3;
  194. case 28, 29, 32: slot = 4;
  195. case 30, 31: slot = 5;
  196. case 33, 34: slot = 6;
  197. case 35 .. 38: slot = 7;
  198. case 40: slot = 12;
  199. case 41 .. 43: slot = 9;
  200. case 44 .. 46: slot = 11;
  201. }
  202. return slot;
  203. }
  204. forward tazertimer(playerid);
  205. public tazertimer(playerid)
  206. {
  207. TogglePlayerControllable(playerid, 1);
  208. SendClientMessage(playerid, 0xFFFF00AA, "[INFO]: Non sei più tazerato!");
  209. return 1;
  210. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement