How to teleport car with trailer?
#1

Topic title says all
Reply
#2

SetVehiclePos
AttachTrailerToVehicle

?
Reply
#3

Nope that not help
Reply
#4

How can that not help? It is possible.
Reply
#5

like the AttachTrailerToVehicle is not teleport the trailer to vehicle
Reply
#6

You have to set the trailers position too then.
Reply
#7

You could make a custom function

pawn Код:
stock SetVehicleAndTrailerPos(vehicleid, trailerid, Float:posx, Float:posy, Float:posz)
{
    new Float:bx, Float:by;
    GetVehicleTrailer( vehicleid );
    SetVehiclePos( vehicleid, posx, posy, posz );
    GetXYBehindVehicle( vehicleid, bx, by, 5.0 );
    SetVehiclePos( trailerid, bx, by, posz );
    AttachTrailerToVehicle( trailerid, vehicleid );
    return true;
}
pawn Код:
stock GetXYBehindOfVehicle(vehicleid, &Float:x, &Float:y, Float:distance)
{
    new
        Float:a;
    GetVehiclePos( vehicleid, x, y, a );
    GetVehicleZAngle( vehicleid, a );
    x += ( distance * floatsin( -a+180, degrees ));
    y += ( distance * floatcos( -a+180, degrees ));
}
Can't garantuee that it will work 100%, or work at all.
Reply
#8

I have also tried with SetVehiclePos ( trailer ), but trailer always stays at old pos
Reply
#9

Quote:
Originally Posted by LarzI
Посмотреть сообщение
You could make a custom function

pawn Код:
stock SetVehicleAndTrailerPos(vehicleid, trailerid, Float:posx, Float:posy, Float:posz)
{
    new Float:bx, Float:by;
    GetVehicleTrailer( vehicleid );
    SetVehiclePos( vehicleid, posx, posy, posz );
    GetXYBehindVehicle( vehicleid, bx, by, 5.0 );
    SetVehiclePos( trailerid, bx, by, posz );
    AttachTrailerToVehicle( trailerid, vehicleid );
    return true;
}
pawn Код:
stock GetXYBehindOfVehicle(vehicleid, &Float:x, &Float:y, Float:distance)
{
    new
        Float:a;
    GetVehiclePos( vehicleid, x, y, a );
    GetVehicleZAngle( vehicleid, a );
    x += ( distance * floatsin( -a+180, degrees ));
    y += ( distance * floatcos( -a+180, degrees ));
}
Can't garantuee that it will work 100%, or work at all.
Stocks are supposed to return a value, or am I wrong?
Reply
#10

Not necesarly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)