Advertisement
OtaconEvil

[FS] Sistema de creacion de zonas | By OTACON - [SPANISH]

Oct 17th, 2015
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 18.30 KB | None | 0 0
  1. /*
  2.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  3.     *
  4.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  5.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  6.     *
  7.     * Codigo Creado Por OTACON
  8.     *
  9.     * CREDITOS:
  10.     *     OTACON: Realizacion y Idea de creacion del code.
  11.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  12.     *
  13.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  14.     *
  15.     *                Prohibido TOTALMENTE el Robo de Créditos o la
  16.     *                  Publicación de este FILTERSCRIPT sin Mi Permiso.
  17. */
  18. /*
  19.     * ## READ CAREFULLY TO AVOID BECOMING LAMMER!.: :D ##
  20.     *
  21.     * This simple FILTERSCRIPT is made especially for www.forum.sa-mp.com
  22.     * DO NOT Post the FILTERSCRIPT in Other SAMP forums and impersonating the creator of the CODE.
  23.     *
  24.     * Code Created By OTACON
  25.     *
  26.     * CREDITS:
  27.     *     OTACON: Idea Making and code creation.
  28.     *     YOUR: Modification freely respecting the above ;).
  29.     *
  30.     *    NOTE: Less Credits for those who criticize me.. JO'PUTAS! :D xD ;)
  31.     *
  32.     *                        FULLY spaces Theft Credit or
  33.     *                 Publication of this FILTERSCRIPT without my permission.
  34. */
  35.  
  36. /*
  37. [img]http://i.imgur.com/9NRbkIt.png[/img]
  38.  
  39. [img]http://i.imgur.com/xq3FLTd.png[/img]
  40.  
  41. [img]http://i.imgur.com/GKkOYvE.png[/img]
  42.  
  43. [img]http://i.imgur.com/p8kGidc.png[/img]
  44.  
  45. [img]http://i.imgur.com/QblhJgg.png[/img]
  46.  
  47. [IMG]http://i.imgur.com/xSKhsww.png[/IMG]
  48. */
  49.  
  50. #include <a_samp>
  51. #include <sscanf2> //http://forum.sa-mp.com/showthread.php?t=120356
  52. #include <zcmd> //http://forum.sa-mp.com/showthread.php?t=91354
  53.  
  54. stock HexToInt(string[]){
  55.   if (string[0]==0) return 0;
  56.   new i;
  57.   new cur=1;
  58.   new res=0;
  59.   for (i=strlen(string);i>0;i--) {
  60.     if (string[i-1]<58) res=res+cur*(string[i-1]-48); else res=res+cur*(string[i-1]-65+10);
  61.     cur=cur*16;
  62.   }return res;
  63. }
  64.  
  65. new VehicleColoursTableRGBA[256] = {
  66. // The existing colours from San Andreas
  67. 0x000000FF, 0xF5F5F5FF, 0x2A77A1FF, 0x840410FF, 0x263739FF, 0x86446EFF, 0xD78E10FF, 0x4C75B7FF, 0xBDBEC6FF, 0x5E7072FF,
  68. 0x46597AFF, 0x656A79FF, 0x5D7E8DFF, 0x58595AFF, 0xD6DAD6FF, 0x9CA1A3FF, 0x335F3FFF, 0x730E1AFF, 0x7B0A2AFF, 0x9F9D94FF,
  69. 0x3B4E78FF, 0x732E3EFF, 0x691E3BFF, 0x96918CFF, 0x515459FF, 0x3F3E45FF, 0xA5A9A7FF, 0x635C5AFF, 0x3D4A68FF, 0x979592FF,
  70. 0x421F21FF, 0x5F272BFF, 0x8494ABFF, 0x767B7CFF, 0x646464FF, 0x5A5752FF, 0x252527FF, 0x2D3A35FF, 0x93A396FF, 0x6D7A88FF,
  71. 0x221918FF, 0x6F675FFF, 0x7C1C2AFF, 0x5F0A15FF, 0x193826FF, 0x5D1B20FF, 0x9D9872FF, 0x7A7560FF, 0x989586FF, 0xADB0B0FF,
  72. 0x848988FF, 0x304F45FF, 0x4D6268FF, 0x162248FF, 0x272F4BFF, 0x7D6256FF, 0x9EA4ABFF, 0x9C8D71FF, 0x6D1822FF, 0x4E6881FF,
  73. 0x9C9C98FF, 0x917347FF, 0x661C26FF, 0x949D9FFF, 0xA4A7A5FF, 0x8E8C46FF, 0x341A1EFF, 0x6A7A8CFF, 0xAAAD8EFF, 0xAB988FFF,
  74. 0x851F2EFF, 0x6F8297FF, 0x585853FF, 0x9AA790FF, 0x601A23FF, 0x20202CFF, 0xA4A096FF, 0xAA9D84FF, 0x78222BFF, 0x0E316DFF,
  75. 0x722A3FFF, 0x7B715EFF, 0x741D28FF, 0x1E2E32FF, 0x4D322FFF, 0x7C1B44FF, 0x2E5B20FF, 0x395A83FF, 0x6D2837FF, 0xA7A28FFF,
  76. 0xAFB1B1FF, 0x364155FF, 0x6D6C6EFF, 0x0F6A89FF, 0x204B6BFF, 0x2B3E57FF, 0x9B9F9DFF, 0x6C8495FF, 0x4D8495FF, 0xAE9B7FFF,
  77. 0x406C8FFF, 0x1F253BFF, 0xAB9276FF, 0x134573FF, 0x96816CFF, 0x64686AFF, 0x105082FF, 0xA19983FF, 0x385694FF, 0x525661FF,
  78. 0x7F6956FF, 0x8C929AFF, 0x596E87FF, 0x473532FF, 0x44624FFF, 0x730A27FF, 0x223457FF, 0x640D1BFF, 0xA3ADC6FF, 0x695853FF,
  79. 0x9B8B80FF, 0x620B1CFF, 0x5B5D5EFF, 0x624428FF, 0x731827FF, 0x1B376DFF, 0xEC6AAEFF, 0x000000FF,
  80. // SA-MP extended colours (0.3x)
  81. 0x177517FF, 0x210606FF, 0x125478FF, 0x452A0DFF, 0x571E1EFF, 0x010701FF, 0x25225AFF, 0x2C89AAFF, 0x8A4DBDFF, 0x35963AFF,
  82. 0xB7B7B7FF, 0x464C8DFF, 0x84888CFF, 0x817867FF, 0x817A26FF, 0x6A506FFF, 0x583E6FFF, 0x8CB972FF, 0x824F78FF, 0x6D276AFF,
  83. 0x1E1D13FF, 0x1E1306FF, 0x1F2518FF, 0x2C4531FF, 0x1E4C99FF, 0x2E5F43FF, 0x1E9948FF, 0x1E9999FF, 0x999976FF, 0x7C8499FF,
  84. 0x992E1EFF, 0x2C1E08FF, 0x142407FF, 0x993E4DFF, 0x1E4C99FF, 0x198181FF, 0x1A292AFF, 0x16616FFF, 0x1B6687FF, 0x6C3F99FF,
  85. 0x481A0EFF, 0x7A7399FF, 0x746D99FF, 0x53387EFF, 0x222407FF, 0x3E190CFF, 0x46210EFF, 0x991E1EFF, 0x8D4C8DFF, 0x805B80FF,
  86. 0x7B3E7EFF, 0x3C1737FF, 0x733517FF, 0x781818FF, 0x83341AFF, 0x8E2F1CFF, 0x7E3E53FF, 0x7C6D7CFF, 0x020C02FF, 0x072407FF,
  87. 0x163012FF, 0x16301BFF, 0x642B4FFF, 0x368452FF, 0x999590FF, 0x818D96FF, 0x99991EFF, 0x7F994CFF, 0x839292FF, 0x788222FF,
  88. 0x2B3C99FF, 0x3A3A0BFF, 0x8A794EFF, 0x0E1F49FF, 0x15371CFF, 0x15273AFF, 0x375775FF, 0x060820FF, 0x071326FF, 0x20394BFF,
  89. 0x2C5089FF, 0x15426CFF, 0x103250FF, 0x241663FF, 0x692015FF, 0x8C8D94FF, 0x516013FF, 0x090F02FF, 0x8C573AFF, 0x52888EFF,
  90. 0x995C52FF, 0x99581EFF, 0x993A63FF, 0x998F4EFF, 0x99311EFF, 0x0D1842FF, 0x521E1EFF, 0x42420DFF, 0x4C991EFF, 0x082A1DFF,
  91. 0x96821DFF, 0x197F19FF, 0x3B141FFF, 0x745217FF, 0x893F8DFF, 0x7E1A6CFF, 0x0B370BFF, 0x27450DFF, 0x071F24FF, 0x784573FF,
  92. 0x8A653AFF, 0x732617FF, 0x319490FF, 0x56941DFF, 0x59163DFF, 0x1B8A2FFF, 0x38160BFF, 0x041804FF, 0x355D8EFF, 0x2E3F5BFF,
  93. 0x561A28FF, 0x4E0E27FF, 0x706C67FF, 0x3B3E42FF, 0x2E2D33FF, 0x7B7E7DFF, 0x4A4442FF, 0x28344EFF };
  94.  
  95. #define DIALOG_ZONES (4)
  96. #define MAX_ZONES (200)
  97. enum zone{
  98.     ZONE_CREATE[MAX_ZONES],
  99.     ZONE_COUNT,
  100.     bool:ZONE_ACTION,
  101.     ZONE_COLOR[MAX_ZONES],
  102.     bool:ZONE_ACTIVE,
  103.     ZONE_FILE_NAME[144],
  104.     bool:ZONE_MODE,
  105. };
  106. new iInfoZone[MAX_PLAYERS][zone],
  107. Float:ZONE_POSITION[MAX_PLAYERS][MAX_ZONES][4];
  108.  
  109. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
  110.     if(newkeys & KEY_YES && iInfoZone[playerid][ZONE_ACTIVE]){
  111.         PlayerPlaySound(playerid, 21000, 0,0,0);
  112.         if(iInfoZone[playerid][ZONE_FILE_NAME] == '\0'){
  113.             ShowPlayerDialog(playerid,DIALOG_ZONES+0, DIALOG_STYLE_INPUT, "{11B9AB}Sistema de creacion de zonas(areas):", "\
  114.             {F9F9F9}INFO: escribe un nombre para el archivo de las zonas a crear: \n\
  115.             {C21010}NOTA: no ir por debajo de 4, o por arriba de 144 caracteres,", "aceptar", "cancelar");
  116.         }else{
  117.             new
  118.                 Float:x,Float:y,Float:z;
  119.             if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, x,y,z);
  120.             else GetVehiclePos(GetPlayerVehicleID(playerid), x,y,z);
  121.             #pragma unused z
  122.             if(!iInfoZone[playerid][ZONE_ACTION]){
  123.                 if(iInfoZone[playerid][ZONE_COUNT] > MAX_ZONES)
  124.                     return SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}limite de zonas creadas alcanzado{F9F9F9}!.");
  125.                 iInfoZone[playerid][ZONE_COUNT]++;
  126.                 ZONE_POSITION[playerid][iInfoZone[playerid][ZONE_COUNT]][0] = x;
  127.                 ZONE_POSITION[playerid][iInfoZone[playerid][ZONE_COUNT]][1] = y;
  128.                 iInfoZone[playerid][ZONE_ACTION] = true;
  129.                 SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}coordenadas {F9F9F9}minx | miny {11B9AB}obtenidas{F9F9F9}!.");
  130.             }else{
  131.                 ZONE_POSITION[playerid][iInfoZone[playerid][ZONE_COUNT]][2] = x;
  132.                 ZONE_POSITION[playerid][iInfoZone[playerid][ZONE_COUNT]][3] = y;
  133.                 iInfoZone[playerid][ZONE_ACTION] = false;
  134.                 SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}coordenadas {F9F9F9}maxx | maxy {11B9AB}obtenidas{F9F9F9}!.");
  135.                 iInfoZone[playerid][ZONE_COLOR][iInfoZone[playerid][ZONE_COUNT]] = HexToInt(VehicleColoursTableRGBA[random(sizeof(VehicleColoursTableRGBA))]);
  136.                 iInfoZone[playerid][ZONE_CREATE][iInfoZone[playerid][ZONE_COUNT]] = GangZoneCreate(ZONE_POSITION[playerid][iInfoZone[playerid][ZONE_COUNT]][0], ZONE_POSITION[playerid][iInfoZone[playerid][ZONE_COUNT]][1], ZONE_POSITION[playerid][iInfoZone[playerid][ZONE_COUNT]][2], ZONE_POSITION[playerid][iInfoZone[playerid][ZONE_COUNT]][3]);
  137.                 GangZoneShowForPlayer(playerid, iInfoZone[playerid][ZONE_CREATE][iInfoZone[playerid][ZONE_COUNT]], iInfoZone[playerid][ZONE_COLOR][iInfoZone[playerid][ZONE_COUNT]]);
  138.                 SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}zona creada, creacion exitosa{F9F9F9}!.");
  139.             }
  140.         }
  141.     }
  142.     if(newkeys & KEY_NO && iInfoZone[playerid][ZONE_ACTIVE]){
  143.         if(iInfoZone[playerid][ZONE_COUNT] < 1)
  144.             return SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}no hay ninguna area creada para guardar{F9F9F9}!.");
  145.         if(iInfoZone[playerid][ZONE_ACTION])
  146.             return SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}estas en proceso de creacion de un area{F9F9F9}!.");
  147.  
  148.         PlayerPlaySound(playerid, 21000, 0,0,0);
  149.         ShowPlayerDialog(playerid,DIALOG_ZONES+1, DIALOG_STYLE_MSGBOX, "{11B9AB}Sistema de creacion de zonas(areas):", "\
  150.         {F9F9F9}INFO: seleccione el modo de guardado:", "defecto", "streamer");
  151.     }
  152.     return true;
  153. }
  154.  
  155. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  156.     switch(dialogid){
  157.         case DIALOG_ZONES+0:{
  158.             if(response){
  159.                 new
  160.                     zText[144];
  161.                 if(sscanf(inputtext, "s[144]", zText)){
  162.                     PlayerPlaySound(playerid, 21000, 0,0,0);
  163.                     ShowPlayerDialog(playerid,DIALOG_ZONES+0, DIALOG_STYLE_INPUT, "{11B9AB}Sistema de creacion de zonas(areas):", "\
  164.                     {F9F9F9}INFO: escribe un nombre para el archivo de las zonas a crear: \n\
  165.                     {C21010}NOTA: no ir por debajo de 4, o por arriba de 144 caracteres,", "aceptar", "cancelar");
  166.                     return true;}
  167.                 if(strlen(zText) < 4 && strlen(zText) > 144){
  168.                     PlayerPlaySound(playerid, 21000, 0,0,0);
  169.                     ShowPlayerDialog(playerid,DIALOG_ZONES+0, DIALOG_STYLE_INPUT, "{11B9AB}Sistema de creacion de zonas(areas):", "\
  170.                     {F9F9F9}INFO: escribe un nombre para el archivo de las zonas a crear: \n\
  171.                     {C21010}NOTA: no ir por debajo de 4, o por arriba de 144 caracteres,", "aceptar", "cancelar");
  172.                     return true;}
  173.                    
  174.                 format(iInfoZone[playerid][ZONE_FILE_NAME],144,"%s", zText);
  175.                 SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}nombre asignado correctamente{F9F9F9}!.");
  176.                 PlayerPlaySound(playerid, 21000, 0,0,0);
  177.             }else PlayerPlaySound(playerid, 21000, 0,0,0);
  178.         }
  179.         case DIALOG_ZONES+1:{
  180.             PlayerPlaySound(playerid, 21000, 0,0,0);
  181.             ShowPlayerDialog(playerid,DIALOG_ZONES+2, DIALOG_STYLE_MSGBOX, "{11B9AB}Sistema de creacion de zonas(areas):", "\
  182.             {F9F9F9}INFO: seleccione el tipo de archivo:", ".TXT", ".PWN");
  183.            
  184.             if(response) iInfoZone[playerid][ZONE_MODE] = true, SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}modo de guardado seleccionado: {F9F9F9}por defecto.");
  185.             else iInfoZone[playerid][ZONE_MODE] = false, SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}modo de guardado seleccionado: {F9F9F9}por streamer.");
  186.         }
  187.         case DIALOG_ZONES+2:{
  188.             new
  189.                 zData[1024],File:zFiles;
  190.             PlayerPlaySound(playerid, 21000, 0,0,0);
  191.             format(zData,sizeof(zData),"%s.%s",iInfoZone[playerid][ZONE_FILE_NAME],(response)?("txt"):("pwn"));
  192.             if(response) SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}tipo de archivo seleccionado: {F9F9F9}.TXT.");
  193.             else SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}tipo de archivo seleccionado: {F9F9F9}.PWN.");
  194.            
  195.             if(fexist(zData)) fremove(zData);
  196.             zFiles=fopen(zData, io_append);
  197.             if(zFiles){
  198.                 fwrite(zFiles, "\r\n ## Sistema de creacion de zonas(areas) | By OTACON ## \r\n\r\n");
  199.                 if(response){
  200.                     format(zData,sizeof(zData),"    new _zones[%d]; \r\n\r\n", iInfoZone[playerid][ZONE_COUNT]+1);
  201.                     fwrite(zFiles, zData);
  202.                     for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++){
  203.                         if(iInfoZone[playerid][ZONE_MODE]){
  204.                             format(zData,sizeof(zData),"    _zones[%d] = GangZoneCreate(%f, %f ,%f, %f); \r\n", xx, ZONE_POSITION[playerid][xx][0], ZONE_POSITION[playerid][xx][1], ZONE_POSITION[playerid][xx][2], ZONE_POSITION[playerid][xx][3]);
  205.                             fwrite(zFiles, zData);
  206.                             format(zData,sizeof(zData),"    GangZoneShowForPlayer(playerid, _zones[%d], 0x%08x); \r\n\r\n", xx, iInfoZone[playerid][ZONE_COLOR][xx]);
  207.                             fwrite(zFiles, zData);
  208.                         }else{
  209.                             format(zData,sizeof(zData),"    _zones[%d] = CreateDynamicRectangle(%f, %f ,%f, %f, -1, -1, -1); \r\n\r\n", xx, ZONE_POSITION[playerid][xx][0], ZONE_POSITION[playerid][xx][1], ZONE_POSITION[playerid][xx][2], ZONE_POSITION[playerid][xx][3]);
  210.                             fwrite(zFiles, zData);
  211.                         }
  212.                     }
  213.                 }else{
  214.                     if(iInfoZone[playerid][ZONE_MODE]){
  215.                         fwrite(zFiles, "#include <a_samp>\r\n");
  216.                         format(zData,sizeof(zData),"new _zones[%d];\r\n\r\n", iInfoZone[playerid][ZONE_COUNT]+1);
  217.                         fwrite(zFiles, zData);
  218.                         fwrite(zFiles, "public OnFilterScriptInit(){\r\n");
  219.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  _zones[%d] = GangZoneCreate(%f, %f ,%f, %f);\r\n", xx, ZONE_POSITION[playerid][xx][0], ZONE_POSITION[playerid][xx][1], ZONE_POSITION[playerid][xx][2], ZONE_POSITION[playerid][xx][3]),fwrite(zFiles, zData);
  220.                         fwrite(zFiles, "    return true;\r\n");
  221.                         fwrite(zFiles, "}\r\n\r\n");
  222.                         fwrite(zFiles, "public OnFilterScriptExit(){\r\n");
  223.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  GangZoneDestroy(_zones[%d]);\r\n", xx),fwrite(zFiles, zData);
  224.                         fwrite(zFiles, "    return true;\r\n");
  225.                         fwrite(zFiles, "}\r\n\r\n");
  226.                         fwrite(zFiles, "public OnPlayerSpawn(playerid){\r\n");
  227.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  GangZoneShowForPlayer(playerid, _zones[%d], 0x%08x);\r\n", xx, iInfoZone[playerid][ZONE_COLOR][xx]),fwrite(zFiles, zData);
  228.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  // GangZoneFlashForPlayer(playerid, _zones[%d], 0x%08x);\r\n", xx, iInfoZone[playerid][ZONE_COLOR][xx]),fwrite(zFiles, zData);
  229.                         fwrite(zFiles, "    return true;\r\n");
  230.                         fwrite(zFiles, "}\r\n\r\n");
  231.                         fwrite(zFiles, "public OnPlayerDisconnect(playerid, reason){\r\n");
  232.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  GangZoneHideForPlayer(playerid, _zones[%d]);\r\n", xx),fwrite(zFiles, zData);
  233.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  // GangZoneStopFlashForPlayer(playerid, _zones[%d]);\r\n", xx),fwrite(zFiles, zData);
  234.                         fwrite(zFiles, "    return true;\r\n");
  235.                         fwrite(zFiles, "}\r\n\r\n");
  236.                     }else{
  237.                         fwrite(zFiles, "#include <a_samp>\r\n");
  238.                         fwrite(zFiles, "#include <streamer>\r\n");
  239.                         format(zData,sizeof(zData),"new _zones[%d];\r\n\r\n", iInfoZone[playerid][ZONE_COUNT]+1);
  240.                         fwrite(zFiles, zData);
  241.                         fwrite(zFiles, "public OnFilterScriptInit(){\r\n");
  242.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  _zones[%d] = CreateDynamicRectangle(%f, %f ,%f, %f, -1, -1, -1);\r\n", xx, ZONE_POSITION[playerid][xx][0], ZONE_POSITION[playerid][xx][1], ZONE_POSITION[playerid][xx][2], ZONE_POSITION[playerid][xx][3]),fwrite(zFiles, zData);
  243.                         fwrite(zFiles, "    return true;\r\n");
  244.                         fwrite(zFiles, "}\r\n\r\n");
  245.                         fwrite(zFiles, "public OnFilterScriptExit(){\r\n");
  246.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  DestroyDynamicArea(_zones[%d]);\r\n", xx),fwrite(zFiles, zData);
  247.                         fwrite(zFiles, "    return true;\r\n");
  248.                         fwrite(zFiles, "}\r\n\r\n");
  249.                         fwrite(zFiles, "public OnPlayerEnterDynamicArea(playerid, areaid){\r\n");
  250.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  if(areaid == _zones[%d]){\r\n", xx),fwrite(zFiles, zData);
  251.                         fwrite(zFiles, "        // coloca tu funcion aqui.\r\n");
  252.                         fwrite(zFiles, "    }\r\n");
  253.                         fwrite(zFiles, "    return true;\r\n");
  254.                         fwrite(zFiles, "}\r\n\r\n");
  255.                         fwrite(zFiles, "public OnPlayerLeaveDynamicArea(playerid, areaid){\r\n");
  256.                         for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++) format(zData,sizeof(zData),"  if(areaid == _zones[%d]){\r\n", xx),fwrite(zFiles, zData);
  257.                         fwrite(zFiles, "        // coloca tu funcion aqui.\r\n");
  258.                         fwrite(zFiles, "    }\r\n");
  259.                         fwrite(zFiles, "    return true;\r\n");
  260.                         fwrite(zFiles, "}\r\n\r\n");
  261.                     }
  262.                 }
  263.                 fwrite(zFiles, " ## Sistema de creacion de zonas(areas) | By OTACON ## \r\n");
  264.                 SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}zonas creadas, guardado exitoso{F9F9F9}!.");
  265.                 for(new xx=1, xxx=iInfoZone[playerid][ZONE_COUNT]; xx<=xxx; xx++){
  266.                     GangZoneHideForPlayer(playerid,iInfoZone[playerid][ZONE_CREATE][xx]);
  267.                     GangZoneDestroy(iInfoZone[playerid][ZONE_CREATE][xx]);
  268.                     ZONE_POSITION[playerid][xx][0] = 0.0, ZONE_POSITION[playerid][xx][1] = 0.0, ZONE_POSITION[playerid][xx][2] = 0.0, ZONE_POSITION[playerid][xx][3] = 0.0;
  269.                     iInfoZone[playerid][ZONE_COLOR][xx] = 0;
  270.                 }
  271.                 iInfoZone[playerid][ZONE_COUNT] = 0;
  272.                 iInfoZone[playerid][ZONE_ACTION] = false;
  273.                 iInfoZone[playerid][ZONE_MODE] = false;
  274.                 iInfoZone[playerid][ZONE_FILE_NAME][0] = '\0';
  275.                 SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}Sistema de creacion de zonas(areas), {F9F9F9}reiniciado!.");
  276.                 fclose(zFiles);
  277.             }
  278.         }
  279.     }
  280.     return false;
  281. }
  282.  
  283. CMD:zone(playerid, params[]){
  284.     if(!iInfoZone[playerid][ZONE_ACTIVE]) iInfoZone[playerid][ZONE_ACTIVE] = true, SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}Sistema de creacion de zonas(areas), {039914}encendido!.");
  285.     else iInfoZone[playerid][ZONE_ACTIVE] = false, SendClientMessage(playerid,-1,"{F9F9F9}INFO: {11B9AB}Sistema de creacion de zonas(areas), {C21010}apagado!.");
  286.     PlayerPlaySound(playerid, 21000, 0,0,0);
  287.     new
  288.         zData[1024];
  289.     strcat(zData, "{C21010}## INSTRUCCIONES DE USO: \n");
  290.     strcat(zData, "{F9F9F9}1)- utiliza el comando '/zone' para encender/apagar el editor de creacion de zonas(areas).\n");
  291.     strcat(zData, "{F9F9F9}2)- utiliza la tecla 'Y' para obtener las cordenadas de la zona, minx/miny/maxx/maxy.\n");
  292.     strcat(zData, "{9F9C9C}# la primera vez presionada la tecla 'Y' obtendas las coordenadas minx | miny.\n");
  293.     strcat(zData, "{9F9C9C}# la segunda vez presionada la tecla 'Y' obtendas las coordenadas maxx | maxy,\n");
  294.     strcat(zData, "{9F9C9C}y podras volver a crear otra zona, los colores son aleatorios(random).\n");
  295.     strcat(zData, "{F9F9F9}3)- utiliza la tecla 'N' para guardar todas las zonas creadas al momento.\n");
  296.     strcat(zData, "{9F9C9C}# (hay dos tipo de archivos, tipo uno: archivo .TXT, tipo dos: archivo .PWN).\n");
  297.     strcat(zData, "{9F9C9C}# (hay dos modos de guardado, modo uno: gangzone por defecto, modo dos: gangzone por streamer.");
  298.     ShowPlayerDialog(playerid,DIALOG_ZONES+3, DIALOG_STYLE_MSGBOX, "{11B9AB}Sistema de creacion de zonas(areas):", zData, "cerrar", "");
  299.     return true;
  300. }
  301.  
  302. public OnFilterScriptInit(){
  303.     AddStaticVehicleEx(471, 2040.3107, 987.3111, 10.6721, -90.0000, random(200), random(200), 999999);
  304.     AddPlayerClass(115,2042.9229,1017.5283,10.6719,110.6819,0,0,0,0,0,0); //
  305.     return true;
  306. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement