How to add more capture zones
#3

And I will have to make stocks for every single zone ?

Like this
pawn Код:
stock ActiveCAPZONE0(playerid)
{
        if(UnderAttack[ZONE_0] == 0)
        {
            if(!IsPlayerInAnyVehicle(playerid))
            {
                UnderAttack[ZONE_0] = 1;
                timer[playerid][ZONE_0] = SetTimerEx("CAPZONETimer", 25000, false,"i",playerid);
                Captured[playerid][ZONE_0] = 0;
                SendClientMessage(playerid, COLOR_WHITE,"Stay in this checkpoint for 25 seconds to capture it");
                if(GetPlayerTeam(playerid) == TEAM_ALPHA)
                {
                  FlashDynamicZoneForAll(Zone[ZONE_0], ALPHA_FLAG_COLOR);
                }
                else if(GetPlayerTeam(playerid) == TEAM_BRAVO)
                {
                  FlashDynamicZoneForAll(Zone[ZONE_0], BRAVO_FLAG_COLOR);
                }

                //------Message-----
                if(tCP[ZONE_0] == TEAM_ALPHA)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team Alpha");
                  SendClientMessageToAll(COLOR_RED,"Capture Zone is under attack");
                }
                else if(tCP[ZONE_0] == TEAM_BRAVO)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team Bravo");
                  SendClientMessageToAll(COLOR_RED,"Capture Zone is under attack");
                }

                else if(tCP[ZONE_0] == 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][ZONE_0] = 1;
                }
            }
            else return CaptureZoneMessage(playerid, 1);
        }
        else return CaptureZoneMessage(playerid, 2);
        return 1;
}
pawn Код:
stock ActiveCAPZONE1(playerid)
{
        if(UnderAttack[ZONE_1] == 0)
        {
            if(!IsPlayerInAnyVehicle(playerid))
            {
                UnderAttack[ZONE_1] = 1;
                timer[playerid][ZONE_1] = SetTimerEx("CAPZONETimer", 25000, false,"i",playerid);
                Captured[playerid][ZONE_1] = 0;
                SendClientMessage(playerid, COLOR_WHITE,"Stay in this checkpoint for 25 seconds to capture it");
                if(GetPlayerTeam(playerid) == TEAM_ALPHA)
                {
                  FlashDynamicZoneForAll(Zone[ZONE_1], ALPHA_FLAG_COLOR);
                }
                else if(GetPlayerTeam(playerid) == TEAM_BRAVO)
                {
                  FlashDynamicZoneForAll(Zone[ZONE_1], BRAVO_FLAG_COLOR);
                }

                //------Message-----
                if(tCP[ZONE_1] == TEAM_ALPHA)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team Alpha");
                  SendClientMessageToAll(COLOR_RED,"Capture Zone is under attack");
                }
                else if(tCP[ZONE_1] == TEAM_BRAVO)
                {
                  SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team Bravo");
                  SendClientMessageToAll(COLOR_RED,"Capture Zone is under attack");
                }

                else if(tCP[ZONE_1] == 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][ZONE_1] = 1;
                }
            }
            else return CaptureZoneMessage(playerid, 1);
        }
        else return CaptureZoneMessage(playerid, 2);
        return 1;
}

Also, would it work correctly if I do this stock like this:
pawn Код:
stock CAPZONECaptured(playerid)
{

    Captured[playerid][ZONE_0] = 1;
    Captured[playerid][ZONE_1] = 1;
    UnderAttack[ZONE_0] = 0;
    UnderAttack[ZONE_1] = 0;
    KillTimer(timer[playerid][ZONE_0]);
    KillTimer(timer[playerid][ZONE_1]);
    CountVar[playerid][ZONE_0] = 25;
    CountVar[playerid][ZONE_1] = 25;
    GivePlayerScore(playerid, 5);
    SendClientMessage(playerid, COLOR_GREEN,"Congratulations! You have captured the area! You received +5 score");
    //==========================================================================
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
       IsPlayerCapturing[i][ZONE_0] = 0;
       if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
       {
           SendClientMessage(i, COLOR_WHITE,"Your team has captured a flag! You received +1 score for it");
           GivePlayerScore(i, 1);
       }
    }
    tCP[ZONE_0] = GetPlayerTeam(playerid);
    StopFlashDynamicZoneForAll(Zone[ZONE_0]);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
       IsPlayerCapturing[i][ZONE_1] = 0;
       if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
       {
           SendClientMessage(i, COLOR_WHITE,"Your team has captured a flag! You received +1 score for it");
           GivePlayerScore(i, 1);
       }
    }
    //==========================================================================
    tCP[ZONE_1] = GetPlayerTeam(playerid);
    StopFlashDynamicZoneForAll(Zone[ZONE_1]);
    //==========================================================================
    if(tCP[ZONE_0] == TEAM_ALPHA)
    {
       GangZoneShowForAll(Zone[ZONE_0], TEAMCOLOR_ALPHA);
    }
    else if(tCP[ZONE_0] == TEAM_BRAVO)
    {
    GangZoneShowForAll(Zone[ZONE_0], TEAMCOLOR_BRAVO);
    }
    if(tCP[ZONE_1] == TEAM_ALPHA)
    {
       GangZoneShowForAll(Zone[ZONE_1], TEAMCOLOR_ALPHA);
    }
    else if(tCP[ZONE_1] == TEAM_BRAVO)
    {
    GangZoneShowForAll(Zone[ZONE_1], TEAMCOLOR_BRAVO);
    }
    //==========================================================================
    new str[128];
    format(str, sizeof(str),"%s has captured the capture zone!", GetName(playerid));
    SendClientMessageToAll(COLOR_ORANGE, str);
    return 1;
}
Reply


Messages In This Thread
How to add more capture zones - by msvu - 22.05.2014, 14:59
Re: How to add more capture zones - by Pasa - 22.05.2014, 15:13
Re: How to add more capture zones - by msvu - 22.05.2014, 16:10

Forum Jump:


Users browsing this thread: 1 Guest(s)