Jump to content

Spawn vehicle with locked doors


Recommended Posts

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) {
                    else {
        mp.events.addDataHandler("locked", (vehicle, value) => {
            if (value) {
            else {
        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




Edited by tobias131994
Link to comment
Share on other sites

  • 1 year later...

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...