PDA

View Full Version : Checkpoint when enter vehicle


goviscrap
13/06/2013, 07:49 PM
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?

Juanxz
13/06/2013, 08:15 PM
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.


#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.


}
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.


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.

goviscrap
13/06/2013, 09:52 PM
Ah, Im gonna try that out! Thanks man!

goviscrap
13/06/2013, 09:59 PM
And Also I want to have a Uniqe Checkpoint for each truck? How to?

Juanxz
14/06/2013, 07:30 AM
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.

Truck1 = AddStaticVehicle(515, ...,...,...);
and
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.

new truck1;

goviscrap
14/06/2013, 03:56 PM
nvm, I had done this completley wrong :P I've solved it!

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