Jump to content
Redhotsteel

TOW SCRIPT NOT WORKING ON MULTIPLAYER

Recommended Posts

Hello all, 

 

got a tow script for my flatbed. Works fine in single player on editor but when the the tow-truck is being used in multiplayer, the vehicle does attach to the flatbed but when you detach or untow, it detaches on top of the flatbed rather then behind it. This results in the car glitching into the truck and blowing it up. Script is posted below: 

 

Quote

client_fnc_towvehicle = {
    params["_car"];
    _car = nearestObjects[vehicle player, ["Car"], 15] select 1;

    if((getpos vehicle player) distance (_car modelToWorld[0, 7, 0]) > 6)exitWith{hint "Vehicle is not aligned to the flatbed"};
    if(speed vehicle player > 1)exitWith{hint "You must be idle."};
    if(isNil "_car")exitWith{hint "No vehicle found."};

    _car setpos ((vehicle player) modelToWorld [0,-4,2]);
    sleep 1;
    _car attachTo[vehicle player];

    vehicle player setVariable["Tow", _car, true];
};

client_fnc_untowvehicle = {
    _car = vehicle player getVariable["Tow", objNull];    
    if(isNull _car)exitWith{hint "No car attached"};
    _car attachTo[vehicle player, [0, -11, 3]];
    detach _car;

    vehicle player setVariable["Tow", objNull, true];
};
 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×