Jump to content
RAGE Multiplayer Community

client side vehicle


Recommended Posts

Hello. I create a transport on the server side and create an event on the client side for the transport to start the engine or turn on the headlights. But nothing works.

mp.events.add('playerJoin', (player) => {
    player.spawn(new mp.Vector3(2550.088, 4691.932, 33.618));
    var theVehicle = mp.vehicles.new(mp.joaat("hauler"), new mp.Vector3(2544.879, 4664.066, 34.076),
        {
            numberPlate: "513485"
        });
    theVehicle.setColor(255, 0);
    player.call('engineOn', [theVehicle]);
});
mp.events.add('engineOn', (theVehicle) => {
    if (theVehicle) {
        theVehicle.setEngineOn(true, true, false);
    }
});

 

Link to post
Share on other sites
mp.events.add('playerJoin', (player) => {
    player.spawn(new mp.Vector3(2550.088, 4691.932, 33.618));
    var theVehicle = mp.vehicles.new(mp.joaat("hauler"), new mp.Vector3(2544.879, 4664.066, 34.076),
        {
            numberPlate: "513485"
        });
    theVehicle.setColor(255, 0);
    theVehicle.setEngineOn(true, true, false);
});

In your case you are mixing server-side and client-side together.
Player.call triggers an client-side event from serverside.

Else do mp.events.call("engineOn", theVehicle);

Edited by Division
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...