heiligerbimbam2103 Posted August 21, 2021 Posted August 21, 2021 (edited) Hey guys. I'm searching now for several days to solve this problem.... Currently i'm working on my own roleplay server with own resources etc.. Now iam at the point to code my vehicle manager. The point is that players should not save their car/plane/boat in a garage or whatever and spawn them completely repaired. I worked previously on FiveM and there are some functions to get vehicle damage. What are the correct functions/events or whatever to GET vehicle damage and the correct functions to SET vehicle damage. And if it is possible.. Can i apply cosmetic damage to a vehicle? If you have some examples please provide them in JS. On C# im not very good Your help would be really great. Greetings Bimbam2103 Edited August 21, 2021 by heiligerbimbam2103 Added another part of the problem
Sab0y Posted August 22, 2021 Posted August 22, 2021 (edited) Hey, wiki is your friend, not your enemy. BodyHealth: get: https://wiki.rage.mp/index.php?title=Vehicle::getBodyHealth set: https://wiki.rage.mp/index.php?title=Vehicle::setBodyHealth EngineHealth: get: https://wiki.rage.mp/index.php?title=Vehicle::getEngineHealth set: https://wiki.rage.mp/index.php?title=Vehicle::setEngineHealth PetrolTankHealth: get: https://wiki.rage.mp/index.php?title=Vehicle::getPetrolTankHealth set: https://wiki.rage.mp/index.php?title=Vehicle::setPetrolTankHealth https://wiki.rage.mp/index.php?title=Vehicle::Vehicle I hope it helps Edited August 22, 2021 by Sab0y
heiligerbimbam2103 Posted August 22, 2021 Author Posted August 22, 2021 (edited) Hi and thank you for your help I will use this functions. Are there any functions to set cosmetic damage? As example. If i drive in front of a wall the front of a car gets damage. Can i reset this damage? I found a function to set damage in a sphere to the car. But... Can i get the damage that was applied? I've found already that i can check if the door is damaged. Any suggestions to detect damage of the body? Greetings and thank you very much And just to say I already use the wiki very intensive hahaha and some natives Edited August 22, 2021 by heiligerbimbam2103 Added some information
Spechen Posted August 22, 2021 Posted August 22, 2021 (edited) On 8/22/2021 at 4:18 PM, Sab0y said: Hey, wiki is your friend, not your enemy. BodyHealth: get: https://wiki.rage.mp/index.php?title=Vehicle::getBodyHealth set: https://wiki.rage.mp/index.php?title=Vehicle::setBodyHealth EngineHealth: get: https://wiki.rage.mp/index.php?title=Vehicle::getEngineHealth set: https://wiki.rage.mp/index.php?title=Vehicle::setEngineHealth PetrolTankHealth: get: https://wiki.rage.mp/index.php?title=Vehicle::getPetrolTankHealth set: https://wiki.rage.mp/index.php?title=Vehicle::setPetrolTankHealth https://wiki.rage.mp/index.php?title=Vehicle::Vehicle I hope it helps Hello, this is not what asked by heiligerbimbam2103, all of this doesn't affect the visual bodywork of any vehicle The only fact that change the engine health and petrol tank health is if the engine will smoke or catch fire, or the petrol tank will leak, the bodywork is totally logical I'm following this topic because I'm looking for a way to get the visual damage of the vehicle's bodywork (we can set damage with this setter https://wiki.rage.mp/index.php?title=Vehicle::setDamage ) Edited August 23, 2021 by Spechen
heiligerbimbam2103 Posted August 28, 2021 Author Posted August 28, 2021 Am 22.8.2021 um 23:20 schrieb Spechen: Hello, this is not what asked by heiligerbimbam2103, all of this doesn't affect the visual bodywork of any vehicle The only fact that change the engine health and petrol tank health is if the engine will smoke or catch fire, or the petrol tank will leak, the bodywork is totally logical I'm following this topic because I'm looking for a way to get the visual damage of the vehicle's bodywork (we can set damage with this setter https://wiki.rage.mp/index.php?title=Vehicle::setDamage ) Thank you for your support. I'll hope we get some answers because in Discord or other ways there was no answer. Greetings
sparx Posted August 29, 2021 Posted August 29, 2021 You can invoke a lot of "getVehicle..." natives that control the state of the vehicle, including dirt, door statuses, headlights etc - and there's even a native to copy the complete visual damage from one vehicle to another. Use these natives to store the state of the vehicle in more detail, and apply that when the vehicle is spawned again. Examples of all the natives are here (https://cdn.rage.mp/public/natives/#native_0x8F17BC8BA08DA62B) 1
Spechen Posted August 30, 2021 Posted August 30, 2021 Quote Use these natives to store the state of the vehicle in more detail, and apply that when the vehicle is spawned again That's exactly what i'm looking for, which natives should I use ?
sparx Posted August 30, 2021 Posted August 30, 2021 This (i assume) will be your main setter for vehicle visual damage: https://cdn.rage.mp/public/natives/#native_0xA1DD317EA8FD4F29 potentially paired with: https://cdn.rage.mp/public/natives/#native_0x4EC6CFBC7B2E9536 But I'm not sure if there is any proper getters relating to the first native, I'd probably save some vital stats of the vehicle through other natives and just generically (or randomly) apply damage based on those calculations . I've never wrote a script that handled visual damage before, but that's where I'd start. I'd learn those natives and try and find use cases for them and/or build a more generic system around it. 3
heiligerbimbam2103 Posted August 30, 2021 Author Posted August 30, 2021 vor einer Stunde schrieb sparx: This (i assume) will be your main setter for vehicle visual damage: https://cdn.rage.mp/public/natives/#native_0xA1DD317EA8FD4F29 potentially paired with: https://cdn.rage.mp/public/natives/#native_0x4EC6CFBC7B2E9536 But I'm not sure if there is any proper getters relating to the first native, I'd probably save some vital stats of the vehicle through other natives and just generically (or randomly) apply damage based on those calculations . I've never wrote a script that handled visual damage before, but that's where I'd start. I'd learn those natives and try and find use cases for them and/or build a more generic system around it. This seams to be the correct natives for the problem i try to solve. Thank you very much for your help. Greetings 1
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