10.06.2016, 14:12
(
Последний раз редактировалось karoliko; 10.06.2016 в 17:58.
)
Hello i have gang wars system and it work perfectly, but i want to the gang zone conquist start only if there arenґt enemy players, i have 4 teams.
code
Teams
code
Код:
CallBack: ZoneUpdate() { for(new z=0; z < MAX_ZONES; z++) { if(ZoneTakeOverTeam[z] == -1) { for(new t=0; t < MAX_TEAMS; t++) { if(t == ZoneInfo[z][z_team]) continue; if(GetMembersInZone(z, t) >= 1) { ZoneTakeOverTeam[z] = t; GangZoneFlashForAll(ZoneInfo[z][z_id], GetTeamColor(t)); ZoneTakeOverTime[z] = 0; for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { PlayerConquista( i ); } } } } } } for(new z=0; z < MAX_ZONES; z++) { if(ZoneTakeOverTeam[z] != -1) { if(GetMembersInZone(z, ZoneTakeOverTeam[z]) >= 1) { ZoneTakeOverTime[z]++; if(ZoneTakeOverTime[z] >= 5)//Parpadeos { GangZoneStopFlashForAll(ZoneInfo[z][z_id]); GangZoneShowForAll(ZoneInfo[z][z_id], GetTeamColor(ZoneTakeOverTeam[z])); ZoneInfo[z][z_team] = ZoneTakeOverTeam[z]; for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(GetPlayerZone(i) == z && Equipo[i] == ZoneTakeOverTeam[z]) { PlayerWinZone( i ); } } } ZoneTakeOverTeam[z] = -1; ZoneTakeOverTime[z] = 0; } } else { ZoneTakeOverTeam[z] = -1; GangZoneStopFlashForAll(ZoneInfo[z][z_id]); ZoneTakeOverTime[z] = 0; } } } }
Код:
// * [ { TEAMґS } ] * // #define TEAM_GROVE (1) #define TEAM_BALLAS (2) #define TEAM_VAGOS (3) #define TEAM_AZTECAZ (4)
Код:
GetMembersInZone(zoneid, team) { new count = 0; new Float:px, Float:py, Float:pz; for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(GetPlayerState(i) != PLAYER_STATE_WASTED && Equipo[i] == team) { GetPlayerPos(i, px, py, pz); if(px > ZoneInfo[zoneid][z_minx] && py > ZoneInfo[zoneid][z_miny] && px < ZoneInfo[zoneid][z_maxx] && py < ZoneInfo[zoneid][z_maxy]) { count++; } } } } return count; }