Guest User

safaf

a guest
Sep 28th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. ///gangzone capture
  2. forward ZoneTimer();
  3.  
  4. public ZoneTimer()
  5. {
  6. for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones
  7. {
  8. if(ZoneAttacker[i] != -1) // zone is being attacked
  9. {
  10. if(GetPlayersInZone(i, ZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR) // team has enough members in the zone
  11. {
  12. ZoneAttackTime[i]++;
  13. if(ZoneAttackTime[i] == TAKEOVER_TIME) // zone has been under attack for enough time and attackers take over the zone
  14. {
  15. GangZoneStopFlashForAll(ZoneID[i]);
  16. ZoneInfo[i][zTeam] = ZoneAttacker[i];
  17. GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
  18. ZoneAttacker[i] = -1;
  19. }
  20. }
  21. else // attackers failed to take over the zone
  22. {
  23. GangZoneStopFlashForAll(ZoneID[i]);
  24. ZoneAttacker[i] = -1;
  25. }
  26. }
  27. else // check if somebody is attacking
  28. {
  29. for(new t=0; t < sizeof(Teams); t++) // loop all teams
  30. {
  31. if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // if there are enough enemies in the zone
  32. {
  33. ZoneAttacker[i] = Teams[t];
  34. ZoneAttackTime[i] = 0;
  35. GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
  36. }
  37. }
  38. }
  39. }
  40. }
  41. SetTimer("ZoneTimer", 1000, true);
Advertisement
Add Comment
Please, Sign In to add comment