Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define BONUS_ZONE_UPDATE_INTERVAL 600
- #define REACTION_TEST_UPDATE_INTERVAL 300
- #define TEMP_BANS_UPDATE_INTERVAL 60
- #define WEATHER_CHANGE_UPDATE_INTERVAL 600
- #define RANDOM_MSG_UPDATE_INTERVAL 180
- #define SUPPLY_DROP_INTERVAL 300
- #define DEBUG(%0) printf(%0) //Comment this and uncomment the next line to stop the debug messages
- //#define DEBUG(%0)
- new Seconds = 0;
- main ()
- {
- TestTimer = 60; //Make a reaction test after 60 seconds after server startup
- StaticTimerEx[bonuszone] = 60; //Make a BZone after 60 seconds after server startup
- SetTimer("ServerTimer",1000,true);
- SetTimer("ServerTimer_10",10000,true);
- }
- ResetPlayer(playerid)
- {
- new tmp = PlayerInfo[playerid][Zone];
- if(tmp != -1)
- {
- if(playerid == ZoneInfo[tmp][zone_Attacker])
- {
- ZoneInfo[tmp][zone_Timer] = -1;
- ZoneInfo[tmp][UnderAttack] = false;
- ZoneInfo[tmp][zone_Attacker] = -1;
- GangZoneStopFlashForAll(ZoneInfo[tmp][zone_Zone]);
- PlayerInfo[playerid][Zone] = -1;
- }
- else ZoneInfo[tmp][zone_Attackers]--, PlayerInfo[playerid][Zone] = -1;
- }
- if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
- if(C4[playerid] != -1) DestroyDynamicObject(C4[playerid]);
- Delete3DTextLabel(PlayerInfo[playerid][Lab]);
- TextDrawDestroy(StatsTD[playerid]);
- TextDrawDestroy(InfoTD[playerid]);
- DestroyCarePackage(playerid);
- for(new s = 0; s < _:timer_info; s++) TimerEx[playerid][timer_info:s] = -1;
- PlayerInfo[playerid][Score] = 0;
- PlayerInfo[playerid][Money] = 0;
- PlayerInfo[playerid][Kills] = 0;
- PlayerInfo[playerid][Deaths] = 0;
- PlayerInfo[playerid][Admin] = 0;
- PlayerInfo[playerid][VIP] = 0;
- PlayerInfo[playerid][License] = 0;
- PlayerInfo[playerid][Clan] = -1;
- PlayerInfo[playerid][ClanRank] = 0;
- PlayerInfo[playerid][DM] = MODE_DEFAULT;
- PlayerInfo[playerid][HQ] = -1;
- PlayerInfo[playerid][AFK] = 0;
- PlayerInfo[playerid][Tank] = -1;
- PlayerInfo[playerid][Team] = 0;
- PlayerInfo[playerid][Spawn] = -1;
- PlayerInfo[playerid][Class] = 0;
- PlayerInfo[playerid][Zone] = -1;
- PlayerInfo[playerid][Base] = -1;
- PlayerInfo[playerid][Rank] = 0;
- PlayerInfo[playerid][Warns][0] = 0;
- PlayerInfo[playerid][Warns][1] = 0;
- PlayerInfo[playerid][Warns][2] = 0;
- PlayerInfo[playerid][Warns][3] = 0;
- PlayerInfo[playerid][Bounty] = 0;
- PlayerInfo[playerid][Vehicle] = -1;
- PlayerInfo[playerid][Muted] = -1;
- PlayerInfo[playerid][Frozen] = -1;
- PlayerInfo[playerid][Jailed] = -1;
- PlayerInfo[playerid][Drone] = -1;
- PlayerInfo[playerid][Medkit] = 0;
- PlayerInfo[playerid][Activity] = 0;
- PlayerInfo[playerid][Attempts] = 0;
- PlayerInfo[playerid][CInvited] = -1;
- PlayerInfo[playerid][OldAdmin] = -1;
- PlayerInfo[playerid][Disguised] = -1;
- PlayerInfo[playerid][Spectating] = -1;
- PlayerInfo[playerid][Lab] = Text3D:INVALID_3DTEXT_ID;
- PlayerInfo[playerid][CP] = false;
- PlayerInfo[playerid][CW] = false;
- PlayerInfo[playerid][SID] = false;
- PlayerInfo[playerid][Hacker] = false;
- PlayerInfo[playerid][Helmet] = false;
- PlayerInfo[playerid][Spec] = false;
- PlayerInfo[playerid][Duty] = false;
- PlayerInfo[playerid][Logged] = false;
- PlayerInfo[playerid][Proccess] = false;
- Prestige[playerid][0] = 0, Prestige[playerid][1] = 0;
- Prestige[playerid][2] = 0, Prestige[playerid][3] = 0;
- Prestige[playerid][4] = 0, Prestige[playerid][5] = 0;
- Duel[playerid][duel_opponent] = -1, Duel[playerid][duel_weapon] = -1;
- Duel[playerid][duel_bet] = -1, Duel[playerid][duel_invited] = -1;
- KillSpree[playerid] = 0;
- DeathSpree[playerid] = 0;
- ZoneSpree[playerid] = 0;
- WarpTime[playerid] = 0;
- WarpVehID[playerid] = -1;
- StateTime[playerid] = -1;
- StateWarn[playerid] = 0;
- C4[playerid] = -1;
- C4Owned[playerid] = false;
- DND[playerid] = false;
- Hidden[playerid] = false;
- banned[playerid] = false;
- conns[playerid] = false;
- PingWarns[playerid] = 0;
- FailPass[playerid] = 0;
- LastDeath[playerid] = -1;
- DeathSpam[playerid] = 0;
- LastPM[playerid] = -1;
- StatsTD[playerid] = Text:INVALID_TEXT_DRAW;
- PlayerInfo[playerid][Connected] = false;
- return 1;
- }
- forward ServerTimer();
- forward ServerTimer_10();
- public ServerTimer_10()
- {
- //These do not rely on Seconds - so no problem in having them in 10 second timer
- static strtd[160];
- if(Weap)
- {
- for(new a = 0; a < MAX_OBJ; a++)
- {
- if(GroundWeapon[a][ObjRespawn] == -1) continue;
- if(Seconds == GroundWeapon[a][ObjRespawn]) continue;
- DestroyDynamicObject(GroundWeapon[a][ObjID]);
- GroundWeapon[a][ObjID] = -1;
- GroundWeapon[a][ObjWeaponID] = -1;
- GroundWeapon[a][ObjAmmo] = 0;
- GroundWeapon[a][ObjPosX] = 0.0;
- GroundWeapon[a][ObjPosY] = 0.0;
- GroundWeapon[a][ObjPosZ] = 0.0;
- GroundWeapon[a][ObjRespawn] = -1;
- }
- }
- for(new x = 0; x < sizeof(Antenna); x++)
- {
- if(Antenna[x][antenna_Spawn] == -1) continue;
- if(Seconds == Antenna[x][antenna_Spawn]) continue;
- DestroyObject(Antenna[x][antenna_Smoke]);
- Antenna[x][antenna_HP] = 100;
- Antenna[x][antenna_Destroyed] = false;
- Antenna[x][antenna_Spawn] = -1;
- format(strtd,sizeof(strtd), "Antenna(%d)\n%d hp", x, Antenna[x][antenna_HP]);
- Update3DTextLabelText(Antenna[x][antenna_Label], 0x009DFFFF, strtd);
- }
- }
- public ServerTimer()
- {
- static strtd[160];
- Seconds++;
- if(Seconds == TestTimer)
- {
- //TestTimer = Seconds = 300;
- TestTimer += REACTION_TEST_UPDATE_INTERVAL; //Will work since Seconds == TestTimer
- switch((TestOn = !TestOn))
- {
- case false:
- {
- SendClientMessageToAll(WEAK_GREEN, "Nobody won the reaction test.");
- //TestChars = "";
- }
- case true:
- {
- new Length = (random(8)+2);
- for(new x = 0; x != Length; x++) TestChars[x] = Characters[random(sizeof(Characters))];
- TestChars[Length] = 0;
- format(strtd, sizeof(strtd), "REACTION TEST! Write '%s' to win rewards.", TestChars);
- SendClientMessageToAll(WEAK_GREEN, strtd);
- }
- }
- }
- if(Seconds == StaticTimerEx[bonuszone])
- {
- for(new x=0; x < sizeof(ZoneInfo); x++) ZoneInfo[x][BonusZone] = false;
- new bonus_zone_id = random(sizeof(ZoneInfo)-1);
- format(strtd,sizeof(strtd), "* Zone %s is now a bonus zone! Capture it for extra rewards!", ZoneInfo[bonus_zone_id][zone_Name]);
- SendClientMessageToAll(WEAK_GREEN, strtd);
- ZoneInfo[bonus_zone_id][zone_Owner] = TEAM_NONE;
- ZoneInfo[bonus_zone_id][zone_Timer] =
- ZoneInfo[bonus_zone_id][zone_Attacker] = -1;
- ZoneInfo[bonus_zone_id][zone_Attackers] = 0;
- ZoneInfo[bonus_zone_id][UnderAttack] = false;
- ZoneInfo[bonus_zone_id][BonusZone] = true;
- GangZoneStopFlashForAll(bonus_zone_id);
- GangZoneHideForAll(bonus_zone_id); // Assumption made
- GangZoneShowForAll(bonus_zone_id, 0xFFFFFFAA); //Assumption Made
- StaticTimerEx[bonuszone] += BONUS_ZONE_UPDATE_INTERVAL;
- }
- if(Seconds == StaticTimerEx[removetempbans])
- {
- RemoveTBans();
- StaticTimerEx[removetempbans] += TEMP_BANS_UPDATE_INTERVAL;
- }
- if(Seconds == StaticTimerEx[lastnuke])
- {
- StaticTimerEx[lastnuke] = -1;
- SendClientMessageToAll(ORANGE, "*** Nuclear weapons are ready for usage.");
- }
- if(Seconds == StaticTimerEx[lastsam])
- {
- StaticTimerEx[lastsam] = -1;
- SendClientMessageToAll(ORANGE, "*** Surface-to-air missiles (SAMs) are ready for usage.");
- }
- if(Seconds == StaticTimerEx[timeweatherchange])
- {
- if(++ServerTime == 25) ServerTime = 0;
- ServerWeather = random(8);
- SetWeather(ServerWeather);
- SetWorldTime(ServerTime);
- StaticTimerEx[timeweatherchange] += WEATHER_CHANGE_UPDATE_INTERVAL;
- }
- if(Seconds == StaticTimerEx[lastmsg])
- {
- SendClientMessageToAll(PINK, RandomMSG[random(sizeof(RandomMSG))]);
- StaticTimerEx[lastmsg] += RANDOM_MSG_UPDATE_INTERVAL;
- }
- if(Seconds == Supply[sSpawn])
- {
- new spawn = random(sizeof(DropSpawn));
- DestroyObject(Supply[sObject]);
- Delete3DTextLabel(Supply[sLab]);
- Supply[sLab] = Text3D:INVALID_3DTEXT_ID;
- Supply[sObject] = CreateObject(18849, DropSpawn[spawn][0], DropSpawn[spawn][1], DropSpawn[spawn][3], 0, 0, 0, 1000.0);
- MoveObject(Supply[sObject], DropSpawn[spawn][0], DropSpawn[spawn][1], DropSpawn[spawn][2], 5, 0, 0, 0);
- Supply[sLab] = Create3DTextLabel("Supply drop\n(/supply)", 0x009DFFFF, DropSpawn[spawn][0], DropSpawn[spawn][1], DropSpawn[spawn][2], 10.0, 0, 1);
- Supply[sSpawn] += SUPPLY_DROP_INTERVAL;
- SendClientMessageToAll(ORANGE, "* A supply drop is landing somewhere in desert! find it and use /supply to get equipment.");
- }
- static Float:X, Float:Y, Float:Z, Float:km;
- foreach(Player, i)
- {
- if(!PlayerInfo[i][Logged]) continue;
- format(strtd,sizeof(strtd), "~y~Rank: ~w~%s - ~y~Score: ~w~%d~n~~g~Kills: ~w~%d - ~r~Deaths: ~w~%d~n~~b~~h~Team: ~w~%s - ~b~~h~Class: ~w~%s", RankName(PlayerInfo[i][Rank]), PlayerInfo[i][Score], PlayerInfo[i][Kills], PlayerInfo[i][Deaths], TeamName(PlayerInfo[i][Team]), ClassName(PlayerInfo[i][Class]));
- TextDrawSetString(StatsTD[i], strtd);
- PlayerInfo[i][AFK]++;
- if(PlayerInfo[i][AFK] < 3)
- {
- if(PlayerInfo[i][Admin] > 0) PlayerInfo[i][Activity]++;
- }
- if(Seconds == TimerEx[i][antispawnkill])
- {
- TimerEx[i][antispawnkill] = -1;
- if(!PlayerInfo[i][Duty])
- {
- switch(PlayerInfo[i][DM])
- {
- case MODE_DEFAULT:
- {
- format(strtd,sizeof(strtd), "%s %s", RankName(PlayerInfo[i][Rank]), ClassName(PlayerInfo[i][Class]));
- Update3DTextLabelText(PlayerInfo[i][Lab], TeamInfo[PlayerInfo[i][Team]][team_color_label], strtd);
- SetPlayerHealth(i, 99.0);
- if(ZoneInfo[16][zone_Owner] == PlayerInfo[i][Team]) SetPlayerArmour(i, 99.0);
- else SetPlayerArmour(i, Ranks[PlayerInfo[i][Rank]][rank_armor]);
- }
- case MODE_DM:
- {
- SetPlayerHealth(i, 99.0), SetPlayerArmour(i, 99.0);
- GivePlayerWeapon(i, 24, 9999);
- GivePlayerWeapon(i, 27, 9999);
- GivePlayerWeapon(i, 34, 9999);
- GivePlayerWeapon(i, 31, 9999);
- Update3DTextLabelText(PlayerInfo[i][Lab], TeamInfo[PlayerInfo[i][Team]][team_color_label], "Deathmatcher");
- }
- case MODE_MINIGUN_DM:
- {
- SetPlayerHealth(i, 99.0), SetPlayerArmour(i, 99.0);
- GivePlayerWeapon(i, 38, 99999);
- Update3DTextLabelText(PlayerInfo[i][Lab], TeamInfo[PlayerInfo[i][Team]][team_color_label], "Minigunner");
- }
- }
- SendClientMessage(i, RED, "Anti spawn kill protection ended.");
- }
- }
- if(Ping != 1)
- {
- if(GetPlayerPing(i) > Ping)
- {
- if(PingWarns[i]++ >= 5)
- {
- format(strtd, sizeof(strtd), ""BOT" has kicked %s(%d). Reason: High ping (%d/%d).", PlayerInfo[i][Name], i, GetPlayerPing(i), Ping);
- SendClientMessageToAll(ARED, strtd);
- SendClientMessage(i, ARED, "You have been kicked from the server. Reason: High ping.");
- KickEx(i);
- }
- }
- }
- new zone = PlayerInfo[i][Zone];
- if(zone != -1)
- {
- if(ZoneInfo[zone][UnderAttack])
- {
- if(ZoneInfo[zone][zone_Timer] > 0)
- {
- if(PlayerInfo[i][AFK] > 15 && ZoneInfo[zone][zone_Attacker] == i)
- {
- format(strtd,sizeof(strtd), ""BOT" has kicked %s(%d). Reason: AFK capture.", PlayerInfo[i][Name], i);
- SendClientMessageToAll(ARED, strtd);
- SendClientMessage(i, ARED, "You have been kicked from the server. Reason: AFK capture.");
- ZoneInfo[zone][zone_Timer] =
- ZoneInfo[zone][zone_Attacker] = -1;
- ZoneInfo[zone][zone_Attackers] = 0;
- ZoneInfo[zone][UnderAttack] = false;
- GangZoneStopFlashForAll(ZoneInfo[zone][zone_Zone]);
- KickEx(i);
- }
- else
- {
- format(strtd,sizeof(strtd), "~w~Capturing... ~r~%d", ZoneInfo[zone][zone_Timer]);
- DisplayInfoTextdraw(i, strtd, 1);
- if(ZoneInfo[zone][zone_Attacker] == i) ZoneInfo[zone][zone_Timer] -= ZoneInfo[zone][zone_Attackers];
- if(ZoneInfo[zone][zone_Timer] <= 0) ZoneCap(ZoneInfo[zone][zone_Attacker]);
- }
- }
- }
- }
- if(Seconds == PlayerInfo[i][Muted])
- {
- SendClientMessage(i, ARED, "You have been chat unmuted.");
- PlayerInfo[i][Muted] = -1;
- }
- if(Seconds == PlayerInfo[i][Frozen])
- {
- SendClientMessage(i, ARED, "You have been unfrozen.");
- PlayerInfo[i][Frozen] = -1;
- TogglePlayerControllable(i, true);
- }
- if(Seconds == PlayerInfo[i][Jailed])
- {
- SendClientMessage(i, ARED, "You have been unjailed.");
- PlayerInfo[i][Jailed] = -1;
- SpawnPlayer(i);
- }
- if(Seconds == TimerEx[i][lastwarned]) TimerEx[i][lastwarned] = -1;
- if(Seconds == TimerEx[i][removeinfotext]) TextDrawHideForPlayer(i, InfoTD[i]), TimerEx[i][removeinfotext] = -1;
- if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !PlayerInfo[i][Duty])
- {
- if(Airveh(GetPlayerVehicleID(i))) continue;
- GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
- if(VectorSize(X,Y,Z) > 1.33333) //240 *0.75 = 180 then 180/135 = 1.333
- {
- format(strtd, sizeof(strtd), "[SERVER]: %s(%d) possible speed hacks.", PlayerInfo[i][Name], i);
- SendAdminMessage(strtd, 0xD10000AA, 1);
- }
- }
- if(GetPlayerAnimationIndex(i))
- {
- new anim = GetPlayerAnimationIndex(i);
- GetPlayerPos(i, X, Y, Z);
- if((anim >= 1538) && (anim <= 1542) && Z > 41)
- {
- format(strtd,sizeof(strtd), "[SERVER]: %s(%d) possible fly hacks.", PlayerInfo[i][Name], i);
- SendAdminMessage(strtd, 0xD10000AA, 1);
- }
- }
- if(Seconds == TimerEx[i][hackcheck])
- {
- if(PlayerInfo[i][AFK] >= 2) TimerEx[i][hackcheck]=Seconds+10;
- else
- {
- GetPlayerCameraFrontVector(i, X,Y,Z);
- if(Z < -0.8)
- {
- PlayerInfo[i][Hacker] = true;
- format(strtd,sizeof(strtd), "[SERVER]: %s(%d) possible misc. hacks.", PlayerInfo[i][Name], i);
- SendAdminMessage(strtd, 0xD10000AA, 1);
- }
- SendClientMessage(i, WHITE, "Processed successfully.");
- PlayerInfo[i][Frozen] =
- TimerEx[i][hackcheck] = -1;
- TogglePlayerControllable(i, true);
- PlayerInfo[i][Proccess] = true;
- }
- }
- }
- return 1;
- }
- forward ZoneCap(playerid);
- public ZoneCap(playerid)
- {
- new zone = PlayerInfo[playerid][Zone];
- DEBUG("Zone Captured PID:%d ZoneID:%d ZoneUnderAttack:%d IsPIDAttacker:%d ImportantZone:%d BonusZone:%d",playerid,zone,ZoneInfo[zone][UnderAttack],ZoneInfo[zone][zone_Attacker] == playerid,ZoneInfo[zone][ImportantZone],ZoneInfo[zone][BonusZone]);
- if(ZoneInfo[zone][UnderAttack])
- {
- new str[70], money;
- if(ZoneInfo[zone][zone_Attacker] == playerid)
- {
- DisplayInfoTextdraw(playerid, "~g~~h~Captured!", 5);
- ZoneInfo[zone][UnderAttack] = false;
- ZoneInfo[zone][zone_Attacker] = -1;
- ZoneInfo[zone][zone_Attackers] = 0;
- ZoneInfo[zone][zone_Timer] = -1;
- GangZoneHideForAll(ZoneInfo[zone][zone_Zone]);
- GangZoneShowForAll(ZoneInfo[zone][zone_Zone], TeamInfo[PlayerInfo[playerid][Team]][team_color]);
- format(str,sizeof(str), "~y~[ZONE] ~w~%s ~g~captured ~w~the %s", TeamName(PlayerInfo[playerid][Team]), ZoneInfo[zone][zone_Name]);
- SendBoxMessage(str);
- money = randomEx(1000, 1500);
- format(str, sizeof(str), "Captured. +3 score and %d$.", money);
- SendClientMessage(playerid, GREEN, str);
- GivePlayerScoreEx(playerid, 3), GivePlayerMoneyEx(playerid, money);
- ZoneSpree[playerid]++;
- switch(ZoneSpree[playerid])
- {
- case 10,15,20,25,30,35,40,45,50,60,70,80,90,100:
- {
- format(str,sizeof(str), "%s(%d) is on a capture spree of %d!", PlayerInfo[playerid][Name], playerid, ZoneSpree[playerid]);
- SendClientMessageToAll(ORANGE, str);
- money = randomEx(1500, 2000);
- GivePlayerScoreEx(playerid, 2), GivePlayerMoneyEx(playerid, money);
- format(str, sizeof(str), "Extra 2 score and %d$ for capture spree.", money);
- SendClientMessage(playerid, GREEN, str);
- }
- }
- if(ZoneInfo[zone][ImportantZone])
- {
- SendClientMessage(playerid, GREEN, "Extra 2 score and 1000$ for capturing an important zone.");
- GivePlayerScoreEx(playerid, 2), GivePlayerMoneyEx(playerid, 1000);
- }
- if(ZoneInfo[zone][BonusZone])
- {
- new score = randomEx(5,15);
- money = randomEx(2000,5000);
- format(str, sizeof(str), "Extra %d score and %d$ for capturing bonus zone.", score, money);
- SendClientMessage(playerid, GREEN, str);
- format(str, sizeof(str), "* %s(%d) captured the bonus zone.", PlayerInfo[playerid][Name], playerid);
- SendClientMessage(playerid, WEAK_GREEN, str);
- GivePlayerScoreEx(playerid, score), GivePlayerMoneyEx(playerid, money);
- ZoneInfo[zone][BonusZone] = false;
- StaticTimerEx[bonuszone] += BONUS_ZONE_UPDATE_INTERVAL;
- }
- }
- foreach(Player, i)
- {
- if(i == playerid) continue;
- if(PlayerInfo[i][Duty]) continue;
- if(PlayerInfo[i][Team] == PlayerInfo[playerid][Team])
- {
- if(IsPlayerInDynamicCP(i, ZoneInfo[zone][zone_CP]) && PlayerInfo[i][Zone] == zone)
- {
- PlayerInfo[i][Zone] = -1;
- money = randomEx(1000, 1100);
- format(str, sizeof(str), "Assisted in capture. +2 score and %d$.", money);
- SendClientMessage(i, GREEN, str);
- DisplayInfoTextdraw(i, "~g~~h~Captured!", 5);
- GivePlayerScoreEx(i, 2), GivePlayerMoneyEx(i, money);
- if(ZoneInfo[zone][ImportantZone])
- {
- SendClientMessage(i, GREEN, "Extra 1 score and 800$ for assisting in capturing of an important zone.");
- GivePlayerScoreEx(i, 1), GivePlayerMoneyEx(i, 800);
- }
- }
- else
- {
- format(str,sizeof(str), "* Your team captured the %s. +800$", ZoneInfo[zone][zone_Name]);
- SendClientMessage(i, WHITE, str);
- GivePlayerMoneyEx(i, 800);
- }
- }
- else if(PlayerInfo[i][Team] == ZoneInfo[zone][zone_Owner])
- {
- format(str,sizeof(str), "* Your team lost the %s. -500$", ZoneInfo[zone][zone_Name]);
- SendClientMessage(i, WHITE, str);
- GivePlayerMoneyEx(i, -500);
- if(PlayerInfo[i][Spawn] == zone)
- {
- SendClientMessage(i, RED, "The zone on which you chose to spawn at got captured by enemy team.");
- PlayerInfo[i][Spawn] = -1;
- }
- }
- }
- ZoneInfo[zone][zone_Owner] = PlayerInfo[playerid][Team];
- PlayerInfo[playerid][Zone] = -1;
- }
- return 1;
- }
- OnPlayerDeath
- DEBUG("Player Died ZoneID:%d",PlayerInfo[playerid][Zone]);
- if(PlayerInfo[playerid][Zone] != -1)
- {
- if(playerid == ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker])
- {
- PlayerInfo[playerid][Zone] =
- ZoneInfo[PlayerInfo[playerid][Zone]][zone_Timer] =
- ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker] = -1;
- ZoneInfo[PlayerInfo[playerid][Zone]][UnderAttack] = false;
- GangZoneStopFlashForAll(ZoneInfo[PlayerInfo[playerid][Zone]][zone_Zone]);
- }
- else ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attackers]-=1, PlayerInfo[playerid][Zone] = -1;
- }
- public OnPlayerEnterDynamicCP(playerid, checkpointid)
- {
- DEBUG("Player Entered Checkpoint cid:%d",checkpointid,ZoneInfo[PlayerInfo[playerid][Zone]][zone_CP],PlayerInfo[playerid][Zone]);
- for(new i=0; i < sizeof(ZoneInfo); i++)
- {
- if(checkpointid != ZoneInfo[i][zone_CP]) continue;
- DEBUG("Player Entered Zone Checkpoint cid:%d ZoneCP:%d ZoneID:%d Bonus Zone:%d",checkpointid,ZoneInfo[PlayerInfo[playerid][Zone]][zone_CP],PlayerInfo[playerid][Zone],bonus_zone_id);
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You can't capture from a vehicle.");
- if(ZoneInfo[i][zone_Owner] == PlayerInfo[playerid][Team]) return SendClientMessage(playerid, RED, "This zone is owned by your team.");
- if(PlayerInfo[playerid][Duty]) return SendClientMessage(playerid, RED, "You can't be in admin duty.");
- if(PlayerInfo[playerid][Spec]) return SendClientMessage(playerid, RED, "You can't be in spectate.");
- if(PlayerInfo[playerid][Team] == TEAM_CIVIL) return SendClientMessage(playerid, RED, "Guerillas can't capture zones.");
- if(ZoneInfo[i][UnderAttack] && PlayerInfo[ZoneInfo[i][zone_Attacker]][Team] == PlayerInfo[playerid][Team]) return ZoneInfo[i][zone_Attackers]+=1, PlayerInfo[playerid][Zone] = i, SendClientMessage(playerid, WHITE, "Stay in the red checkpoint to get capture assist rewards.");
- else if(ZoneInfo[i][UnderAttack] && PlayerInfo[ZoneInfo[i][zone_Attacker]][Team] != PlayerInfo[playerid][Team]) return SendClientMessage(playerid, RED, "Kill the enemy in the zone to capture.");
- ZoneInfo[i][UnderAttack] = true;
- ZoneInfo[i][zone_Attacker] = playerid;
- ZoneInfo[i][zone_Attackers]++;
- ZoneInfo[i][zone_Timer] = 25;
- PlayerInfo[playerid][Zone] = i;
- GangZoneFlashForAll(ZoneInfo[i][zone_Zone], TeamInfo[PlayerInfo[playerid][Team]][team_color]);
- new str[70];
- format(str,sizeof(str), "~y~[ZONE] ~w~%s ~r~attacked ~w~the %s", TeamName(PlayerInfo[playerid][Team]), ZoneInfo[i][zone_Name]);
- SendBoxMessage(str);
- format(str,sizeof(str), "You are starting to capture %s.", ZoneInfo[i][zone_Name]);
- SendClientMessage(playerid, WHITE, str), str[0]='\0';
- SendClientMessage(playerid, WHITE, "Stay in this red checkpoint for 25 seconds to capture the zone.");
- }
- return 1;
- }
- public OnPlayerLeaveDynamicCP(playerid, checkpointid)
- {
- DEBUG("Player Left Checkpoint cid:%d ZoneCP:%d ZoneID:%d Bonus Zone:%d",checkpointid,ZoneInfo[PlayerInfo[playerid][Zone]][zone_CP],PlayerInfo[playerid][Zone],bonus_zone_id);
- if(checkpointid == ZoneInfo[PlayerInfo[playerid][Zone]][zone_CP])
- {
- if(ZoneInfo[PlayerInfo[playerid][Zone]][UnderAttack])
- {
- if(ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker] == playerid)
- {
- ZoneInfo[PlayerInfo[playerid][Zone]][zone_Timer] = -1;
- ZoneInfo[PlayerInfo[playerid][Zone]][UnderAttack] = false;
- ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker] = -1;
- ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attackers] = 0;
- GangZoneStopFlashForAll(ZoneInfo[PlayerInfo[playerid][Zone]][zone_Zone]);
- PlayerInfo[playerid][Zone] = -1;
- SendClientMessage(playerid, RED, "Capture failed as you left the red checkpoint.");
- }
- else if(ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attackers] > 1 && playerid != ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attacker])
- {
- SendClientMessage(playerid, RED, "You are no longer assisting in capture as you left the red checkpoint.");
- ZoneInfo[PlayerInfo[playerid][Zone]][zone_Attackers]-=1;
- PlayerInfo[playerid][Zone] = -1;
- }
- }
- }
- return 1;
- }
- OnPlayerStateChange
- if(PlayerInfo[playerid][Zone] != -1)
- {
- new zone = PlayerInfo[playerid][Zone];
- if(playerid == ZoneInfo[zone][zone_Attacker])
- {
- ZoneInfo[zone][zone_Timer] =
- PlayerInfo[playerid][Zone] =
- ZoneInfo[zone][zone_Attacker] = -1;
- ZoneInfo[zone][UnderAttack] = false;
- ZoneInfo[zone][zone_Attackers] = 0;
- GangZoneStopFlashForAll(ZoneInfo[zone][zone_Zone]);
- SendClientMessage(playerid, RED, "Capture failed as you entered a vehicle.");
- }
- else if(ZoneInfo[zone][zone_Attackers] > 1 && playerid != ZoneInfo[zone][zone_Attacker])
- {
- SendClientMessage(playerid, RED, "You are no longer assisting in capture as you entered a vehicle.");
- ZoneInfo[zone][zone_Attackers]--;
- PlayerInfo[playerid][Zone] = -1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement