[Help] Entity damage tracking

Hello!,

For a gamemode I am creating I need to be able to track the ‘health’ of entities on the server side.

A feature of the gamemode is that players can place objects which are destructible by any source of damage. This includes the obvious like guns, explosions and melee. But also vehicle damage driven by players or npcs.

questions:

  • Is there any reliable method to track the health of all entities in a server script?
  • In the native damage events, there is no damage value data, so how is damage calculated? Specifically vehicle collision damage.
  • How is native entity health syncing done between different clients and is there a way to tap into this?

Some solutions that might be plausible but require some help:

Using cEventNetworkEntityDamage
Ideally a server equivalent event would solve all of my problems, but this does not seem to exist. The problem with using this event is that it is client side and I would like my damage tracking server side. Now using this event I could trigger a server event that damage has been done, however, how would this work with multiple users witnessing the same damage event. If two players are triggering the same event twice, the damage will be doubled. The damage event does not have any parameters that would make it unique compared to similar damage events, so filtering incoming events on uniqueness does not seem to be a option.

A other option is for the client to use GetEntityHealth, and trigger a server event with the entity health as argument to the server instead. This seems to be the best option for me however, again when multiple players witness the same event, this server event will be triggered a X amount of times, which seems unnecasary.

weaponDamageEvent
Weapon damage event is a server side event called when two entities damage each other. This would work, however, it does not cover vehicle collision damage. A option would be to use this event, and find another solution specifically for vehicle collision events.