SA-MP Forums Archive
OnPlayerEnterDynamicCP problem. - 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: OnPlayerEnterDynamicCP problem. (/showthread.php?tid=451469)



OnPlayerEnterDynamicCP problem. - Necip - 17.07.2013

Hello.I am helping on a TDM server, but I have a problem with the function on the title.I tried debugging but nothing gets called.Here is the script:
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CP[CityHall])
    {
        if(UnderAttack[CityHall] == 0) {
            if(tCP[CityHall] != gTeam[playerid]) {
                print("OnPlayerEnterDynamicCP: Checkpoint entered");
                CountVar[playerid][CityHall] = 25;
                ActiveCityHall(playerid);
                print("OnPlayerEnterDynamicCP: ActiveCityHall started");
            } else return SendClientMessage(playerid, COLOR_RED,"*This zone is already captured by your team!");
        } else return CaptureZoneMessage(playerid, 2);
    }
    return 1;
}
And the CreateDynamicCP
pawn Код:
CP[CityHall] = CreateDynamicCP(-2706.1326,375.9625,4.9686,3,-1,-1,-1,100.0);
I have no errors or anything...


Re: OnPlayerEnterDynamicCP problem. - Bakr - 17.07.2013

Add checks after each if statement as well so you can see where the code execution stops. Then you will have your problem.


Re: OnPlayerEnterDynamicCP problem. - Necip - 17.07.2013

Did this:
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CP[CityHall])
    {
        print("OnPlayerEnterDynamicCP: Entered");
        if(UnderAttack[CityHall] == 0) {
            print("OnPlayerEnterDynamicCP: Not under attack");
            if(tCP[CityHall] != gTeam[playerid]) {
                print("OnPlayerEnterDynamicCP: Checkpoint entered");
                CountVar[playerid][CityHall] = 25;
                ActiveCityHall(playerid);
                print("OnPlayerEnterDynamicCP: ActiveCityHall started");
            } else return SendClientMessage(playerid, COLOR_RED,"*This zone is already captured by your team!");
        } else return CaptureZoneMessage(playerid, 2);
    }
    return 1;
}
Still didn't call anything...


Re: OnPlayerEnterDynamicCP problem. - Bakr - 17.07.2013

The only thing to conclude from that is that you aren't entering that checkpoint then!