tobias131994 Posted August 3, 2020 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
Evgeniy_Moguchiy Posted August 3, 2020 Posted August 3, 2020 Try to close the car after creating it. vehicle.locked = true;
tobias131994 Posted August 3, 2020 Author 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
J0NAH26 Posted August 4, 2021 Posted August 4, 2021 setTimeout(() => { vehicle.locked = true; }, 250); For other people, that works.
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