My gang capture zones aren't working properly. [+rep]
#1

Basically my zones aren't working properly. My message isn't displaying for everyone correctly even when they're in the same gang. But other times it works ok. It seems to happen randomly. Can any one see a problem with my code?

pawn Код:
////// MAIN TIMER SET ONGAMEMODEINIT FOR EVERY 30 MINS

forward ZoneTimer();
public ZoneTimer()
{
    if(CaptureOk == 0)
    {
        new randomzone = random(4);
        if(randomzone == 1)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneFlashForPlayer(i,drugzonesf,COLOR_RED);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Zone] - This Zone is now available to capture!");
                        CaptureOk = drugpointsf;
                    }
                }
            }
        }
        if(randomzone == 2)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneFlashForPlayer(i,drugzonels,COLOR_RED);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Zone] - This Zone is now available to capture!");
                        CaptureOk = drugpointls;
                    }
                }
            }
        }
        if(randomzone == 3)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneFlashForPlayer(i,matzonesf,COLOR_RED);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Zone] - This Zone is now available to capture!");
                        CaptureOk = matrunsf;
                    }
                }
            }
        }
        if(randomzone == 4)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneFlashForPlayer(i,matzonels,COLOR_RED);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Zone] - This Zone is now available to capture!");
                        CaptureOk = matrunls;
                    }
                }
            }
        }
    }
}

//////// GANG MEMBER INSIDE THE CHECKPOINT CAPTURING THE ZONE (TIMER)


forward CaptureTimer(playerid);
public CaptureTimer(playerid)
{
    if(CapturingZone[playerid] == 0)
    {
        KillTimer(PRCapture[playerid]);
        ZoneBeingCaptured = 0;
    }
    if(CapturingZone[playerid] == drugpointsf && CaptureAmount[playerid] > 0)
    {
        CaptureAmount[playerid] -= 1;
    }
    if(CapturingZone[playerid] == drugpointsf && CaptureAmount[playerid] <= 0)
    {
        if(PlayerInfo[playerid][pFaction] == 10)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - Grove has captured the zone!");
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] != 10)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] == 10)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 11)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - Ballas has captured the zone!");
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] != 11)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] == 11)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 12)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - Aztecas has captured the zone!");
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] != 12)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] == 12)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 13)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - Rifa has captured the zone!");
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] != 13)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] == 13)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 14)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - Triads has captured the zone!");
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] != 14)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] == 14)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 15)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - NangBoys has captured the zone!");
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] != 15)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointsf && PlayerInfo[i][pFaction] == 15)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
    }
    if(CapturingZone[playerid] == drugpointls && CaptureAmount[playerid] > 0)
    {
        CaptureAmount[playerid] -= 1;
    }
    if(CapturingZone[playerid] == drugpointls && CaptureAmount[playerid] <= 0)
    {
        if(PlayerInfo[playerid][pFaction] == 10)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - Grove has captured the zone!");
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] != 10)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] == 10)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 11)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - Ballas has captured the zone!");
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] != 11)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] == 11)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 12)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - Aztecas has captured the zone!");
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] != 12)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] == 12)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 13)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - Rifa has captured the zone!");
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] != 13)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] == 13)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 14)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - Triads has captured the zone!");
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] != 14)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] == 14)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 15)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, drugzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - NangBoys has captured the zone!");
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] != 15)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == drugpointls && PlayerInfo[i][pFaction] == 15)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Drug Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
    }
    if(CapturingZone[playerid] == matrunsf && CaptureAmount[playerid] > 0)
    {
        CaptureAmount[playerid] -= 1;
    }
    if(CapturingZone[playerid] == matrunsf && CaptureAmount[playerid] <= 0)
    {
        if(PlayerInfo[playerid][pFaction] == 10)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - Grove has captured the zone!");
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] != 10)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] == 10)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 11)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - Ballas has captured the zone!");
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] != 11)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] == 11)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 12)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - Aztecas has captured the zone!");
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] != 12)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] == 12)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 13)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - Rifa has captured the zone!");
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] != 13)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] == 13)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 14)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - Triads has captured the zone!");
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] != 14)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] == 14)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 15)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonesf);
                        SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - NangBoys has captured the zone!");
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] != 15)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunsf && PlayerInfo[i][pFaction] == 15)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[San Fierro Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
    }
    if(CapturingZone[playerid] == matrunls && CaptureAmount[playerid] > 0)
    {
        CaptureAmount[playerid] -= 1;
    }
    if(CapturingZone[playerid] == matrunls && CaptureAmount[playerid] <= 0)
    {
        if(PlayerInfo[playerid][pFaction] == 10)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - Grove has captured the zone!");
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] != 10)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] == 10)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 11)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - Ballas has captured the zone!");
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] != 11)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] == 11)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 12)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - Aztecas has captured the zone!");
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] != 12)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] == 12)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 13)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - Rifa has captured the zone!");
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] != 13)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] == 13)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 14)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - Triads has captured the zone!");
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] != 14)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] == 14)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pFaction] == 15)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(FactionInfo[PlayerInfo[i][pFaction]][fType] == 20)
                    {
                        GangZoneStopFlashForPlayer(i, matzonels);
                        SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - NangBoys has captured the zone!");
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] != 15)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                        }
                        if(InCaptureZone[i] == matrunls && PlayerInfo[i][pFaction] == 15)
                        {
                            InCaptureZone[i] = 0;
                            DisablePlayerCheckpoint(i);
                            SendClientMessage(i, COLOR_ORANGE, "[Los Santos Weapon Point] - You received $50,000 for capturing the zone!");
                            GivePlayerCash(i, 50000);
                            KillTimer(PRCapture[playerid]);
                            ZoneBeingCaptured = 0;
                            CapturingZone[playerid] = 0;
                            CaptureOk = 0;
                        }
                    }
                }
            }
        }
    }
    new string[128];
    format(string, sizeof(string), "~g~Seconds Left: ~w~ %d", CaptureAmount[playerid]);
    GameTextForPlayer(playerid, string, 3000, 4);
}


