Capture zones :D
#6

pawn Код:
stock ActiveBay(playerid)
{
    if(Spectating[playerid] == 0 || PlayerInfo[playerid][OnDuty] == 0 || gTeam[playerid] != TEAM_MERC)
    {
        if(UnderAttack[BAY] == 0)
        {
            if(!IsPlayerInAnyVehicle(playerid))
            {
                if(PlayerInfo[playerid][pDonator] == 1) // if is a donator, change this to your variable for donator
                {
                    UnderAttack[BAY] = 1;
                    timer[playerid][BAY] = SetTimerEx("Bay", 15000, false,"i",playerid); // 15 instead of 30
                    Captured[playerid][BAY] = 0;
                    SendClientMessage(playerid, 0xFFFFFFFF,"| - Stay in this checkpoint for 15 seconds to capture! - |");
                }
                else // if he isnt a donator
                {
                    UnderAttack[BAY] = 1;
                    timer[playerid][BAY] = SetTimerEx("Bay", 30000, false,"i",playerid); // 30 regular time
                    Captured[playerid][BAY] = 0;
                    SendClientMessage(playerid, 0xFFFFFFFF,"| - Stay in this checkpoint for 30 seconds to capture! - |");
                }
                if(gTeam[playerid] == TEAM_TALIBAN)
                {
                  GangZoneFlashForAll(Zone[BAY], TEAM_ZONE_TALIBAN_COLOR);
                }
                else if(gTeam[playerid] == TEAM_EURASIA)
                {
                  GangZoneFlashForAll(Zone[BAY], TEAM_ZONE_EURASIA_COLOR);
                }
                else if(gTeam[playerid] == TEAM_ARAB)
                {
                  GangZoneFlashForAll(Zone[BAY], TEAM_ZONE_ARAB_COLOR);
                }
                else if(gTeam[playerid] == TEAM_SOVIET)
                {
                  GangZoneFlashForAll(Zone[BAY], TEAM_ZONE_SOVIET_COLOR);
                }
                else if(gTeam[playerid] == TEAM_USA)
                {
                  GangZoneFlashForAll(Zone[BAY], TEAM_ZONE_USA_COLOR);
                }
                else if(gTeam[playerid] == TEAM_AUS)
                {
                  GangZoneFlashForAll(Zone[BAY], TEAM_ZONE_AUS_COLOR);
                }
                //------Message-----
                if(tCP[BAY] == TEAM_TALIBAN)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<TALIBAN>");
                  SendTeamMessage(TEAM_TALIBAN, green,"*Bay is under attack!");
                }
                else if(tCP[BAY] == TEAM_EURASIA)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<EURASIA>");
                  SendTeamMessage(TEAM_EURASIA, green,"*Bay is under attack!");
                }
                else if(tCP[BAY] == TEAM_ARAB)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<ARAB>");
                  SendTeamMessage(TEAM_ARAB, green,"*Bay is under attack!");
                }
                else if(tCP[BAY] == TEAM_SOVIET)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<SOVIET>");
                  SendTeamMessage(TEAM_SOVIET, green,"*Bay is under attack!");
                }
                else if(tCP[BAY] == TEAM_USA)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<USA>");
                  SendTeamMessage(TEAM_USA, green,"*Bay is under attack!");
                }
                else if(tCP[BAY] == TEAM_AUS)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<AUSTRALIA>");
                  SendTeamMessage(TEAM_AUS, green,"*Bay is under attack!");
                }
                else if(tCP[BAY] == TEAM_NONE)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is not controlled by any team");
                }
                //---------loop-------//
                for(new i = 0; i < MAX_PLAYERS; i ++)
                {
                   IsPlayerCapturing[i][BAY] = 1;
                }
            }
            else return CaptureZoneMessage(playerid, 1);
        }
        else return CaptureZoneMessage(playerid, 2);
    }
    else return CaptureZoneMessage(playerid, 3);
    return 1;
}
stock BayCaptured(playerid)
{
    Captured[playerid][BAY] = 1;
    UnderAttack[BAY] = 0;
    KillTimer(timer[playerid][BAY]);
    TextDrawHideForPlayer(playerid, CountText[playerid]);
    CountVar[playerid][BAY] = 30;
    GivePlayerScore(playerid, 3);
    GivePlayerMoney(playerid, 5000);
    TextDrawShowForPlayer(playerid, Rank1[playerid]);
    new str[200];
    format(str, sizeof(str),"~W~SCR: ~y~%d~n~~b~K: ~y~%d ~r~D: ~y~%d", GetPlayerScore(playerid),PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths]);
    TextDrawSetString(Rank1[playerid], str);
    SendClientMessage(playerid, COLOR_WHITE,"You have earned +3 Score and +$5000 for Captureing This Area.");
    //==========================================================================
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
       IsPlayerCapturing[i][BAY] = 0;
       if(gTeam[i] == gTeam[playerid] && i != playerid && PlayerInfo[i][OnDuty] == 0)
       {
           SendClientMessage(i, 0xFFFFFFFF,"*Your team has captured "cred"Bay"cwhite"! You received +1 score for it!");
           GivePlayerScore(i, 1);
       }
    }
    //==========================================================================
    tCP[BAY] = gTeam[playerid];
    GangZoneStopFlashForAll(Zone[BAY]);
    //==========================================================================
    if(gTeam[playerid] == TEAM_TALIBAN)
    {
       GangZoneShowForAll(Zone[BAY], TEAM_ZONE_TALIBAN_COLOR);
    }
    else if(gTeam[playerid] == TEAM_EURASIA)
    {
       GangZoneShowForAll(Zone[BAY], TEAM_ZONE_EURASIA_COLOR);
    }
    else if(gTeam[playerid] == TEAM_ARAB)
    {
       GangZoneShowForAll(Zone[BAY], TEAM_ZONE_ARAB_COLOR);
    }
    else if(gTeam[playerid] == TEAM_SOVIET)
    {
       GangZoneShowForAll(Zone[BAY], TEAM_ZONE_SOVIET_COLOR);
    }
    else if(gTeam[playerid] == TEAM_USA)
    {
       GangZoneShowForAll(Zone[BAY], TEAM_ZONE_USA_COLOR);
    }
    else if(gTeam[playerid] == TEAM_AUS)
    {
       GangZoneShowForAll(Zone[BAY], TEAM_ZONE_AUS_COLOR);
    }
    //==========================================================================
    format(str, sizeof(str),"%s has captured Beach Shack for team %s", pName(playerid), GetTeamName(playerid));
    SendBoxMessage(str);
    return 1;
}
stock LeavingBay(playerid)
{
    Captured[playerid][BAY] = 1;
    UnderAttack[BAY] = 0;
    KillTimer(timer[playerid][BAY]);
    TextDrawHideForPlayer(playerid, CountText[playerid]);
    CountVar[playerid][BAY] = 30;
    GangZoneStopFlashForAll(Zone[BAY]);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
       IsPlayerCapturing[i][BAY] = 0;
    }
    SendClientMessage(playerid, red,"*You have been failed to capture this zone!");
    return 1;
}
forward Bay(playerid);
public Bay(playerid)
{
    BayCaptured(playerid);
    return 1;
}
Try it and read the comments I've placed in the first lines of code.


Cheers!
Reply


Messages In This Thread
Capture zones :D - by Ryz - 23.08.2014, 11:28
Re: Capture zones :D - by HazardouS - 23.08.2014, 11:32
Re: Capture zones :D - by Ryz - 23.08.2014, 12:05
Re: Capture zones :D - by theLegion - 23.08.2014, 12:08
Re: Capture zones :D - by Ryz - 23.08.2014, 12:36
Re: Capture zones :D - by theLegion - 23.08.2014, 12:59
Re: Capture zones :D - by Ryz - 23.08.2014, 13:11
Re: Capture zones :D - by Kyance - 23.08.2014, 13:32
Re: Capture zones :D - by Ryz - 23.08.2014, 13:39
Re: Capture zones :D - by Ryz - 10.09.2014, 19:09

Forum Jump:


Users browsing this thread: 8 Guest(s)