Jump to content
RAGE Multiplayer Community

Get Vehicle Damage and reproduce damage on spawn of vehicle


Recommended Posts

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 xD

 

Your help would be really great.

Greetings

Bimbam2103

Edited by heiligerbimbam2103
Added another part of the problem
Link to comment
Share on other sites

Posted (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 xD I already use the wiki very intensive hahaha and some natives

Edited by heiligerbimbam2103
Added some information
Link to comment
Share on other sites

On 8/22/2021 at 4:18 PM, Sab0y said:

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 by Spechen
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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. 

 

  • Like 1
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...