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



Keeping vehicle - NRJ53 - 20.12.2011

Hello

Is there a way to keep a vehicle on a back of another vehicle, eg. Sultan on the back of DFT.

Thanks.


Re: Keeping vehicle - coole210 - 20.12.2011

Yes there is a way.

Explanation:

Set the position of following vehicle to the position of the other vehicle's position (Just change Y pos)

Execution:

Код:
new VehicleFollow[MAX_VEHICLES]=-1;
//In a command:
VehicleFollow[VEHICLEID1] = [VEHICLEID2];
//In a timer:
new Float:Pos[3];
for(new i = 0; i <= MAX_VEHICLES; i++)
{
if(VehicleFollow[i] != -1)
{
GetVehiclePos(VehicleFollow[i],Pos[0],Pos[1],Pos[2]);
SetVehiclePos(i,Pos[0],Pos[1]-8,Pos[2]);
}
}
Good luck.


Re: Keeping vehicle - NRJ53 - 20.12.2011

Works, Thank you.