Advertisement
Guest User

Untitled

a guest
Apr 11th, 2011
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.65 KB | None | 0 0
  1. /* EasyZone created by Mitosking for www.gta-center.com, an italian siteweb and forum of Grand Theft Auto.
  2. Thanks to Alby_Fire and Giovanni94m for helping me in difficult moment :).
  3. Original topic of this script: http://www.gta-center.com/forums/viewtopic.php?f=42&t=1094&p=11263#p11263
  4. Line: 197 (included this comment)
  5. Particolar Include: file.inc
  6. Time work: 2 hour*/
  7.  
  8. #include <a_samp>
  9.  
  10.  
  11. // #if defined FILTERSCRIPT
  12.  
  13. #define NOME 1526
  14. #define COLORE 1527
  15. #define TIPOCOLORE 1528
  16. #define HEX 1529
  17.  
  18. #define rosso 0xff0000ff
  19. #define blu 0x0000ffff
  20. #define verde 0x00ff00ff
  21. #define verdescuro 0x009500ff
  22. #define rossoscuro 0xa00000ff
  23. #define bluscuro 0x0000a0ff
  24. #define nero 0x000000ff
  25. #define bianco 0xffffffff
  26. #define giallo 0xffff00ff
  27. #define arancione 0xffb100ff
  28. #define viola 0x974598ff
  29. #define azzurro 0x97c7ffff
  30. #define verdeacqua 0x00ffffff
  31. #define fuxia 0x90559bff
  32. #define marrone 0x905500ff
  33. #define rosachiaro 0xffd9ffff
  34. #define rosascuro 0xff58ffff
  35.  
  36. new ZoneName[MAX_PLAYERS][128], bool: CreateZone[MAX_PLAYERS], Float: GangPos[MAX_PLAYERS][4], Step[MAX_PLAYERS], GFile[128], stringa[128], Colore[MAX_PLAYERS][128];
  37.  
  38. public OnFilterScriptInit()
  39. {
  40. print("\n--------------------------------------");
  41. print(" EasyZone by Mitosking LOADED.");
  42. print("--------------------------------------\n");
  43. if(!fexist("Crediti.txt"))
  44. {
  45. new File: crediti = fopen("Crediti.txt", io_write);
  46. fwrite(crediti, "EasyZone by Mitosking. Vietata la diffusione di questo FilterScript senza il mio permesso. FS creato per www.gta-center.com");
  47. fclose(crediti);
  48. }
  49. return 1;
  50. }
  51.  
  52. public OnFilterScriptExit()
  53. {
  54. print("\n--------------------------------------");
  55. print(" EasyZone by Mitosking UNLOADED.");
  56. print("--------------------------------------\n");
  57. return 1;
  58. }
  59.  
  60. // #else
  61. // #endif
  62.  
  63. public OnPlayerConnect(playerid)
  64. {
  65. CreateZone[playerid] = false;
  66. Step[playerid] = 0;
  67. ZoneName[playerid] = "-1";
  68. GangPos[playerid][0] = -1;
  69. GangPos[playerid][1] = -1;
  70. GangPos[playerid][2] = -1;
  71. GangPos[playerid][3] = -1;
  72. return 1;
  73. }
  74.  
  75. public OnPlayerCommandText(playerid, cmdtext[])
  76. {
  77. if (strcmp("/creazona", cmdtext, true, 8) == 0)
  78. {
  79. if(!IsPlayerAdmin(playerid)) return 0;
  80. ShowPlayerDialog(playerid, NOME, 1, "EasyZone by Mitosking", "Inserisci il nome che vorresti dare alla tua GangZone", "Continua", "Annulla");
  81. return 1;
  82. }
  83.  
  84. if (strcmp("/finezona", cmdtext, true, 8) == 0)
  85. {
  86. SendClientMessage(playerid, bianco, "Hai terminato la tua zona. Non è stato creato nessun file...");
  87. Step[playerid] = 0; CreateZone[playerid] = false;
  88. return 1;
  89. }
  90. return 0;
  91. }
  92.  
  93. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  94. {
  95. if(dialogid == NOME && response)
  96. {
  97. if(!strlen(inputtext)) return SendClientMessage(playerid, rosso, "[ERRORE:]Devi inserire un nome per continuare!");
  98. format(GFile, 128, "%s.txt", inputtext);
  99. if(fexist(GFile)) return SendClientMessage(playerid, rosso, "[ERRORE:]Nome già esistente!");
  100. format(stringa, 128, "%s", inputtext);
  101. ZoneName[playerid] = stringa;
  102. ShowPlayerDialog(playerid, TIPOCOLORE, 2, "Scegli il tipo di colore", "Predefinito\nHex", "Continua", "Annulla");
  103.  
  104. }
  105.  
  106. if(dialogid == TIPOCOLORE && response)
  107. {
  108. switch(listitem)
  109. {
  110. case 0: ShowPlayerDialog(playerid, COLORE, 2, "Scegli il colore della tua Gang Zone", "{ff0000}Rosso\n{a00000}Rosso scuro\n{00ff00}Verde\n{009500}Verde scuro\n{0000ff}Blu\n{0000a0}Blu scuro\n{000000}Nero\n{ff92cc}Rosa\n{ff58ff}Rosa scuro\n{905500}Marrone\n{90559b}Fuxia\n{ffffff}Bianco\n{ffff00}Giallo\n{974598}Viola\n{97c7ff}Azzurro\n{ffb100}Arancione", "Continua", "Annulla");
  111. case 1: ShowPlayerDialog(playerid, HEX, 1, "Colore Hex", "Inserisci il codice Hex del tuo colore", "Continua", "Cancella");
  112. }
  113. }
  114.  
  115. if(dialogid == HEX && response)
  116. {
  117. if(!strlen(inputtext))
  118. {
  119. ShowPlayerDialog(playerid, HEX, 1, "Colore Hex", "Inserisci il codice Hex del tuo colore", "Continua", "Cancella");
  120. SendClientMessage(playerid, rosso, "[ERROR:]Inserisci un codice Hex!");
  121. return 1;
  122. }
  123. format(stringa, 128, "%s", inputtext);
  124. Colore[playerid] = stringa;
  125. SendClientMessage(playerid, bianco, "Posizionati nell'angolo in {ff0000}basso a sinistra{ffffff}.");
  126. GameTextForPlayer(playerid, "~w~Premi ~r~~k~~VEHICLE_ENTER_EXIT~~w~ per memorizzare la posizione", 6300, 5);
  127. CreateZone[playerid] = true; Step[playerid] = 1;
  128. }
  129. if(dialogid == COLORE && response)
  130. {
  131. SendClientMessage(playerid, bianco, "Posizionati nell'angolo in {ff0000}basso a sinistra{ffffff}.");
  132. GameTextForPlayer(playerid, "~w~Premi ~r~~k~~VEHICLE_ENTER_EXIT~~w~ per memorizzare la posizione", 6300, 5);
  133. CreateZone[playerid] = true; Step[playerid] = 1;
  134. switch(listitem)
  135. {
  136. case 0: Colore[playerid] = "0xff0000ff";
  137. case 1: Colore[playerid] = "0xa00000ff";
  138. case 2: Colore[playerid] = "0x00ff00ff";
  139. case 3: Colore[playerid] = "0x009500ff";
  140. case 4: Colore[playerid] = "0x0000ffff";
  141. case 5: Colore[playerid] = "0x0000a0ff";
  142. case 6: Colore[playerid] = "0x000000ff";
  143. case 7: Colore[playerid] = "0xffd9ffff";
  144. case 8: Colore[playerid] = "0xff58ffff";
  145. case 9: Colore[playerid] = "0x905500ff";
  146. case 10: Colore[playerid] = "0x90559bff";
  147. case 11: Colore[playerid] = "0xffffffff";
  148. case 12: Colore[playerid] = "0xffff00ff";
  149. case 13: Colore[playerid] = "0x974598ff";
  150. case 14: Colore[playerid] = "0x97c7ffff";
  151. case 15: Colore[playerid] = "0xffb100ff";
  152. }
  153. }
  154. return 1;
  155. }
  156.  
  157. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  158. {
  159. new Float: Pos[3]; GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  160. if(newkeys == KEY_SECONDARY_ATTACK && CreateZone[playerid] == true && Step[playerid] == 1)
  161. {
  162. GangPos[playerid][0] = Pos[0];
  163. SendClientMessage(playerid, bianco, "Posizionati nell'angolo in {ff0000}alto a sinistra{ffffff}.");
  164. Step[playerid] ++;
  165. }
  166. else if(newkeys == KEY_SECONDARY_ATTACK && CreateZone[playerid] == true && Step[playerid] == 2)
  167. {
  168. GangPos[playerid][1] = Pos[1];
  169. SendClientMessage(playerid, bianco, "Posizionati nell'angolo in {ff0000}alto a destra{ffffff}.");
  170. Step[playerid] ++;
  171. }
  172. else if(newkeys == KEY_SECONDARY_ATTACK && CreateZone[playerid] == true && Step[playerid] == 3)
  173. {
  174. GangPos[playerid][3] = Pos[0];
  175. SendClientMessage(playerid, bianco, "Posizionati nell'angolo in {ff0000}basso a destra{ffffff}.");
  176. Step[playerid] ++;
  177. }
  178. else if(newkeys == KEY_SECONDARY_ATTACK && CreateZone[playerid] == true && Step[playerid] == 4)
  179. {
  180. GangPos[playerid][2] = Pos[1];
  181. format(stringa, 128, "Hai terminato la creazione della tua zona. Adesso recati nel file {ff0000}%s{ffffff} nella cartella {ff0000}scriptfiles", ZoneName[playerid]);
  182. SendClientMessage(playerid, bianco, stringa);
  183. format(GFile, 128, "%s.txt", ZoneName[playerid]);
  184. new File: zone = fopen(GFile, io_write);
  185. format(stringa, 128, "//In cima a tutto\r\nnew %s;", ZoneName[playerid]);
  186. fwrite(zone, stringa);
  187. format(stringa, 128, "\r\n//Sotto OnGameModeInit\r\n%s = GangZoneCreate(%f, %f, %f, %f);",ZoneName[playerid], GangPos[playerid][0], GangPos[playerid][1], GangPos[playerid][3], GangPos[playerid][2]);
  188. fwrite(zone, stringa);
  189. format(stringa, 128, "\r\n\r\n\r\n//GangZoneShowForPlayer(playerid, %s, %s) | GangZoneShowForAll(%s, %s) per rendere visibile la zona!", ZoneName[playerid], Colore[playerid], ZoneName[playerid], Colore[playerid]);
  190. fwrite(zone, stringa);
  191. fwrite(zone, "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n//EasyZone by Mitosking. It's created for www.gta-center.com");
  192. Step[playerid] = 0;
  193. CreateZone[playerid] = false;
  194. fclose(zone);
  195. }
  196. return 1;
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement