Sorginator Posted August 30, 2019 Share Posted August 30, 2019 (edited) Hello, I've a problem with the vehicle system an no idea how to fix it. When I spawn a vehicle, it doesn't get any damage, but I get the first time into the vehicle, it can get damage. However, when I get out again, I can do what I want, it gets no more damage (only visually, it will still got damaged). Even a renewed entry brings nothing. The effect always occurs after the first time getting out of the vehicle. Every player on my server has the same Problem, so it's not a problem of my client (only) i think. Is there a way to fix it? Edited August 30, 2019 by Sorginator Link to comment Share on other sites More sharing options...
MrPancakers Posted August 31, 2019 Share Posted August 31, 2019 Vehicles without any drivers won't receive any damage However, your issue where even as a driver it still won't take damage after getting out and back in is a bug, what you can do to fix this is call the playerEnterVehicle event and call the `vehicle.setInvincible(false)` function and this will let the car take damage again. https://wiki.rage.mp/index.php?title=Entity::setInvincible FYI this is a client-side function. Link to comment Share on other sites More sharing options...
Sorginator Posted August 31, 2019 Author Share Posted August 31, 2019 (edited) At first thanks for your replie @MrPancakers I've tried to use this function with the following code: mp.events.add("playerEnterVehicle", (player, vehicle, seat) => { if (player = mp.players.local) { vehicle.setInvincible(false); } }); By entering a vehicle I get an error, that "setInvinvible" is not a function, so i tried the following: mp.events.add("playerEnterVehicle", (player, vehicle, seat) => { if (player = mp.players.local) { mp.gui.chat.push(vehicle.setInvincible + "") } }); After entering a vehicle another time, the chat says "undefined". Did I write something wrong, or where is my failure? Edited August 31, 2019 by Sorginator Link to comment Share on other sites More sharing options...
MrPancakers Posted August 31, 2019 Share Posted August 31, 2019 9 hours ago, Sorginator said: At first thanks for your replie @MrPancakers I've tried to use this function with the following code: mp.events.add("playerEnterVehicle", (player, vehicle, seat) => { if (player = mp.players.local) { vehicle.setInvincible(false); } }); By entering a vehicle I get an error, that "setInvinvible" is not a function, so i tried the following: mp.events.add("playerEnterVehicle", (player, vehicle, seat) => { if (player = mp.players.local) { mp.gui.chat.push(vehicle.setInvincible + "") } }); After entering a vehicle another time, the chat says "undefined". Did I write something wrong, or where is my failure? Your second example doesn't work because that isn't how you call a function, you didn't say if it was true or false. Your if statements don't make sense either, I don't actually understand what you're trying to do with that, one = assigns a value to a variable, it doesn't check if it's 'equal to' On the client side, "playerEnterVehicle" doesn't have a player parameter so that's why your event doesn't work. Client-side mp.events.add("playerEnterVehicle", (vehicle, seat) => { vehicle.setInvincible(false); }); 1 Link to comment Share on other sites More sharing options...
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