Jump to content
RAGE Multiplayer Community

Spawn vehicle with locked doors


Recommended Posts

Hey,

i would like to spawn vehicles with closed doors but it doesn't work.

Sometimes the doors are closed, but in most cases the doors are open. 

I am working on the following branch: "10_mNwuchuQ4ktWbR8d2N5jUzRt"

spacer.png

 

Thanks!

Best regards

Link to post
Share on other sites
Posted (edited)

I've already tried that, but it didn't work either.

I have now tried to handle the whole client side. But now its not working for the first car of each model. It works from the second of each model.

 

 

    	"entityStreamIn": (entity) => {
                if (entity.type === 'vehicle') {
                    // lock car
                    let locked = entity.getVariable("locked");
                    if (locked) {
                        entity.setDoorsLocked(2);
                    }
                    else {
                        entity.setDoorsLocked(1);
                    }
                }
            }
            
        mp.events.addDataHandler("locked", (vehicle, value) => {
            if (value) {
                vehicle.setDoorsLocked(2);
            }
            else {
                vehicle.setDoorsLocked(1);
            }
        });
        var vehicle = mp.vehicles.new(parseInt(model), position,
            {
                heading: heading,
                numberPlate: "TEST",
                color: [constants.COLORS[Math.floor(Math.random() * 158)].RGB.match(/\d+/g),constants.COLORS[Math.floor(Math.random() * 158)].RGB.match(/\d+/g)],
                engine: false,
                dimension: player.dimension
            }
        );
        vehicle.setVariable("locked", true);
        vehicle.setVariable("tank", tank);

 

Thanks for your help!

 

Best regards

Tobias

 

 

Edited by tobias131994
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...