Attaching trailer to vehicle not working - 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: Attaching trailer to vehicle not working (
/showthread.php?tid=107980)
Attaching trailer to vehicle not working -
Redirect Left - 11.11.2009
Hey, i have a small issue with this small bit of code, namely it doesn't actually work, it compiles fine, but won't actually attach "OBJ" (the trailer) to "TRU" (the truck)
This is under OnGameModeInit
pawn Код:
TRU = AddStaticVehicle(515,1266.4149,-2037.4900,60.2510,178.2439,-1,-1); // ROADTRAIN
OBJ = AddStaticVehicle(584,1266.7483,-2025.5421,60.2522,178.5712,24,77); // Trailer
AttachTrailerToVehicle(OBJ,TRU);
This should spawn the vehicles, then attach them for the first time,
Then obviously during the mission, they're likely going to get destroyed somehow, so for when they respawn, i have this;
pawn Код:
public OnVehicleSpawn(vehicleid)
{
if(vehicleid == TRU) { SetVehicleToRespawn(OBJ); } // Set the trailer to respawn too
if(vehicleid == OBJ) { AttachTrailerToVehicle(OBJ,TRU); } // Attach it to the truck
return 1;
}
However both times, the trailer (OBJ) is not attached to it's pulling truck (TRU), any ideas?
Re: Attaching trailer to vehicle not working -
DiDok - 12.11.2009
Maybe they are not streamed in when you try to attach them?
Re: Attaching trailer to vehicle not working -
Tr1viUm - 27.11.2009
There must be someone in the vehicle (as driver afaik) when you use AttachTrailerToVehicle.
Re: Attaching trailer to vehicle not working -
cloud9 - 27.11.2009
Quote:
|
Originally Posted by [MOB
Tr1viUm ]
There must be someone in the vehicle (as driver afaik) when you use AttachTrailerToVehicle.
|
Yea this is true. You need someone in vehicle for attaching trailers.