Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define MAX_GZS 200
- #define MAPA_LIMITE_X 3800.0
- #define MAPA_LIMITE_Y 3800.0
- enum puts
- {
- gzExiste,
- gzTipo,
- Float:gzRaio,
- Float:gzX,
- Float:gzY,
- gzGZs[4],
- gzGZsExiste[4]
- }
- new GZ[MAX_GZS][puts];
- /*
- native PararDePiscarGzParaPlayer(playerid, gz);
- native PararDePiscarGzParaTodos(gz);
- native PiscarGzParaPlayer(playerid, gz, cor);
- native PiscarGzParaTodos(gz, cor);
- native EsconderGzParaPlayer(playerid, gz);
- native EsconderGzParaTodos(gz);
- native MostrarGzParaPlayer(playerid, gz, cor);
- native MostrarGzParaTodos(gz, cor);
- native DestruirTodasGz();
- native DestruirGz(gz);
- native CriarGz(Float:Xx, Float:Yy, Float: Raio, Tipo);
- */
- stock PararDePiscarGzParaPlayer(playerid, gz)
- {
- if(IsPlayerConnected(playerid))
- {
- if(gz < 0 || gz >= MAX_GZ) return -1;
- if(GZ[gz][gzExiste] == 1)
- {
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneStopFlashForPlayer(playerid, GZ[gz][gzGZs][0]);
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneStopFlashForPlayer(playerid, GZ[gz][gzGZs][1]);
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneStopFlashForPlayer(playerid, GZ[gz][gzGZs][2]);
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneStopFlashForPlayer(playerid, GZ[gz][gzGZs][3]);
- return 1;
- }
- }
- return 0;
- }
- stock PararDePiscarGzParaTodos(gz)
- {
- new ex;
- for(new isa; isa <MAX_PLAYERS; isa++)
- {
- if(IsPlayerConnected(isa))
- {
- if(gz < 1 || gz > MAX_GZS-1) return -1;
- if(GZ[gz][gzExiste] == 1)
- {
- ex = 1;
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneStopFlashForPlayer(isa, GZ[gz][gzGZs][0]);
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneStopFlashForPlayer(isa, GZ[gz][gzGZs][1]);
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneStopFlashForPlayer(isa, GZ[gz][gzGZs][2]);
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneStopFlashForPlayer(isa, GZ[gz][gzGZs][3]);
- }
- }
- }
- return 0;
- }
- stock PiscarGzParaPlayer(playerid, gz, cor)
- {
- if(IsPlayerConnected(playerid))
- {
- if(gz < 1 || gz > MAX_GZS-1) return -1;
- if(GZ[gz][gzExiste] == 1)
- {
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneFlashForPlayer(playerid, GZ[gz][gzGZs][0], cor);
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneFlashForPlayer(playerid, GZ[gz][gzGZs][1], cor);
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneFlashForPlayer(playerid, GZ[gz][gzGZs][2], cor);
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneFlashForPlayer(playerid, GZ[gz][gzGZs][3], cor);
- return 1;
- }
- }
- return 0;
- }
- stock PiscarGzParaTodos(gz, cor)
- {
- new ex;
- for(new isa; isa <MAX_PLAYERS; isa++)
- {
- if(IsPlayerConnected(isa))
- {
- if(gz < 1 || gz > MAX_GZS-1) return -1;
- if(GZ[gz][gzExiste] == 1)
- {
- ex = 1;
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneFlashForPlayer(isa, GZ[gz][gzGZs][0], cor);
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneFlashForPlayer(isa, GZ[gz][gzGZs][1], cor);
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneFlashForPlayer(isa, GZ[gz][gzGZs][2], cor);
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneFlashForPlayer(isa, GZ[gz][gzGZs][3], cor);
- }
- }
- }
- return ex;
- }
- stock EsconderGzParaPlayer(playerid, gz)
- {
- if(IsPlayerConnected(playerid))
- {
- if(gz < 1 || gz > MAX_GZS-1) return -1;
- if(GZ[gz][gzExiste] == 1)
- {
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneHideForPlayer(playerid, GZ[gz][gzGZs][0]);
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneHideForPlayer(playerid, GZ[gz][gzGZs][1]);
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneHideForPlayer(playerid, GZ[gz][gzGZs][2]);
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneHideForPlayer(playerid, GZ[gz][gzGZs][3]);
- return 1;
- }
- }
- return 0;
- }
- stock EsconderGzParaTodos(gz)
- {
- new ex;
- for(new isa; isa <MAX_PLAYERS; isa++)
- {
- if(IsPlayerConnected(isa))
- {
- if(gz < 1 || gz > MAX_GZS-1) return -1;
- if(GZ[gz][gzExiste] == 1)
- {
- ex = 1;
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneHideForPlayer(isa, GZ[gz][gzGZs][0]);
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneHideForPlayer(isa, GZ[gz][gzGZs][1]);
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneHideForPlayer(isa, GZ[gz][gzGZs][2]);
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneHideForPlayer(isa, GZ[gz][gzGZs][3]);
- }
- }
- }
- return ex;
- }
- stock MostrarGzParaPlayer(playerid, gz, cor)
- {
- if(IsPlayerConnected(playerid))
- {
- if(gz < 1 || gz > MAX_GZS-1) return -1;
- if(GZ[gz][gzExiste] == 1)
- {
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneShowForPlayer(playerid, GZ[gz][gzGZs][0], cor);
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneShowForPlayer(playerid, GZ[gz][gzGZs][1], cor);
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneShowForPlayer(playerid, GZ[gz][gzGZs][2], cor);
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneShowForPlayer(playerid, GZ[gz][gzGZs][3], cor);
- return 1;
- }
- }
- return 0;
- }
- stock MostrarGzParaTodos(gz, cor)
- {
- new ex;
- for(new isa; isa <MAX_PLAYERS; isa++)
- {
- if(IsPlayerConnected(isa))
- {
- if(gz < 1 || gz > MAX_GZS-1) return -1;
- if(GZ[gz][gzExiste] == 1)
- {
- ex = 1;
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneShowForPlayer(isa, GZ[gz][gzGZs][0], cor);
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneShowForPlayer(isa, GZ[gz][gzGZs][1], cor);
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneShowForPlayer(isa, GZ[gz][gzGZs][2], cor);
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneShowForPlayer(isa, GZ[gz][gzGZs][3], cor);
- }
- }
- }
- return ex;
- }
- stock DestruirTodasGz()
- {
- for(new gz=1; gz < MAX_GZS; gz ++)
- {
- if(GZ[gz][gzExiste] == 1)
- {
- if(GZ[gz][gzGZsExiste][0] == 1) GangZoneDestroy(GZ[gz][gzGZs][0]),GZ[gz][gzGZsExiste][0] = 0;
- if(GZ[gz][gzGZsExiste][1] == 1) GangZoneDestroy(GZ[gz][gzGZs][1]),GZ[gz][gzGZsExiste][1] = 0;
- if(GZ[gz][gzGZsExiste][2] == 1) GangZoneDestroy(GZ[gz][gzGZs][2]),GZ[gz][gzGZsExiste][2] = 0;
- if(GZ[gz][gzGZsExiste][3] == 1) GangZoneDestroy(GZ[gz][gzGZs][3]),GZ[gz][gzGZsExiste][3] = 0;
- GZ[gz][gzExiste] = 0;
- }
- }
- return -1;
- }
- stock DestruirGz(gzs)
- {
- if(gzs < 0 || gzs >= MAX_GZS) return -1;
- if(GZ[gzs][gzExiste] == 1)
- {
- if(GZ[gzs][gzGZsExiste][0] == 1) GangZoneDestroy(GZ[gzs][gzGZs][0]),GZ[gzs][gzGZsExiste][0] = 0;
- if(GZ[gzs][gzGZsExiste][1] == 1) GangZoneDestroy(GZ[gzs][gzGZs][1]),GZ[gzs][gzGZsExiste][1] = 0;
- if(GZ[gzs][gzGZsExiste][2] == 1) GangZoneDestroy(GZ[gzs][gzGZs][2]),GZ[gzs][gzGZsExiste][2] = 0;
- if(GZ[gzs][gzGZsExiste][3] == 1) GangZoneDestroy(GZ[gzs][gzGZs][3]),GZ[gzs][gzGZsExiste][3] = 0;
- GZ[gzs][gzExiste] = 0;
- }
- return -1;
- }
- stock CriarGz(Float:Xx, Float:Yy, Float: Raio, Tipo)
- {
- new Float:cords[4];
- for(new gz=1; gz < MAX_GZS; gz ++)
- {
- if(GZ[gz][gzExiste] == 0)
- {
- if(Tipo == 0) // normal
- {
- GZ[gz][gzExiste] = 1;
- cords[0] = Xx-Raio;
- if(cords[0] <= MAPA_LIMITE_X*-1.0) cords[0] = (MAPA_LIMITE_X*-1.0)+1;
- cords[1] = Yy-Raio;
- if(cords[1] <= MAPA_LIMITE_Y*-1.0) cords[1] = (MAPA_LIMITE_Y*-1.0)+1;
- cords[2] = Xx+Raio;
- if(cords[2] >= MAPA_LIMITE_X) cords[2] = MAPA_LIMITE_X-1;
- cords[3] = Yy+Raio;
- if(cords[3] >= MAPA_LIMITE_Y) cords[3] = MAPA_LIMITE_Y-1;
- GZ[gz][gzGZs][0] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][0] = 1;
- GZ[gz][gzGZsExiste][1] = 0;
- GZ[gz][gzGZsExiste][2] = 0;
- GZ[gz][gzGZsExiste][3] = 0;
- }
- if(Tipo == 1) // vazio
- {
- GZ[gz][gzExiste] = 1;
- cords[0] = MAPA_LIMITE_X*-1.0;
- cords[1] = MAPA_LIMITE_Y*-1.0;
- cords[2] = Xx-Raio;
- if(cords[2] <= cords[0])cords[2] = cords[0]+1;
- cords[3] = MAPA_LIMITE_Y;
- GZ[gz][gzGZs][0] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][0] = 1;
- cords[0] = Xx+Raio;
- if(cords[0] >= MAPA_LIMITE_X)cords[0] = (MAPA_LIMITE_X)-1;
- cords[1] = MAPA_LIMITE_Y*-1.0;
- cords[2] = MAPA_LIMITE_X;
- cords[3] = MAPA_LIMITE_Y;
- GZ[gz][gzGZs][1] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][1] = 1;
- cords[0] = Xx-Raio;
- if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1;
- cords[1] = Yy+Raio;
- if(cords[1] >= MAPA_LIMITE_Y)cords[1] = (MAPA_LIMITE_Y)-1;
- cords[2] = Xx+Raio;
- if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1;
- cords[3] = MAPA_LIMITE_Y;
- GZ[gz][gzGZs][2] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][2] = 1;
- cords[0] = Xx-Raio;
- if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1;
- cords[1] = MAPA_LIMITE_Y*-1.0;
- cords[2] = Xx+Raio;
- if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1;
- cords[3] = Yy-Raio;
- if(cords[3] <= MAPA_LIMITE_Y*-1.0)cords[3] = (MAPA_LIMITE_Y*-1.0)+1;
- GZ[gz][gzGZs][3] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][3] = 1;
- }
- if(Tipo == 2) // circunferencia
- {
- GZ[gz][gzExiste] = 1;
- cords[0] = Xx-Raio;
- if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1;
- cords[1] = Yy-Raio;
- if(cords[1] <= MAPA_LIMITE_Y*-1.0)cords[1] = (MAPA_LIMITE_Y*-1.0)+1;
- cords[2] = cords[0]+10;
- cords[3] = Yy+Raio;
- if(cords[1] >= MAPA_LIMITE_Y)cords[1] = (MAPA_LIMITE_Y)-1;
- GZ[gz][gzGZs][0] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][0] = 1;
- cords[2] = Xx+Raio;
- if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1;
- cords[0] = cords[2]-10;
- cords[3] = Yy+Raio;
- if(cords[2] >= MAPA_LIMITE_Y)cords[2] = (MAPA_LIMITE_Y)-1;
- cords[1] = Yy-Raio;
- if(cords[1] <= MAPA_LIMITE_Y*-1.0)cords[1] = (MAPA_LIMITE_Y*-1.0)+1;
- GZ[gz][gzGZs][1] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][1] = 1;
- cords[0] = Xx-Raio+10;
- if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1+10;
- cords[2] = Xx+Raio-10;
- if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1-10;
- cords[3] = Yy+Raio;
- if(cords[3] >= MAPA_LIMITE_Y)cords[3] = (MAPA_LIMITE_Y)-1;
- cords[1] = cords[3]-10;
- GZ[gz][gzGZs][2] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][2] = 1;
- cords[0] = Xx-Raio+10;
- if(cords[0] <= MAPA_LIMITE_X*-1.0)cords[0] = (MAPA_LIMITE_X*-1.0)+1+10;
- cords[2] = Xx+Raio-10;
- if(cords[2] >= MAPA_LIMITE_X)cords[2] = (MAPA_LIMITE_X)-1-10;
- cords[1] = Yy-Raio;
- if(cords[1] <= MAPA_LIMITE_Y*-1.0)cords[1] = (MAPA_LIMITE_Y*-1.0)+1;
- cords[3] = cords[1]+10;
- GZ[gz][gzGZs][3] = GangZoneCreate(cords[0],cords[1],cords[2],cords[3]);
- GZ[gz][gzGZsExiste][3] = 1;
- }
- return gz;
- }
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement