Guest User

Untitled

a guest
Sep 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.59 KB | None | 0 0
  1. Para iniciar una guerra, es necesario tener algunos miembros del equipo en zona enemiga.
  2. Vamos a necesitar un poco de define las funciones y acciones
  3. //-------------------------------------------------------------------//
  4. #define TAKEOVER_TIME 120 // los segundos que necesita para tomar el Conquistar la Zona
  5. #define MIN_MEMBERS_TO_START_WAR 3 // Cuántos miembros del equipo necesitan en una zona para iniciar una guerra
  6. //---------------ESTO SEGURAMENTE YA LO DEVE TENER PERO CUALQUIER COSA LO PONGO---------//
  7. //----------- ESTO BA ABAjo de todo -------------//
  8. new Teams[] = {
  9. TEAM_GROVE,
  10. TEAM_BALLAS,
  11. TEAM_VAGOS
  12. };
  13. //----AKA Tenemos que hacer una matriz de todos nuestros equipos para luego usarlo en un bucle. Agregue todos los equipos aquí.-------------//
  14. stock IsPlayerInZone(playerid, zoneid)
  15. {
  16. new Float:x, Float:y, Float:z;
  17. GetPlayerPos(playerid, x, y, z);// LA POSICION
  18. return (x > ZoneInfo[zoneid][zMinX] && x < ZoneInfo[zoneid][zMaxX] && y > ZoneInfo[zoneid][zMinY] && y < ZoneInfo[zoneid][zMaxY]);
  19. }
  20.  
  21. stock GetPlayersInZone(zoneid, teamid)
  22. {
  23. new count;
  24. for(new i=0; i < MAX_PLAYERS; i++)
  25. {
  26. if(IsPlayerConnected(i) && GetPlayerTeam(i) == teamid && IsPlayerInZone(i, zoneid))
  27. {
  28. count++;
  29. }
  30. }
  31. return count;
  32. }
  33. //--Establecer un temporizador en OnGameModeInit o en OnFilterScriptInit si usted está haciendo una filterscript.--//
  34. SetTimer("ZoneTimer", 1000, true);
  35. //-------------------------------------//
  36. //---Agregar una función pública para el temporizador (no te olvide que lo transmita)--//
  37.  
  38. public ZoneTimer()
  39. {
  40. for(new i=0; i < sizeof(ZoneInfo); i++) // bucle todas las zonas
  41. {
  42. if(ZoneAttacker[i] != -1) // zona está siendo atacada
  43. {
  44. if(GetPlayersInZone(i, ZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR) // equipo tiene suficientes miembros en la zona
  45. {
  46. ZoneAttackTime[i]++;
  47. if(ZoneAttackTime[i] == TAKEOVER_TIME) // zona ha sido objeto de ataques durante el tiempo suficiente y los atacantes tomar el control de la zona
  48. {
  49. GangZoneStopFlashForAll(ZoneID[i]);
  50. ZoneInfo[i][zTeam] = ZoneAttacker[i];
  51. GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // actualizar el color de la zona para nuevo equipo
  52. ZoneAttacker[i] = -1;
  53. }
  54. }
  55. else // atacantes no lograron tomar el control de la zona
  56. {
  57. GangZoneStopFlashForAll(ZoneID[i]);
  58. ZoneAttacker[i] = -1;
  59. }
  60. }
  61. else // comprobar si alguien está atacando
  62. {
  63. for(new t=0; t < sizeof(Teams); t++) // bucle de todos los equipos
  64. {
  65. if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // si hay suficientes enemigos en la zona
  66. {
  67. ZoneAttacker[i] = Teams[t];
  68. ZoneAttackTime[i] = 0;
  69. GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
  70. }
  71. }
  72. }
  73. }
  74. }
  75. //---BUENO ESTO SERIA CONKISTAR LAS ZONA CON TAN SOLO ESPERAR LOS MINUTOS NESESARIO EN LA ZONA---------//
  76. --------------------------------------------------------------------------------------------------------
  77. --------------------------------------------------------------------------------------------------------
  78. --------------------------------------------------------------------------------------------------------
  79. BUENO AHORA ESTE PARTE ES PARA LA OTRA MANERA DE CONKISTAR LA ZONA...
  80. conkistar las zona matando a lo otros GRUPOS.!
  81. //---------------------------------------------//
  82. Para iniciar una guerra, tienes que matar a algunos enemigos en zona enemiga.
  83. #define TAKEOVER_TIME 120 // los segundos que necesita para tomar el control de la zona
  84. #define MIN_DEATHS_TO_START_WAR 3 // Cuántos miembros del equipo deben ser asesinados en una zona para comenzar una guerra
  85. //----------------------------------------------//
  86. Establecer un temporizador en OnGameModeInit o en OnFilterScriptInit si usted está haciendo una filterscript.
  87.  
  88. SetTimer("ZoneTimer", 1000, true);
  89. //----------------------------------------------//
  90. Agregar una función pública para el temporizador
  91. public ZoneTimer()
  92. {
  93. for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones
  94. {
  95. if(ZoneAttacker[i] != -1) // zone is being attacked
  96. {
  97. if(GetPlayersInZone(i, ZoneAttacker[i]) >= 1) // there must be at least 1 attacker left
  98. {
  99. ZoneAttackTime[i]++;
  100. if(ZoneAttackTime[i] == TAKEOVER_TIME) // zone has been under attack for enough time and attackers take over the zone
  101. {
  102. GangZoneStopFlashForAll(ZoneID[i]);
  103. ZoneInfo[i][zTeam] = ZoneAttacker[i];
  104. GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
  105. ZoneAttacker[i] = -1;
  106. }
  107. }
  108. else // attackers failed to take over the zone
  109. {
  110. GangZoneStopFlashForAll(ZoneID[i]);
  111. ZoneAttacker[i] = -1;
  112. }
  113. }
  114. }
  115. }
  116. //------------------------------------------//
  117. Ahora necesitamos desencadenar el ataque en OnPlayerDeath
  118.  
  119. if(IsPlayerConnected(killerid) && GetPlayerTeam(playerid) != GetPlayerTeam(killerid)) // not a suicide or team kill
  120. {
  121. new zoneid = GetPlayerZone(playerid);
  122. if(zoneid != -1 && ZoneInfo[zoneid][zTeam] == GetPlayerTeam(playerid)) // zone member has been killed in the zone
  123. {
  124. ZoneDeaths[zoneid]++;
  125. if(ZoneDeaths[zoneid] == MIN_DEATHS_TO_START_WAR)
  126. {
  127. ZoneDeaths[zoneid] = 0;
  128. ZoneAttacker[zoneid] = GetPlayerTeam(killerid);
  129. ZoneAttackTime[zoneid] = 0;
  130. GangZoneFlashForAll(ZoneID[zoneid], GetTeamZoneColor(ZoneAttacker[zoneid]));
  131. }
  132. }
  133. }
  134. //-----------------------------------------//.
  135. También tenemos una ZoneDeaths variable global y la función GetPlayerZone.
  136.  
  137. new ZoneDeaths[sizeof(ZoneInfo)];
  138. //----------------------------------------//
  139.  
  140. stock GetPlayerZone(playerid)
  141. {
  142. for(new i=0; i < sizeof(ZoneInfo); i++)
  143. {
  144. if(IsPlayerInZone(playerid, i))
  145. {
  146. return i;
  147. }
  148. }
  149. return -1;
  150. }
  151.  
  152. BUENO Y ESTO ES TODO PARA LAS CONKISTAS DE LAS ZONAS PARA Gang Zone Wars
  153. ESPERO QUE LES SIRVAN.
  154. ATTE:[LE]ChamChimSabelo
Add Comment
Please, Sign In to add comment