SA-MP Forums Archive
Little help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little help (/showthread.php?tid=578787)



Little help - Sanady - 22.06.2015

Hello everybody, I got problem, again. I created Gangzone system, when player enters dynamic CP, zone should start being captured. But here the problem, code or streamer somehow is not indicating that player is in CP, I don`t know why, I am hooking OnPlayerEnterDynamicCP and OnPlayerExitDynamicCP but script somehow can`t see that player is in Zone, first I thought it`s becouse of ID of CP, but it`s not, I checked three times whole system, everything looks fine. But bug is showing up again and again. Please take a look what I wrote here, and feel free give me suggestion how to fix that.

Also here are the screens too:




When player enter CP, message should show up but nothing happend... :/


Re: Little help - AlonzoTorres - 22.06.2015

When do you create the checkpoint? Show us OnPlayerEnterDynamicCP? We need some code to work with. It's hard to guess what could be wrong.


Re: Little help - Sanady - 22.06.2015

pawn Код:
hook OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    SendDebug(playerid, "Enter CP: 1");
    for(new i = 0; i < sizeof(GangZone); i++)
    {
        SendDebug(playerid, "Enter CP: 2");
        if(GangZone[i][cpID] == checkpointid)
        {
            SendDebug(playerid, "Enter CP: 3");
            if(GangZone[i][OwnerTeam] == pTeam[playerid]) return 1;
            SendDebug(playerid, "Enter CP: 4");
            if(GangZone[i][Capturing] != INVALID_PLAYER_ID) return 1;
            new ZonesCount;

            for(new x = 0; x < sizeof(GangZone); x++)
            {
                SendDebug(playerid, "Enter CP: 5");
                if(GangZone[x][OwnerTeam] == GangZone[i][OwnerTeam])
                SendDebug(playerid, "Enter CP: 6");
                ZonesCount ++;

            }
            SendDebug(playerid, "Enter CP: 7");
            if(GangZone[i][OwnerTeam] != 0 && ZonesCount <= 1)
            {
                SendClientMessage(playerid,0xFFFFFFFF,"{FFBB00}[Turf] "embed_white"You can`t capture this zone!");
                return 1;
            }

            SendMessageToAll(-1, "{FFBB00}[Turf] "embed_white"Capturing zone %s(%d)!", GangZone[i][ZoneName], i);

            GangZone[i][Capturing] = playerid;
            pCapturing[playerid] = i;
            GangZoneFlashForAll(i, GetTeamColor(pTeam[playerid]));

            GangZone[i][CapturingTimer] = SetTimerEx("OnPlayerCaptureGangZone", GangZone[i][CaptureTime], 0, "dd", playerid, i);
            return 1;
        }

    }
    return 1;
}



Re: Little help - Sanady - 22.06.2015

Sorry for double posting but anyone checked?


Re: Little help - Gammix - 22.06.2015

The streamer has a bad range check so it may return true even if you are a bit near the outline of the CP.

Did you try going out of the CP far from the point?


Re: Little help - Sanady - 22.06.2015

Quote:
Originally Posted by Gammix
Посмотреть сообщение
The streamer has a bad range check so it may return true even if you are a bit near the outline of the CP.

Did you try going out of the CP far from the point?
Yes, I did, nothing changed


Re: Little help - Sanady - 23.06.2015

Anyone?