SA-MP Forums Archive
Checkpoint when enter vehicle - 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: Checkpoint when enter vehicle (/showthread.php?tid=443773)



Checkpoint when enter vehicle - goviscrap - 13.06.2013

How to assign a uniqe checkpoint to a car?
and when I enter another car an new checkpoint will appear but in a diffrent place?

And under which public should I use this?

I have done this so far new Truck1 = AddStaticVehicle(515, ...,...,...);
What next?


Re: Checkpoint when enter vehicle - Juanxz - 13.06.2013

I'm not sure if I get you or not but if I do...here's what I think is the way to do it.

pawn Код:
#define TruckCheckPoint 1605.4689,-2493.7014,13.5547
This will be at the top define different checkpoints. You can add as many as you like.

pawn Код:
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 515)
     {
         SetPlayerCheckpoint(playerid, TruckCheckPoint, 3.0);
     }
     return 0;
}
When entering a truck (ID-515), you will enable a checkpoint for that player which was defined above.

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 515)
     {
         DisablePlayerCheckpoint(playerid);
     }
     return 0;
}
On exiting the truck, you will disable the checkpoint.

I hope this helped.


Re: Checkpoint when enter vehicle - goviscrap - 13.06.2013

Ah, Im gonna try that out! Thanks man!


Re: Checkpoint when enter vehicle - goviscrap - 13.06.2013

And Also I want to have a Uniqe Checkpoint for each truck? How to?


Re: Checkpoint when enter vehicle - Juanxz - 14.06.2013

You're welcome. Now regarding the unique checkpoint for each truck,
I think you'll have to do what you mentioned in your original post.

pawn Код:
Truck1 = AddStaticVehicle(515, ...,...,...);
and
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == Truck1)
Haven't tested it out myself but it should work.
Good Luck!

Edit:
You will probably have to add the below at the top section of your gamemode/FS.
pawn Код:
new truck1;



Re: Checkpoint when enter vehicle - goviscrap - 14.06.2013

nvm, I had done this completley wrong :P I've solved it!

Thanks for all reply's! +rep for you guys!