12.11.2011, 08:42
I have a problem.
I used the first method. I followed all the steps. Everything is ok until you start by war, going on rival territory but nothing happens.
Below is what I am introduced to GM for gang wars
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
I used the first method. I followed all the steps. Everything is ok until you start by war, going on rival territory but nothing happens.
Below is what I am introduced to GM for gang wars
1.
pawn Code:
AddPlayerClass(113, 1124.2415, -2037.1274, 69.8847, 269.15, 7, 1, 24, 60, 0, 0);
AddPlayerClass(120, -2192.3020, 646.8816, 49.4375, 269.15, 8, 1, 24, 60, 0, 0);
Code:
#define TEAM_LCN 1 #define TEAM_YAKUZA 2 #define TAKEOVER_TIME 300 #define MIN_MEMBERS_TO_START_WAR 1
Code:
static gTeam[MAX_PLAYERS];
Code:
public SetPlayerTeamFromClass(playerid,classid) { if (classid == 0) { gTeam[playerid] = TEAM_LCN; } else { gTeam[playerid] = TEAM_YAKUZA; } }
Code:
if (gTeam[playerid] == TEAM_LCN) { SetPlayerColor(playerid, COLOR_LCN); } else if (gTeam[playerid] == TEAM_YAKUZA) { SetPlayerColor(playerid, COLOR_YKZ); }
Code:
enum eZone { Float:zMinX, Float:zMinY, Float:zMaxX, Float:zMaxY, zTeam } new ZoneInfo[][eZone] = { {-2263.0850,52.9664,-2355.4988,-178.6447,TEAM_LCN}, // Teritoriu factiunea 1 (LCN) {-2150.3877,313.4182,-2241.1433,102.3497,TEAM_YAKUZA} // Teritoriu factiunea 2 (Yakuza) }; new ZoneID[sizeof(ZoneInfo)];
Code:
for(new i=0; i < sizeof(ZoneInfo); i++) { GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); if(ZoneAttacker[i] != -1) GangZoneFlashForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneAttacker[i])); }
Code:
for(new i=0; i < sizeof(ZoneInfo); i++) { ZoneID[i] = GangZoneCreate(ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY]); }
Code:
stock GetTeamZoneColor(teamid) { switch(teamid) { case TEAM_LCN: return 0x00FF0088; case TEAM_YAKUZA: return 0xFF00FF88; } return -1; }
Code:
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...}; new ZoneAttackTime[sizeof(ZoneInfo)];
Code:
new Teams[] = { TEAM_LCN, TEAM_YAKUZA };
Code:
stock IsPlayerInZone(playerid, zoneid) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); 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) && IsALcn(i) == teamid && IsAYakuza(i) == teamid && IsPlayerInZone(i, zoneid)) { count++; } } return count; }
Code:
SetTimer("ZoneTimer", 1000, true);
Code:
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]) >= MIN_MEMBERS_TO_START_WAR) // team has enough members in the zone { 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; } } else // check if somebody is attacking { for(new t=0; t < sizeof(Teams); t++) // loop all teams { if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // if there are enough enemies in the zone { ZoneAttacker[i] = Teams[t]; ZoneAttackTime[i] = 0; GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i])); } } } } }