tobias131994 0 Posted August 3, 2020 Share Posted August 3, 2020 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" Thanks! Best regards Link to post Share on other sites
Evgeniy_Moguchiy 0 Posted August 3, 2020 Share Posted August 3, 2020 Try to close the car after creating it. vehicle.locked = true; Link to post Share on other sites
tobias131994 0 Posted August 3, 2020 Author Share Posted August 3, 2020 (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 August 4, 2020 by tobias131994 Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now