Attaching trailer to vehicle not working
#1

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?
Reply
#2

Maybe they are not streamed in when you try to attach them?
Reply
#3

There must be someone in the vehicle (as driver afaik) when you use AttachTrailerToVehicle.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)