Advertisement
Andinho_

CriarGz

Jun 11th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 11.63 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define MAX_GZS 200
  4.  
  5. #define MAPA_LIMITE_X 3800.0
  6. #define MAPA_LIMITE_Y 3800.0
  7.  
  8. enum puts
  9. {
  10.     gzExiste,
  11.     gzTipo,
  12.     Float:gzRaio,
  13.     Float:gzX,
  14.     Float:gzY,
  15.     gzGZs[4],
  16.     gzGZsExiste[4]
  17.  
  18. }
  19. new GZ[MAX_GZS][puts];
  20.  
  21.  
  22.  
  23. /*
  24. native PararDePiscarGzParaPlayer(playerid, gz);
  25. native PararDePiscarGzParaTodos(gz);
  26. native PiscarGzParaPlayer(playerid, gz, cor);
  27. native PiscarGzParaTodos(gz, cor);
  28. native EsconderGzParaPlayer(playerid, gz);
  29. native EsconderGzParaTodos(gz);
  30. native MostrarGzParaPlayer(playerid, gz, cor);
  31. native MostrarGzParaTodos(gz, cor);
  32. native DestruirTodasGz();
  33. native DestruirGz(gz);
  34. native CriarGz(Float:Xx, Float:Yy, Float: Raio, Tipo);
  35. */
  36.  
  37. stock PararDePiscarGzParaPlayer(playerid, gz)
  38. {
  39.     if(IsPlayerConnected(playerid))
  40.     {
  41.         if(gz < 0  || gz >= MAX_GZ) return -1;
  42.         if(GZ[gz][gzExiste] == 1)
  43.         {
  44.             if(GZ[gz][gzGZsExiste][0] == 1) GangZoneStopFlashForPlayer(playerid, GZ[gz][gzGZs][0]);
  45.             if(GZ[gz][gzGZsExiste][1] == 1) GangZoneStopFlashForPlayer(playerid, GZ[gz][gzGZs][1]);
  46.             if(GZ[gz][gzGZsExiste][2] == 1) GangZoneStopFlashForPlayer(playerid, GZ[gz][gzGZs][2]);
  47.             if(GZ[gz][gzGZsExiste][3] == 1) GangZoneStopFlashForPlayer(playerid, GZ[gz][gzGZs][3]);
  48.             return 1;
  49.         }
  50.     }
  51.     return 0;
  52. }
  53.  
  54. stock PararDePiscarGzParaTodos(gz)
  55. {
  56.     new ex;
  57.     for(new isa; isa <MAX_PLAYERS; isa++)
  58.     {
  59.         if(IsPlayerConnected(isa))
  60.         {
  61.             if(gz < 1  || gz > MAX_GZS-1) return -1;
  62.             if(GZ[gz][gzExiste] == 1)
  63.             {
  64.                 ex = 1;
  65.                 if(GZ[gz][gzGZsExiste][0] == 1) GangZoneStopFlashForPlayer(isa, GZ[gz][gzGZs][0]);
  66.                 if(GZ[gz][gzGZsExiste][1] == 1) GangZoneStopFlashForPlayer(isa, GZ[gz][gzGZs][1]);
  67.                 if(GZ[gz][gzGZsExiste][2] == 1) GangZoneStopFlashForPlayer(isa, GZ[gz][gzGZs][2]);
  68.                 if(GZ[gz][gzGZsExiste][3] == 1) GangZoneStopFlashForPlayer(isa, GZ[gz][gzGZs][3]);
  69.             }
  70.         }
  71.     }
  72.     return 0;
  73. }
  74.  
  75. stock PiscarGzParaPlayer(playerid, gz, cor)
  76. {
  77.     if(IsPlayerConnected(playerid))
  78.     {
  79.         if(gz < 1  || gz > MAX_GZS-1) return -1;
  80.         if(GZ[gz][gzExiste] == 1)
  81.         {
  82.             if(GZ[gz][gzGZsExiste][0] == 1) GangZoneFlashForPlayer(playerid, GZ[gz][gzGZs][0], cor);
  83.             if(GZ[gz][gzGZsExiste][1] == 1) GangZoneFlashForPlayer(playerid, GZ[gz][gzGZs][1], cor);
  84.             if(GZ[gz][gzGZsExiste][2] == 1) GangZoneFlashForPlayer(playerid, GZ[gz][gzGZs][2], cor);
  85.             if(GZ[gz][gzGZsExiste][3] == 1) GangZoneFlashForPlayer(playerid, GZ[gz][gzGZs][3], cor);
  86.             return 1;
  87.         }
  88.     }
  89.     return 0;
  90. }
  91.  
  92. stock PiscarGzParaTodos(gz, cor)
  93. {
  94.     new ex;
  95.     for(new isa; isa <MAX_PLAYERS; isa++)
  96.     {
  97.         if(IsPlayerConnected(isa))
  98.         {
  99.             if(gz < 1  || gz > MAX_GZS-1) return -1;
  100.             if(GZ[gz][gzExiste] == 1)
  101.             {
  102.                 ex = 1;
  103.                 if(GZ[gz][gzGZsExiste][0] == 1) GangZoneFlashForPlayer(isa, GZ[gz][gzGZs][0], cor);
  104.                 if(GZ[gz][gzGZsExiste][1] == 1) GangZoneFlashForPlayer(isa, GZ[gz][gzGZs][1], cor);
  105.                 if(GZ[gz][gzGZsExiste][2] == 1) GangZoneFlashForPlayer(isa, GZ[gz][gzGZs][2], cor);
  106.                 if(GZ[gz][gzGZsExiste][3] == 1) GangZoneFlashForPlayer(isa, GZ[gz][gzGZs][3], cor);
  107.             }
  108.         }
  109.     }
  110.     return ex;
  111. }
  112.  
  113.  
  114. stock EsconderGzParaPlayer(playerid, gz)
  115. {
  116.     if(IsPlayerConnected(playerid))
  117.     {
  118.         if(gz < 1  || gz > MAX_GZS-1) return -1;
  119.         if(GZ[gz][gzExiste] == 1)
  120.         {
  121.             if(GZ[gz][gzGZsExiste][0] == 1) GangZoneHideForPlayer(playerid, GZ[gz][gzGZs][0]);
  122.             if(GZ[gz][gzGZsExiste][1] == 1) GangZoneHideForPlayer(playerid, GZ[gz][gzGZs][1]);
  123.             if(GZ[gz][gzGZsExiste][2] == 1) GangZoneHideForPlayer(playerid, GZ[gz][gzGZs][2]);
  124.             if(GZ[gz][gzGZsExiste][3] == 1) GangZoneHideForPlayer(playerid, GZ[gz][gzGZs][3]);
  125.             return 1;
  126.         }
  127.     }
  128.     return 0;
  129. }
  130.  
  131.  
  132. stock EsconderGzParaTodos(gz)
  133. {
  134.     new ex;
  135.     for(new isa; isa <MAX_PLAYERS; isa++)
  136.     {
  137.         if(IsPlayerConnected(isa))
  138.         {
  139.             if(gz < 1  || gz > MAX_GZS-1) return -1;
  140.             if(GZ[gz][gzExiste] == 1)
  141.             {
  142.                 ex = 1;
  143.                 if(GZ[gz][gzGZsExiste][0] == 1) GangZoneHideForPlayer(isa, GZ[gz][gzGZs][0]);
  144.                 if(GZ[gz][gzGZsExiste][1] == 1) GangZoneHideForPlayer(isa, GZ[gz][gzGZs][1]);
  145.                 if(GZ[gz][gzGZsExiste][2] == 1) GangZoneHideForPlayer(isa, GZ[gz][gzGZs][2]);
  146.                 if(GZ[gz][gzGZsExiste][3] == 1) GangZoneHideForPlayer(isa, GZ[gz][gzGZs][3]);
  147.             }
  148.         }
  149.     }
  150.     return ex;
  151. }
  152.  
  153. stock MostrarGzParaPlayer(playerid, gz, cor)
  154. {
  155.     if(IsPlayerConnected(playerid))
  156.     {
  157.         if(gz < 1  || gz > MAX_GZS-1) return -1;
  158.         if(GZ[gz][gzExiste] == 1)
  159.         {
  160.             if(GZ[gz][gzGZsExiste][0] == 1) GangZoneShowForPlayer(playerid, GZ[gz][gzGZs][0], cor);
  161.             if(GZ[gz][gzGZsExiste][1] == 1) GangZoneShowForPlayer(playerid, GZ[gz][gzGZs][1], cor);
  162.             if(GZ[gz][gzGZsExiste][2] == 1) GangZoneShowForPlayer(playerid, GZ[gz][gzGZs][2], cor);
  163.             if(GZ[gz][gzGZsExiste][3] == 1) GangZoneShowForPlayer(playerid, GZ[gz][gzGZs][3], cor);
  164.             return 1;
  165.         }
  166.     }
  167.     return 0;
  168. }
  169.  
  170. stock MostrarGzParaTodos(gz, cor)
  171. {
  172.     new ex;
  173.     for(new isa; isa <MAX_PLAYERS; isa++)
  174.     {
  175.         if(IsPlayerConnected(isa))
  176.         {
  177.             if(gz < 1  || gz > MAX_GZS-1) return -1;
  178.             if(GZ[gz][gzExiste] == 1)
  179.             {
  180.                 ex = 1;
  181.                 if(GZ[gz][gzGZsExiste][0] == 1) GangZoneShowForPlayer(isa, GZ[gz][gzGZs][0], cor);
  182.                 if(GZ[gz][gzGZsExiste][1] == 1) GangZoneShowForPlayer(isa, GZ[gz][gzGZs][1], cor);
  183.                 if(GZ[gz][gzGZsExiste][2] == 1) GangZoneShowForPlayer(isa, GZ[gz][gzGZs][2], cor);
  184.                 if(GZ[gz][gzGZsExiste][3] == 1) GangZoneShowForPlayer(isa, GZ[gz][gzGZs][3], cor);
  185.             }
  186.         }
  187.     }
  188.     return ex;
  189. }
  190.  
  191.  
  192.  
  193. stock DestruirTodasGz()
  194. {
  195.     for(new gz=1; gz < MAX_GZS; gz ++)
  196.     {
  197.         if(GZ[gz][gzExiste] == 1)
  198.         {
  199.             if(GZ[gz][gzGZsExiste][0] == 1) GangZoneDestroy(GZ[gz][gzGZs][0]),GZ[gz][gzGZsExiste][0] = 0;
  200.             if(GZ[gz][gzGZsExiste][1] == 1) GangZoneDestroy(GZ[gz][gzGZs][1]),GZ[gz][gzGZsExiste][1] = 0;
  201.             if(GZ[gz][gzGZsExiste][2] == 1) GangZoneDestroy(GZ[gz][gzGZs][2]),GZ[gz][gzGZsExiste][2] = 0;
  202.             if(GZ[gz][gzGZsExiste][3] == 1) GangZoneDestroy(GZ[gz][gzGZs][3]),GZ[gz][gzGZsExiste][3] = 0;
  203.             GZ[gz][gzExiste] = 0;
  204.         }
  205.     }
  206.     return -1;
  207. }
  208.  
  209. stock DestruirGz(gzs)
  210. {
  211.     if(gzs < 0  || gzs >= MAX_GZS) return -1;
  212.     if(GZ[gzs][gzExiste] == 1)
  213.     {
  214.         if(GZ[gzs][gzGZsExiste][0] == 1) GangZoneDestroy(GZ[gzs][gzGZs][0]),GZ[gzs][gzGZsExiste][0] = 0;
  215.         if(GZ[gzs][gzGZsExiste][1] == 1) GangZoneDestroy(GZ[gzs][gzGZs][1]),GZ[gzs][gzGZsExiste][1] = 0;
  216.         if(GZ[gzs][gzGZsExiste][2] == 1) GangZoneDestroy(GZ[gzs][gzGZs][2]),GZ[gzs][gzGZsExiste][2] = 0;
  217.         if(GZ[gzs][gzGZsExiste][3] == 1) GangZoneDestroy(GZ[gzs][gzGZs][3]),GZ[gzs][gzGZsExiste][3] = 0;
  218.         GZ[gzs][gzExiste] = 0;
  219.     }
  220.     return -1;
  221. }
  222.  
  223. stock CriarGz(Float:Xx, Float:Yy, Float: Raio, Tipo)
  224. {
  225.     new Float:cords[4];
  226.  
  227.     for(new gz=1; gz < MAX_GZS; gz ++)
  228.     {
  229.         if(GZ[gz][gzExiste] == 0)
  230.         {
  231.             if(Tipo == 0) // normal
  232.             {
  233.                 GZ[gz][gzExiste] = 1;
  234.                 cords[0] = Xx-Raio;
  235.                 if(cords[0] <= MAPA_LIMITE_X*-1.0) cords[0] = (MAPA_LIMITE_X*-1.0)+1;
  236.                 cords[1] = Yy-Raio;
  237.                 if(cords[1] <= MAPA_LIMITE_Y*-1.0) cords[1] = (MAPA_LIMITE_Y*-1.0)+1;
  238.                 cords[2] = Xx+Raio;
  239.                 if(cords[2] >= MAPA_LIMITE_X) cords[2] = MAPA_LIMITE_X-1;
  240.                 cords[3] = Yy+Raio;
  241.                 if(cords[3] >= MAPA_LIMITE_Y) cords[3] = MAPA_LIMITE_Y-1;
  242.                 GZ[gz][gzGZs][0] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  243.                 GZ[gz][gzGZsExiste][0] = 1;
  244.                 GZ[gz][gzGZsExiste][1] = 0;
  245.                 GZ[gz][gzGZsExiste][2] = 0;
  246.                 GZ[gz][gzGZsExiste][3] = 0;
  247.             }
  248.  
  249.             if(Tipo == 1) // vazio
  250.             {
  251.                 GZ[gz][gzExiste] = 1;
  252.  
  253.                 cords[0] = MAPA_LIMITE_X*-1.0;
  254.                 cords[1] = MAPA_LIMITE_Y*-1.0;
  255.                 cords[2] = Xx-Raio;
  256.                 if(cords[2] <= cords[0])cords[2] = cords[0]+1;
  257.                 cords[3] = MAPA_LIMITE_Y;
  258.                 GZ[gz][gzGZs][0] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  259.                 GZ[gz][gzGZsExiste][0] = 1;
  260.  
  261.                 cords[0] = Xx+Raio;
  262.                 if(cords[0] >= MAPA_LIMITE_X)cords[0] = (MAPA_LIMITE_X)-1;
  263.                 cords[1] = MAPA_LIMITE_Y*-1.0;
  264.                 cords[2] = MAPA_LIMITE_X;
  265.                 cords[3] = MAPA_LIMITE_Y;
  266.                 GZ[gz][gzGZs][1] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  267.                 GZ[gz][gzGZsExiste][1] = 1;
  268.  
  269.                 cords[0] = Xx-Raio;
  270.                 if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1;
  271.                 cords[1] = Yy+Raio;
  272.                 if(cords[1] >= MAPA_LIMITE_Y)cords[1] = (MAPA_LIMITE_Y)-1;
  273.                 cords[2] = Xx+Raio;
  274.                 if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1;
  275.                 cords[3] = MAPA_LIMITE_Y;
  276.                 GZ[gz][gzGZs][2] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  277.                 GZ[gz][gzGZsExiste][2] = 1;
  278.  
  279.                 cords[0] = Xx-Raio;
  280.                 if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1;
  281.                 cords[1] = MAPA_LIMITE_Y*-1.0;
  282.                 cords[2] = Xx+Raio;
  283.                 if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1;
  284.                 cords[3] = Yy-Raio;
  285.                 if(cords[3] <= MAPA_LIMITE_Y*-1.0)cords[3] = (MAPA_LIMITE_Y*-1.0)+1;
  286.                 GZ[gz][gzGZs][3] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  287.                 GZ[gz][gzGZsExiste][3] = 1;
  288.  
  289.             }
  290.  
  291.             if(Tipo == 2) // circunferencia
  292.             {
  293.                 GZ[gz][gzExiste] = 1;
  294.  
  295.                 cords[0] = Xx-Raio;
  296.                 if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1;
  297.                 cords[1] = Yy-Raio;
  298.                 if(cords[1] <= MAPA_LIMITE_Y*-1.0)cords[1] = (MAPA_LIMITE_Y*-1.0)+1;
  299.                 cords[2] = cords[0]+10;
  300.                 cords[3] = Yy+Raio;
  301.                 if(cords[1] >= MAPA_LIMITE_Y)cords[1] = (MAPA_LIMITE_Y)-1;
  302.                 GZ[gz][gzGZs][0] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  303.                 GZ[gz][gzGZsExiste][0] = 1;
  304.  
  305.                 cords[2] = Xx+Raio;
  306.                 if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1;
  307.                 cords[0] = cords[2]-10;
  308.                 cords[3] = Yy+Raio;
  309.                 if(cords[2] >= MAPA_LIMITE_Y)cords[2] = (MAPA_LIMITE_Y)-1;
  310.                 cords[1] = Yy-Raio;
  311.                 if(cords[1] <= MAPA_LIMITE_Y*-1.0)cords[1] = (MAPA_LIMITE_Y*-1.0)+1;
  312.                 GZ[gz][gzGZs][1] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  313.                 GZ[gz][gzGZsExiste][1] = 1;
  314.  
  315.                 cords[0] = Xx-Raio+10;
  316.                 if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1+10;
  317.                 cords[2] = Xx+Raio-10;
  318.                 if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1-10;
  319.                 cords[3] = Yy+Raio;
  320.                 if(cords[3] >= MAPA_LIMITE_Y)cords[3] = (MAPA_LIMITE_Y)-1;
  321.                 cords[1] = cords[3]-10;
  322.                 GZ[gz][gzGZs][2] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  323.                 GZ[gz][gzGZsExiste][2] = 1;
  324.  
  325.                 cords[0] = Xx-Raio+10;
  326.                 if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1+10;
  327.                 cords[2] = Xx+Raio-10;
  328.                 if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1-10;
  329.                 cords[1] = Yy-Raio;
  330.                 if(cords[1] <= MAPA_LIMITE_Y*-1.0)cords[1] = (MAPA_LIMITE_Y*-1.0)+1;
  331.                 cords[3] = cords[1]+10;
  332.                 GZ[gz][gzGZs][3] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
  333.                 GZ[gz][gzGZsExiste][3] = 1;
  334.  
  335.             }
  336.  
  337.             return gz;
  338.         }
  339.     }
  340.     return -1;
  341. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement