Checkpoint problem
#1

Okay i have a problem with Checkpoints, the first CP is good, but the second isn't,
it doesn't stop loading the cargo off. Also i have 4 checkpoints more to go, but i haven't finished them,
because the second one doesn't work well.

Heres the /work code, it works fine, but i'm just adding it here for you to see my first CP.
pawn Code:
if(strcmp(cmdtext, "/tццle", true) == 0)
{
    if(gTeam[playerid] != 2) return SendClientMessage(playerid, COLOR_GREY, "Sa ei ole kaubavedaja!");
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 440) return SendClientMessage(playerid, COLOR_GREY, "Sa ei ole kaubavedaja autos!");

    if(gTeam[playerid] ==  2)
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440)
        {
        SendClientMessage(playerid, COLOR_GREY, "Alustasid tццd, mine vхta kaup peale.");
        SetPlayerCheckpoint(playerid,120.403518, -294.375122, 1.578125, 3.0);
        }
       
    return 1;
}
    return 1;

}
Ok, here's the bad boy.


pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{

     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440)
     {
        if(gTeam[playerid] ==  2)   // The carbo is being loaded on the bus or smth like that
        GameTextForPlayer(playerid, "Kaupa laetakse peale...", 6950, 3);
        TogglePlayerControllable(playerid, 0);
        SetTimerEx("UnfreezePlayer", 7000, false, "d", playerid);
        SetPlayerCheckpoint(playerid,203.737503, -181.615310, 1.578125,3);
        return 1;
    }

     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440)
     {
        if(gTeam[playerid] ==  2)   // The cargo is being loaded off the bus or smth like that
        GameTextForPlayer(playerid, "Kaupa laetakse maha...", 6950, 3);
        TogglePlayerControllable(playerid, 0);
        SetTimerEx("UnfreezePlayer", 7000, false, "d", playerid);
        SetPlayerCheckpoint(playerid,681.379150, -443.011749, 16.335937, 3);
        return 1;
    }
     return 1;
}
Oh and i want it to say "The cargo is being loaded on the bus" for the first CP and
"The cargo is being loaded off the bus" for 4 others.

Here are the coordinates for the other 4 Checkpoints:
pawn Code:
SetPlayerCheckpoint(playerid,156.981262, -167.841812, 1.578125, 3);
SetPlayerCheckpoint(playerid,663.840759, -548.668701, 16.335937, 3);
SetPlayerCheckpoint(playerid,714.766601, -569.432983, 16.335937, 3);
SetPlayerCheckpoint(playerid,124.784370, -268.202026, 1.578125, 3); // End
I don't want you to make it for me, just give me tips how should i make the checkpoint system.
Reply
#2

You should create some pVar where you store the checkpoint order.
My suggestion is to you add on /work, the first checkpoint position, something like this:
WorkCheckpoint[playerid]=1;
and then, onplayerentercheckpoint you check if the workcheckpoint is 1, create the 2nd one and change the WorkCheckpoint[playerid] to 2, and so on until the last one.

I hope this helps you, but let me know if you need more help
Reply
#3

You can use
PHP Code:
Switch 
OR

Just make CP Id's for each one

like.. Once the player enter the First

It sets CP[playerid] = 500

the second - CP[playerid] = 501

etc. - And so on.
Reply
#4

Thanks, but how should i define WorkCheckpoint?
Reply
#5

new WorkCheckpoint[MAX_PLAYERS];
Reply
#6

Ok, please tell me where to put it, idk if my placement is right, because it doesn't change anything.
pawn Code:
if(strcmp(cmdtext, "/tццle", true) == 0)
{
    if(gTeam[playerid] != 2) return SendClientMessage(playerid, COLOR_GREY, "Sa ei ole kaubavedaja!");
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 440) return SendClientMessage(playerid, COLOR_GREY, "Sa ei ole kaubavedaja autos!");


    if(gTeam[playerid] ==  2)
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440)
        {
        SendClientMessage(playerid, COLOR_GREY, "Alustasid tццd, mine vхta kaup peale.");
        WorkCheckpoint[playerid] = 1;
        SetPlayerCheckpoint(playerid,120.403518, -294.375122, 1.578125, 3.0);
        }

    return 1;
}
    return 1;

}
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{
     if (WorkCheckpoint[playerid] == 1)
     WorkCheckpoint[playerid] = 2;
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440)
     {
        if(gTeam[playerid] ==  2)   // The carbo is being loaded on the bus or smth like that
        GameTextForPlayer(playerid, "Kaupa laetakse peale...", 6950, 3);
        TogglePlayerControllable(playerid, 0);
        SetTimerEx("UnfreezePlayer", 7000, false, "d", playerid);
        SetPlayerCheckpoint(playerid,203.737503, -181.615310, 1.578125,3);
        return 1;
    }

     if (WorkCheckpoint[playerid] == 2)
     WorkCheckpoint[playerid] = 3;
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440)
     {
        if(gTeam[playerid] ==  2)   // The cargo is being loaded off the bus or smth like that
        GameTextForPlayer(playerid, "Kaupa laetakse maha...", 6950, 3);
        TogglePlayerControllable(playerid, 0);
        SetTimerEx("UnfreezePlayer", 7000, false, "d", playerid);
        SetPlayerCheckpoint(playerid,681.379150, -443.011749, 16.335937, 3);
        return 1;
    }
     return 1;
}
Reply
#7

I'm terribly sorry for doubleposting, but i need to get this fixed asap!
Reply
#8

put this under #inclue <a_samp>

Code:
new WorkCheckpoint[MAX_PLAYERS];
... and tell me if it working...also +rep.":P
Reply
#9

Well, i have this already there
// edit: it won't delete the second CP and it won't create the third.
Reply
#10

you trying to make a race
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)