Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Para iniciar una guerra, es necesario tener algunos miembros del equipo en zona enemiga.
- Vamos a necesitar un poco de define las funciones y acciones
- //-------------------------------------------------------------------//
- #define TAKEOVER_TIME 120 // los segundos que necesita para tomar el Conquistar la Zona
- #define MIN_MEMBERS_TO_START_WAR 3 // Cuántos miembros del equipo necesitan en una zona para iniciar una guerra
- //---------------ESTO SEGURAMENTE YA LO DEVE TENER PERO CUALQUIER COSA LO PONGO---------//
- //----------- ESTO BA ABAjo de todo -------------//
- new Teams[] = {
- TEAM_GROVE,
- TEAM_BALLAS,
- TEAM_VAGOS
- };
- //----AKA Tenemos que hacer una matriz de todos nuestros equipos para luego usarlo en un bucle. Agregue todos los equipos aquí.-------------//
- stock IsPlayerInZone(playerid, zoneid)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);// LA POSICION
- return (x > ZoneInfo[zoneid][zMinX] && x < ZoneInfo[zoneid][zMaxX] && y > ZoneInfo[zoneid][zMinY] && y < ZoneInfo[zoneid][zMaxY]);
- }
- stock GetPlayersInZone(zoneid, teamid)
- {
- new count;
- for(new i=0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && GetPlayerTeam(i) == teamid && IsPlayerInZone(i, zoneid))
- {
- count++;
- }
- }
- return count;
- }
- //--Establecer un temporizador en OnGameModeInit o en OnFilterScriptInit si usted está haciendo una filterscript.--//
- SetTimer("ZoneTimer", 1000, true);
- //-------------------------------------//
- //---Agregar una función pública para el temporizador (no te olvide que lo transmita)--//
- public ZoneTimer()
- {
- for(new i=0; i < sizeof(ZoneInfo); i++) // bucle todas las zonas
- {
- if(ZoneAttacker[i] != -1) // zona está siendo atacada
- {
- if(GetPlayersInZone(i, ZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR) // equipo tiene suficientes miembros en la zona
- {
- ZoneAttackTime[i]++;
- if(ZoneAttackTime[i] == TAKEOVER_TIME) // zona ha sido objeto de ataques durante el tiempo suficiente y los atacantes tomar el control de la zona
- {
- GangZoneStopFlashForAll(ZoneID[i]);
- ZoneInfo[i][zTeam] = ZoneAttacker[i];
- GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // actualizar el color de la zona para nuevo equipo
- ZoneAttacker[i] = -1;
- }
- }
- else // atacantes no lograron tomar el control de la zona
- {
- GangZoneStopFlashForAll(ZoneID[i]);
- ZoneAttacker[i] = -1;
- }
- }
- else // comprobar si alguien está atacando
- {
- for(new t=0; t < sizeof(Teams); t++) // bucle de todos los equipos
- {
- if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // si hay suficientes enemigos en la zona
- {
- ZoneAttacker[i] = Teams[t];
- ZoneAttackTime[i] = 0;
- GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
- }
- }
- }
- }
- }
- //---BUENO ESTO SERIA CONKISTAR LAS ZONA CON TAN SOLO ESPERAR LOS MINUTOS NESESARIO EN LA ZONA---------//
- --------------------------------------------------------------------------------------------------------
- --------------------------------------------------------------------------------------------------------
- --------------------------------------------------------------------------------------------------------
- BUENO AHORA ESTE PARTE ES PARA LA OTRA MANERA DE CONKISTAR LA ZONA...
- conkistar las zona matando a lo otros GRUPOS.!
- //---------------------------------------------//
- Para iniciar una guerra, tienes que matar a algunos enemigos en zona enemiga.
- #define TAKEOVER_TIME 120 // los segundos que necesita para tomar el control de la zona
- #define MIN_DEATHS_TO_START_WAR 3 // Cuántos miembros del equipo deben ser asesinados en una zona para comenzar una guerra
- //----------------------------------------------//
- Establecer un temporizador en OnGameModeInit o en OnFilterScriptInit si usted está haciendo una filterscript.
- SetTimer("ZoneTimer", 1000, true);
- //----------------------------------------------//
- Agregar una función pública para el temporizador
- public ZoneTimer()
- {
- for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones
- {
- if(ZoneAttacker[i] != -1) // zone is being attacked
- {
- if(GetPlayersInZone(i, ZoneAttacker[i]) >= 1) // there must be at least 1 attacker left
- {
- ZoneAttackTime[i]++;
- if(ZoneAttackTime[i] == TAKEOVER_TIME) // zone has been under attack for enough time and attackers take over the zone
- {
- GangZoneStopFlashForAll(ZoneID[i]);
- ZoneInfo[i][zTeam] = ZoneAttacker[i];
- GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
- ZoneAttacker[i] = -1;
- }
- }
- else // attackers failed to take over the zone
- {
- GangZoneStopFlashForAll(ZoneID[i]);
- ZoneAttacker[i] = -1;
- }
- }
- }
- }
- //------------------------------------------//
- Ahora necesitamos desencadenar el ataque en OnPlayerDeath
- if(IsPlayerConnected(killerid) && GetPlayerTeam(playerid) != GetPlayerTeam(killerid)) // not a suicide or team kill
- {
- new zoneid = GetPlayerZone(playerid);
- if(zoneid != -1 && ZoneInfo[zoneid][zTeam] == GetPlayerTeam(playerid)) // zone member has been killed in the zone
- {
- ZoneDeaths[zoneid]++;
- if(ZoneDeaths[zoneid] == MIN_DEATHS_TO_START_WAR)
- {
- ZoneDeaths[zoneid] = 0;
- ZoneAttacker[zoneid] = GetPlayerTeam(killerid);
- ZoneAttackTime[zoneid] = 0;
- GangZoneFlashForAll(ZoneID[zoneid], GetTeamZoneColor(ZoneAttacker[zoneid]));
- }
- }
- }
- //-----------------------------------------//.
- También tenemos una ZoneDeaths variable global y la función GetPlayerZone.
- new ZoneDeaths[sizeof(ZoneInfo)];
- //----------------------------------------//
- stock GetPlayerZone(playerid)
- {
- for(new i=0; i < sizeof(ZoneInfo); i++)
- {
- if(IsPlayerInZone(playerid, i))
- {
- return i;
- }
- }
- return -1;
- }
- BUENO Y ESTO ES TODO PARA LAS CONKISTAS DE LAS ZONAS PARA Gang Zone Wars
- ESPERO QUE LES SIRVAN.
- ATTE:[LE]ChamChimSabelo
Add Comment
Please, Sign In to add comment