robearded Posted March 17, 2019 Posted March 17, 2019 (edited) Edit: While we wait for an update where this would work like it should, there is a temporary fix that anybody can use: Handle the event OnVehicleEnter server-side (the client-side one triggers when player starts to enter the vehicle, the serverside one triggers when player is already in vehicle), on that event handler send an event to the player (if seat == -1, so only if the seat he entered is the driver seat) and on the clientside handle the event sent from the server and inside the method put "localPlayer.vehicle.setInvincible(false)" (https://wiki.rage.mp/index.php?title=Entity::setInvincible) So after trying for more than 10 mins to destroy my car I was wondering why it is not destroying, so I started doing some research. Apparently the bodyLoss is not applied to the vehicle health, only the engineLoss. So I implemented the vehicle damage event (which gets called because I'm printing something in console) which reduces the bodyLoss from the health. But apparently it still doesn't reduces it's health. [ServerEvent(Event.VehicleDamage)] private void Event_VehicleDamage(Vehicle vehicle, float bodyLoss, float engineLoss) { Console.WriteLine("VehicleDamage0"); vehicle.Health -= bodyLoss; // Reduce bodyLoss from vehicle health if(vehicle.Health <= -4000) // After doing some reasearch minimum vehicle health is -4000 (and at that point becomes unusable) { // Warp the players from the vehicle out and then destroy the vehicle foreach(Client occupant in vehicle.Occupants) { occupant.WarpOutOfVehicle(); } vehicle.Delete(); // Wanted to use vehicle.Explode() instead but apparently it doesn't exist, there is a function inside NAPI.Vehicle which is called ExplodeVehicle but that just throws an exception into the console saying no ExplodeVehicle function found inside bridge DLL } } https://imgur.com/a/1MDgu4G Edit: VehicleDamage is very weird, now it doesn't even gets called at all (I didn't modified the script). Edit2: After a second try, if I was being kicked from the server and I joined the server again without restarting the game the event VehicleDamage wasn't being called when damaging a vehicle after I rejoined. Also, after a third try to reproduce the kick bug, the event worked just fine even after being kicked. This is so strange. Edit3: This event is so broken. So after doing some more tests I've come to a realize that it wasn't because I got kicked from the server that the event stopped being called, it was because i left the car. For some unknown reason after I exit a car it stops on giving damage event even if i re-enter it. I will upload a video soon. Here is the video (it may be still processing): After a little more studying it happens with every vehicle. The first time you enter it, any damage applied to the vehicle why you are inside calls the event VehicleDamage for that vehicle. If you exit the vehicle then the event will stop being called for that specific vehicle even if you re-enter it. If you enter a second vehicle, the event for the second vehicle will work just fine, until you exit that too, then it stops for that vehicle too. Edited June 3, 2019 by robearded
Maximus Posted March 17, 2019 Posted March 17, 2019 I confirm this is a bug. Some say that the bug will be fixed in version 0.4. Fix the bug in the current version I could not. Скрытый текст 1
robearded Posted March 17, 2019 Author Posted March 17, 2019 5 minutes ago, Maximus said: I confirm this is a bug. Some say that the bug will be fixed in version 0.4. Fix the bug in the current version I could not. Hide contents Let's hope it will be fixed soon, I care more about those bugs that makes some type of gamemodes impossible than big features (well, maybe because I don't know what's gonna come in 0.4), but for the type of the gamemode I'm developing I need the vehicles to be damageable. Is there an estimated release time for the 0.4? Or is there any chance to get a smaller update just to fix little bugs like this?
robearded Posted June 2, 2019 Author Posted June 2, 2019 25 minutes ago, Mentanding said: Does anyone know when this is being fixed? 🙂 I have no info about that, however there is a 'fix' for it. After player enters a vehicle you have to set that vehicle.invincibility to false (you gotta do it clientside as .invincibility is not implemented on the serverside api yet) and the vehicle will start getting damage like it should. 2
Mentanding Posted June 2, 2019 Posted June 2, 2019 vor 11 Minuten schrieb robearded: I have no info about that, however there is a 'fix' for it. After player enters a vehicle you have to set that vehicle.invincibility to false (you gotta do it clientside as .invincibility is not implemented on the serverside api yet) and the vehicle will start getting damage like it should. thank u 👌 now it getting damage like it should 🙌
joew Posted June 3, 2019 Posted June 3, 2019 (edited) vehicle.invincibility for javascript, please? Can't find the function. Ty!!!! Edited June 3, 2019 by joew
Maximus Posted June 3, 2019 Posted June 3, 2019 5 часов назад, joew сказал: vehicle.invincibility for javascript, please? Can't find the function. Ty!!!! Probably this function https://wiki.rage.mp/index.php?title=Entity::setInvincible I haven’t yet checked, but by description this is what you need. 1
joew Posted June 3, 2019 Posted June 3, 2019 9 hours ago, Maximus said: Probably this function https://wiki.rage.mp/index.php?title=Entity::setInvincible I haven’t yet checked, but by description this is what you need. I'm going test it tonight, thank you very much!!!!
Kozanoglu Posted June 4, 2019 Posted June 4, 2019 I think it's because of vehicle damage sync. Hope will be fixed soon.
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