////// ENTERING DYNAMIC AREA (ZONES)


    if(IsPlayerInDynamicArea(playerid, drugpointsf))
    {
        if(CaptureOk == drugpointsf)
        {
            if(FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 20 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
            {
                InCaptureZone[playerid] = drugpointsf;
                SendClientMessage(playerid, COLOR_ORANGE, "[San Fierro Drug Zone] - This Zone is currently available to capture!");
                SendClientMessage(playerid, COLOR_GREY, "One of your gang members must be in the checkpoint for 30 seconds to capture the zone!");
                SetPlayerCheckpoint(playerid,-2462.3196,-114.8511,25.8209, 5.0); // SAN FIERRO DRUG CHECKPOINT
                return 1;
            }
        }
    }
    if(IsPlayerInDynamicArea(playerid, drugpointls))
    {
        if(CaptureOk == drugpointls)
        {
            if(FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 20 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
            {
                InCaptureZone[playerid] = drugpointls;
                SendClientMessage(playerid, COLOR_ORANGE, "[Los Santos Drug Zone] - This Zone is currently available to capture!");
                SendClientMessage(playerid, COLOR_GREY, "One of your gang members must be in the checkpoint for 30 seconds to capture the zone!");
                SetPlayerCheckpoint(playerid,773.0373,-1014.1686,26.3594, 5.0); // LOS SANTOS DRUG CHECKPOINT
                return 1;
            }
        }
    }
    if(IsPlayerInDynamicArea(playerid, matrunsf))
    {
        if(CaptureOk == matrunsf)
        {
            if(FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 20 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
            {
                InCaptureZone[playerid] = matrunsf;
                SendClientMessage(playerid, COLOR_ORANGE, "[San Fierro Weapon Zone] - This Zone is currently available to capture!");
                SendClientMessage(playerid, COLOR_GREY, "One of your gang members must be in the checkpoint for 30 seconds to capture the zone!");
                SetPlayerCheckpoint(playerid,-1733.2275,170.5280,3.5547, 5.0); // SAN FIERRO MAT CHECKPOINT
                return 1;
            }
        }
    }
    if(IsPlayerInDynamicArea(playerid, matrunls))
    {
        if(CaptureOk == matrunls)
        {
            if(FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 20 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
            {
                InCaptureZone[playerid] = matrunls;
                SendClientMessage(playerid, COLOR_ORANGE, "[Los Santos Weapon Zone] - This Zone is currently available to capture!");
                SendClientMessage(playerid, COLOR_GREY, "One of your gang members must be in the checkpoint for 30 seconds to capture the zone!");
                SetPlayerCheckpoint(playerid,2175.9983,-2307.9177,13.5469, 5.0); // LOS SANTOS MAT CHECKPOINT
                return 1;
            }
        }
    }
   
   
////// LEAVING THE DYNAMIC AREA (ZONES)


    if(IsPlayerInDynamicArea(playerid, drugpointsf))
    {
        if(FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 20)
        {
            InCaptureZone[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            return 1;
        }
    }
    if(IsPlayerInDynamicArea(playerid, drugpointls))
    {
        if(FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 20)
        {
            InCaptureZone[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            return 1;
        }
    }
    if(IsPlayerInDynamicArea(playerid, matrunsf))
    {
        if(FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 20)
        {
            InCaptureZone[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            return 1;
        }
    }
    if(IsPlayerInDynamicArea(playerid, matrunls))
    {
        if(FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 20)
        {
            InCaptureZone[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            return 1;
        }
    }
   
   
/////// ENTERING THE CHECKPOINT INSIDE THE DYNAMIC AREA (ZONES)


    if(IsPlayerInDynamicArea(playerid, drugpointsf))
    {
        if(InCaptureZone[playerid] == drugpointsf && ZoneBeingCaptured == 0 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
        {
            CaptureAmount[playerid] = 30;
            ZoneBeingCaptured = 1;
            CapturingZone[playerid] = drugpointsf;
            SendClientMessage(playerid, COLOR_ORANGE, "[San Fierro Drug Zone] - You're capturing the zone!");
            SendClientMessage(playerid, COLOR_GREY, "You must remain in the checkpoint for 30 seconds!");
            PRCapture[playerid] = SetTimerEx("CaptureTimer", 1000, true, "i", playerid);
            return 1;
        }
        if(InCaptureZone[playerid] == drugpointsf && ZoneBeingCaptured == 1 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
        {
            SendClientMessage(playerid, COLOR_RED, "[San Fierro Drug Zone] - This zone is already being captured!");
            return 1;
        }
    }
    if(IsPlayerInDynamicArea(playerid, drugpointls))
    {
        if(InCaptureZone[playerid] == drugpointls && ZoneBeingCaptured == 0 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
        {
            CaptureAmount[playerid] = 30;
            ZoneBeingCaptured = 1;
            CapturingZone[playerid] = drugpointls;
            SendClientMessage(playerid, COLOR_ORANGE, "[Los Santos Drug Zone] - You're capturing the zone!");
            SendClientMessage(playerid, COLOR_GREY, "You must remain in the checkpoint for 30 seconds!");
            PRCapture[playerid] = SetTimerEx("CaptureTimer", 1000, true, "i", playerid);
            return 1;
        }
        if(InCaptureZone[playerid] == drugpointls && ZoneBeingCaptured == 1 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
        {
            SendClientMessage(playerid, COLOR_RED, "[Los Santos Drug Zone] - This zone is already being captured!");
            return 1;
        }
    }
    if(IsPlayerInDynamicArea(playerid, matrunsf))
    {
        if(InCaptureZone[playerid] == matrunsf && ZoneBeingCaptured == 0 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
        {
            CaptureAmount[playerid] = 30;
            ZoneBeingCaptured = 1;
            CapturingZone[playerid] = matrunsf;
            SendClientMessage(playerid, COLOR_ORANGE, "[San Fierro Weapon Zone] - You're capturing the zone!");
            SendClientMessage(playerid, COLOR_GREY, "You must remain in the checkpoint for 30 seconds!");
            PRCapture[playerid] = SetTimerEx("CaptureTimer", 1000, true, "i", playerid);
            return 1;
        }
        if(InCaptureZone[playerid] == matrunsf && ZoneBeingCaptured == 1 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
        {
            SendClientMessage(playerid, COLOR_RED, "[San Fierro Weapon Zone] - This zone is already being captured!");
            return 1;
        }
    }
    if(IsPlayerInDynamicArea(playerid, matrunls))
    {
        if(InCaptureZone[playerid] == matrunls && ZoneBeingCaptured == 0 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
        {
            CaptureAmount[playerid] = 30;
            ZoneBeingCaptured = 1;
            CapturingZone[playerid] = matrunls;
            SendClientMessage(playerid, COLOR_ORANGE, "[Los Santos Weapon Zone] - You're capturing the zone!");
            SendClientMessage(playerid, COLOR_GREY, "You must remain in the checkpoint for 30 seconds!");
            PRCapture[playerid] = SetTimerEx("CaptureTimer", 1000, true, "i", playerid);
            return 1;
        }
        if(InCaptureZone[playerid] == matrunls && ZoneBeingCaptured == 1 && PlayerInfo[playerid][pDead] == 0 && JustDied[playerid] == 0  && PlayerInfo[playerid][pDeadAlready] == 0)
        {
            SendClientMessage(playerid, COLOR_RED, "[Los Santos Weapon Zone] - This zone is already being captured!");
            return 1;
        }
    }



/////// LEAVING THE CHECKPOINT INSIDE THE DYNAMIC AREA (ZONES)


    if(CapturingZone[playerid] == drugpointsf)
    {
        KillTimer(PRCapture[playerid]);
        ZoneBeingCaptured = 0;
        CapturingZone[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "[San Fierro Drug Zone] - You have left the checkpoint!");
        return 1;
    }
    if(CapturingZone[playerid] == drugpointls)
    {
        KillTimer(PRCapture[playerid]);
        ZoneBeingCaptured = 0;
        CapturingZone[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "[Los Santos Drug Zone] - You have left the checkpoint!");
        return 1;
    }
    if(CapturingZone[playerid] == matrunsf)
    {
        KillTimer(PRCapture[playerid]);
        ZoneBeingCaptured = 0;
        CapturingZone[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "[San Fierro Weapon Zone] - You have left the checkpoint!");
        return 1;
    }
    if(CapturingZone[playerid] == matrunls)
    {
        KillTimer(PRCapture[playerid]);
        ZoneBeingCaptured = 0;
        CapturingZone[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "[Los Santos Weapon Zone] - You have left the checkpoint!");
        return 1;
    }
Reply
#2

Are you clearing the variables when the player logs in?
Reply
#3

Quote:
Originally Posted by mirou123
Посмотреть сообщение
Are you clearing the variables when the player logs in?
Yes I am clearing the 4 variables which are used with [MAX_PLAYERS];

Here they are..

new InCaptureZone[MAX_PLAYERS];
new CapturingZone[MAX_PLAYERS];
new PRCapture[MAX_PLAYERS];
new CaptureAmount[MAX_PLAYERS];

I clear them when the player connects.
Reply
#4

For the "SOMETIMES WORKS"

new randomzone = random(4);

That generates a random number between 0 and 3, not 1 and 4, whilist you're checking for 1-4.

Either do random(4)+1 (that way you'll get 0,1,2,3 + 1 = 1,2,3,4) or change the function variables.

https://sampwiki.blast.hk/wiki/Random

The general formula is random(n)+min
Reply
#5

Quote:
Originally Posted by CuervO
Посмотреть сообщение
For the "SOMETIMES WORKS"

new randomzone = random(4);

That generates a random number between 0 and 3, not 1 and 4, whilist you're checking for 1-4.

Either do random(4)+1 (that way you'll get 0,1,2,3 + 1 = 1,2,3,4) or change the function variables.

https://sampwiki.blast.hk/wiki/Random

The general formula is random(n)+min
Me and a friend were just discussing that. It still doesn't explain our problem though. That's still fine besides one capture zone not activating.

Basically the capture zones work perfectly for a while. Then randomly one of the zones which has worked perfectly all along will just not work properly.

For example. A player capturing the zone when the timer gets to 0 nothing will happen. But other players in the zone in their gang will receive the message and payment. Other players around the world not in the zone (whilst the person capturing the zone is still stood inside) will receive the message that grove captured the zone. If you look through the code you'll understand what I'm saying.

The weird thing is I've been through the code 100 times over and it all makes sense to me. I don't understand why it would randomly flank out and not work properly. What am I missing?
Reply
#6

What about cleaning the PlayerInfo[playerid][pFaction] and stuff like those?
Reply
#7

Those are all done too.
Reply
#8

Quote:
Originally Posted by CuervO
Посмотреть сообщение
For the "SOMETIMES WORKS"

new randomzone = random(4);

That generates a random number between 0 and 3, not 1 and 4, whilist you're checking for 1-4.

Either do random(4)+1 (that way you'll get 0,1,2,3 + 1 = 1,2,3,4) or change the function variables.

https://sampwiki.blast.hk/wiki/Random

The general formula is random(n)+min
Hey CuervO,

I've been working on my Capture Zones for some time now and to no avail. I got all the checkpoints working now though with the correct usage on the random number to activate them. If I set the ZoneTimer (Which activates the zones) to 3 minutes for testing we can go around capturing all the checkpoints. Last night after adding a load of updates to my server about 3am whilst no one was online I put my zone activation timer back to 30 mins and logged out and waited. If a player logs in and a zone is active it is supposed to alert them on spawning. I logged back in about 40-50 minutes later and it alerted me like it should. After waking up today I've logged in and got no message when I spawned. No one is online yet as it is quite early but the zones are definitely breaking after a few hours of either no one being online or no one capturing them. What could be the cause of this? Any ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)