SA-MP Forums Archive
Checkpoint When Trailer Is Attached - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Checkpoint When Trailer Is Attached (/showthread.php?tid=94475)



Checkpoint When Trailer Is Attached - sidhu123 - 30.08.2009

Hey! [SAP]Sidhu here.. I'm currently working on a new GM and I'm in need of some help.
How would I script the following:

I have 2 trailers, A and B. When either A or B get attached to any truck, a checkpoint appears at a certain spot in the game.

All help is greatly appreciated!


Re: Checkpoint When Trailer Is Attached - DeathOnaStick - 30.08.2009

i think you may use that for ur plans:

https://sampwiki.blast.hk/wiki/IsTrailerAttachedToVehicle

just paste it where you want it, and it actually should work, i hope =D
Then u just have to set the checkpoint.

Greetings, DeathOnaStick


Re: Checkpoint When Trailer Is Attached - sidhu123 - 30.08.2009

Quote:
Originally Posted by DeathOnaStick
i think you may use that for ur plans:

https://sampwiki.blast.hk/wiki/IsTrailerAttachedToVehicle

just paste it where you want it, and it actually should work, i hope =D
Then u just have to set the checkpoint.

Greetings, DeathOnaStick
Lol. Thanks, but I knew that part :P

How would I tell it what trailer is it though?
Like if the trailer is trailer A or trailer B (specific trailers), THEN show the checkpoint, otherwise don't.


Re: Checkpoint When Trailer Is Attached - darkrider366 - 30.08.2009

What i would suggest it.
*anything in brackets is pawn*
(if)(vehicle model, is trailer attached)
{
checkpoint show?
return 1;
}
something like that, as i said in another scripting section, i have not done pawn in over 3 months so i cannot remember at all.


Re: Checkpoint When Trailer Is Attached - sidhu123 - 30.08.2009

Well, I did truckt1 = CreateVehicle..., where truckt1 = truck trailer 1.

Now, how do I take truckt1 and put it into code so it checks if truckt1, specifically, is attached to a truck? And if truckt1 is attached to a truck, THEN the checkpoint shows.


Re: Checkpoint When Trailer Is Attached - dougbrowne - 30.08.2009

Quite simple in fact...
pawn Code:
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);

If(IsTrailerAttachedToVehicle(vehicleid) && GetVehicleTrailer(vehicleid) == truckt1)
{
  CODE TO DISPLAY CHECKPOINT FOR TRAILER A ATTACHED TO A TRUCK
}



Re: Checkpoint When Trailer Is Attached - sidhu123 - 31.08.2009

Quote:
Originally Posted by dougbrowne
Quite simple in fact...
pawn Code:
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);

If(IsTrailerAttachedToVehicle(vehicleid) && GetVehicleTrailer(vehicleid) == truckt1)
{
  CODE TO DISPLAY CHECKPOINT FOR TRAILER A ATTACHED TO A TRUCK
}
I shall try that. Thank you