Dynamic cp problem
#1

Hello, im creating a turf take over system and everything is ok, the problem is in the checkpoints. It doesnt start capturing..

OnPlayerEnterDynamicCP:

pawn Код:
if(checkpointid == CPs[AbandonedAp])
   {
     if(tCP[AbandonedAp] == gTeam[playerid]) return SendClientMessage(playerid, COLOR_RED,"This zone is already captured by your team");
     if(UnderAttack[AbandonedAp] == 1) return SendClientMessage(playerid, COLOR_RED,"This zone is already being taken over!");
     UnderAttack[AbandonedAp] = 1;
     timer[playerid][AbandonedAp] = SetTimerEx("SetZone",30000,false,"i", playerid);
     SendClientMessage(playerid, COLOR_YELLOW,"You're Capturing this zone! Wait here for 30 Seconds!");
     iCP[playerid] = AbandonedAp;
   }
Seems he can't detect when im inside the checkpoint, but i exit the cp..

pawn Код:
if(checkpointid == CPs[AbandonedAp])
    {
     GameTextForPlayer(playerid, "Left CP", 1000, 3);
     KillTimer(timer[playerid][AbandonedAp]);
     UnderAttack[AbandonedAp] = 0;
     iCP[playerid] = -1;
    }
It gives me "Left cp" message.

What can be wrong?
Reply
#2

Debug. Put a formatted clientmessage at the top like so:

pawn Код:
new szDebug[144];
format(szDebug, sizeof(szDebug), "OnPlayerEnterDynamicCP(%i) - %i", checkpointid, CPs[AbandonedAp]);
SendClientMessage(..);
Check to see if:

1. It's called
2. checkpointid == CPs[AbandonedAp]
Reply
#3

Nothing, i don't get even the message.
Reply
#4

there are some include blocking the callback from being called.

What include are you using?
Can you show us your OnPlayerEnterDynamicCP.
Reply
#5

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
there are some include blocking the callback from being called.

What include are you using?
Can you show us your OnPlayerEnterDynamicCP.
I'm 100% sure no include is blocking the callback because other checkpoints are called, however:

pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CPs[0]) //Usa Team Shop
    {
    Shop(playerid);
    }
   
    if(checkpointid == CPs[1]) //GermanyTeamShop
    {
    Shop(playerid);
    }
   
    if(checkpointid == CPs[2]) //RussianTeamShop
    {
    Shop(playerid);
    }
   
    if(checkpointid == CPs[3])  //JapanTeamShop
    {
    Shop(playerid);
    }
   
    if(checkpointid == CPs[4]) //A69 Prototype CP
    {
    if(StealingA69Prot[playerid] == 1)
    {
    new playervehicleid = GetPlayerVehicleID(playerid);
    if(playervehicleid == A69Prot)
    {
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
    SetVehicleToRespawn(A69Prot);
    GivePlayerMoney(playerid, 15000);
    StealingA69Prot[playerid] = 0;
    GameTextForPlayer(playerid, "You ~r~stole ~w~the ~g~Area69 Prototype ~w~!", 5000, 3);
    CheckForLevelUpdate(playerid);
    new pname[24];
    GetPlayerName(playerid, pname, 24);
    new kk[128];
    format(kk, sizeof(kk), "** %s (%d) successfully stole the Area69 Prototype!",pname,playerid);
    SCMTA(0xC93CCE00,kk);
    new string[128];
    format(string, sizeof(string), "05,8** %s (%d) successfully stole the Area69 Prototype!", pname,playerid);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
    SetPVarInt(playerid,"StealingTime",GetTickCount()+600000);
    DisablePlayerCheckpoint(playerid);
    }
    }
   
    //Gangzons checkpoint
    if(checkpointid == CPs[AbandonedAp])
   {
     if(tCP[AbandonedAp] == gTeam[playerid]) return SendClientMessage(playerid, COLOR_RED,"This zone is already captured by your team");
     if(UnderAttack[AbandonedAp] == 1) return SendClientMessage(playerid, COLOR_RED,"This zone is already being taken over!");
     UnderAttack[AbandonedAp] = 1;
     timer[playerid][AbandonedAp] = SetTimerEx("SetZone",30000,false,"i", playerid);
     SendClientMessage(playerid, COLOR_YELLOW,"You're Capturing this zone! Wait here for 30 Seconds!");
     iCP[playerid] = AbandonedAp;
   }
   }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Face9000
Посмотреть сообщение
pawn Код:
if(checkpointid == CPs[AbandonedAp])
    {
     GameTextForPlayer(playerid, "Left CP", 1000, 3);
     KillTimer(timer[playerid][AbandonedAp]);
     UnderAttack[AbandonedAp] = 0;
     iCP[playerid] = -1;
    }
It gives me "Left cp" message.

What can be wrong?
If you have that code inside your script its pretty reasonable to show the text "left cp".
Reply
#7

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
If you have that code inside your script its pretty reasonable to show the text "left cp".
That code is inside OnPlayerLeaveDynamicCP.
Reply
#8

Try this, I think you messed up some braces:
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CPs[0]) //Usa Team Shop
    {
    Shop(playerid);
    }

    if(checkpointid == CPs[1]) //GermanyTeamShop
    {
    Shop(playerid);
    }

    if(checkpointid == CPs[2]) //RussianTeamShop
    {
    Shop(playerid);
    }

    if(checkpointid == CPs[3])  //JapanTeamShop
    {
    Shop(playerid);
    }

    if(checkpointid == CPs[4]) //A69 Prototype CP
    {
        if(StealingA69Prot[playerid] == 1)
        {
            new playervehicleid = GetPlayerVehicleID(playerid);
            if(playervehicleid == A69Prot)
            {
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
                SetVehicleToRespawn(A69Prot);
                GivePlayerMoney(playerid, 15000);
                StealingA69Prot[playerid] = 0;
                GameTextForPlayer(playerid, "You ~r~stole ~w~the ~g~Area69 Prototype ~w~!", 5000, 3);
                CheckForLevelUpdate(playerid);
                new pname[24];
                GetPlayerName(playerid, pname, 24);
                new kk[128];
                format(kk, sizeof(kk), "** %s (%d) successfully stole the Area69 Prototype!",pname,playerid);
                SCMTA(0xC93CCE00,kk);
                new string[128];
                format(string, sizeof(string), "05,8** %s (%d) successfully stole the Area69 Prototype!", pname,playerid);
                IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
                SetPVarInt(playerid,"StealingTime",GetTickCount()+600000);
                DisablePlayerCheckpoint(playerid);
            }
        }
    }

    //Gangzons checkpoint
    if(checkpointid == CPs[AbandonedAp])
    {
        if(tCP[AbandonedAp] == gTeam[playerid]) return SendClientMessage(playerid, COLOR_RED,"This zone is already captured by your team");
        if(UnderAttack[AbandonedAp] == 1) return SendClientMessage(playerid, COLOR_RED,"This zone is already being taken over!");
        UnderAttack[AbandonedAp] = 1;
        timer[playerid][AbandonedAp] = SetTimerEx("SetZone",30000,false,"i", playerid);
        SendClientMessage(playerid, COLOR_YELLOW,"You're Capturing this zone! Wait here for 30 Seconds!");
        iCP[playerid] = AbandonedAp;
    }
    return 1;
}
Reply
#9

Finally it works, thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)