Attaching a trailer on CreateVehicle
#1

I have a /vsave and /vload function, and it saves the position and angle of the vehicle you're in, and the model of your trailer (if any).

On /vload CreateVehicle is used to create the vehicle, and this is the code, including the trailer attaching:

pawn Код:
sscanf(templine, "iffffI(0)", model, x, y, z, angle, trailer);
new vid = CreateVehicle(model, x, y, z, angle, -1, -1, 60);
SetVehicleVirtualWorld(vid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vid, GetPlayerInterior(playerid));
if(trailer > 399)
{
    new trailerid = CreateVehicle(trailer, x, y, z, angle, -1, -1, -1);
    LinkVehicleToInterior(trailerid, GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(trailerid, GetPlayerVirtualWorld(playerid));
    AttachTrailerToVehicle(trailerid, vid);
}
But there's a delay with the vehicles spawning, and the trailer doesn't get attached -_- what can I do apart from use a timer? Perhaps OnVehicleStreamIn?

P.S For now I'm using a 1.5 second timer, but it looks stupid when you load the vehicle :/

EDIT: I've sort of made a work-around using OnVehicleStream in, but it required a 2000 cell array and has bugs. This BUG needs to be fixed. If I attach a trailer to a vehicle, I expect it to be attached.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)