PDA

View Full Version : OnPlayerEnterDynamicCP problem.


Necip
17/07/2013, 11:17 AM
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:
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
CP[CityHall] = CreateDynamicCP(-2706.1326,375.9625,4.9686,3,-1,-1,-1,100.0);

I have no errors or anything...

Bakr
17/07/2013, 11:22 AM
Add checks after each if statement as well so you can see where the code execution stops. Then you will have your problem.

Necip
17/07/2013, 11:27 AM
Did this:
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...

Bakr
17/07/2013, 11:33 AM
The only thing to conclude from that is that you aren't entering that checkpoint then!