SA-MP Forums Archive
Trailer - 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: Trailer (/showthread.php?tid=616527)



Trailer - MerryDeer - 06.09.2016

Hi,

How to check if trailer attached to any vehicle or not? i know that there is function IsTrailerAttachedToVehicle, but need check any vehicle


Re: Trailer - Josh_Main - 06.09.2016

Use
pawn Код:
if(IsTrailerAttachedToVehicle(vehicleid))
{
   //do something here
}
This gets the ID of the trailer attached to the vehicle
pawn Код:
new trailerid = GetVehicleTrailer(vehicleid);



Re: Trailer - Killa[DGZ] - 06.09.2016

I'm certain you can use a simple vehicle loop for this..

Код:
for(new carid=0; carid < MAX_VEHICLES; carid++)
{
	if(IsTrailerAttachedToVehicle(carid))
	{
	    printf("Vehicle %i has a trailer attached", carid);
	}
}