SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/06/2012, 05:41 PM   #1
kaiks
Big Clucker
 
kaiks's Avatar
 
Join Date: Jul 2009
Location: Big Smoke's
Posts: 84
Reputation: 3
Default Checkpoint problem

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.

Last edited by kaiks; 28/06/2012 at 07:04 PM.
kaiks is offline   Reply With Quote
Old 28/06/2012, 07:45 PM   #2
mati233
Big Clucker
 
Join Date: May 2012
Posts: 139
Reputation: 8
Default Re: Checkpoint problem

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
__________________
mati233 is offline   Reply With Quote
Old 28/06/2012, 07:52 PM   #3
-CaRRoT
High-roller
 
-CaRRoT's Avatar
 
Join Date: Jul 2011
Location: CA, Los Angeles.
Posts: 1,230
Reputation: 279
Default Re: Checkpoint problem

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.
-CaRRoT is offline   Reply With Quote
Old 28/06/2012, 07:53 PM   #4
kaiks
Big Clucker
 
kaiks's Avatar
 
Join Date: Jul 2009
Location: Big Smoke's
Posts: 84
Reputation: 3
Default Re: Checkpoint problem

Thanks, but how should i define WorkCheckpoint?
kaiks is offline   Reply With Quote
Old 28/06/2012, 07:54 PM   #5
mati233
Big Clucker
 
Join Date: May 2012
Posts: 139
Reputation: 8
Default Re: Checkpoint problem

new WorkCheckpoint[MAX_PLAYERS];
__________________
mati233 is offline   Reply With Quote
Old 28/06/2012, 08:07 PM   #6
kaiks
Big Clucker
 
kaiks's Avatar
 
Join Date: Jul 2009
Location: Big Smoke's
Posts: 84
Reputation: 3
Default Re: Checkpoint problem

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;
}
kaiks is offline   Reply With Quote
Old 28/06/2012, 09:11 PM   #7
kaiks
Big Clucker
 
kaiks's Avatar
 
Join Date: Jul 2009
Location: Big Smoke's
Posts: 84
Reputation: 3
Default Re: Checkpoint problem

I'm terribly sorry for doubleposting, but i need to get this fixed asap!
kaiks is offline   Reply With Quote
Old 28/06/2012, 09:13 PM   #8
[A]ndrei
Huge Clucker
 
Join Date: Jun 2012
Location: Sacramento
Posts: 381
Reputation: 15
Default Re: Checkpoint problem

put this under #inclue <a_samp>

Code:
new WorkCheckpoint[MAX_PLAYERS];
... and tell me if it working...also +rep.":P
[A]ndrei is offline   Reply With Quote
Old 28/06/2012, 09:16 PM   #9
kaiks
Big Clucker
 
kaiks's Avatar
 
Join Date: Jul 2009
Location: Big Smoke's
Posts: 84
Reputation: 3
Default Re: Checkpoint problem

Well, i have this already there
// edit: it won't delete the second CP and it won't create the third.
kaiks is offline   Reply With Quote
Old 28/06/2012, 09:59 PM   #10
[A]ndrei
Huge Clucker
 
Join Date: Jun 2012
Location: Sacramento
Posts: 381
Reputation: 15
Default Re: Checkpoint problem

you trying to make a race
[A]ndrei is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
checkpoint problem +REP peterory Scripting Help 2 09/06/2012 08:00 AM
Checkpoint problem ajwar Scripting Help 0 03/09/2011 08:33 PM
checkpoint problem hadzx Help Archive 1 13/03/2011 06:48 PM
Checkpoint problem aircombat Help Archive 7 05/06/2010 03:29 PM
Checkpoint problem killdahobo99 Help Archive 5 14/07/2009 02:42 PM


All times are GMT. The time now is 12:12 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.