B2060/B2189: Game event CEventNetworkEntityDamage not working as expected

Description

Usually the CEventNetworkEntityDamage game event is triggered whenever some entity is damaged with the victim/attacker entity id, the weapon hash and some other information passed in args which are useful, for example, in health scripts to allow retrieving the cause of the damage.

In the latest game builds, the event seems to not work properly (don’t know about the other game events cause I wasn’t able to trigger them yet). On b2060 the event is triggered but doesn’t come with the weaponHash and other information. And, as I recently tested just for curiosity, on b2189 the event isn’t even triggered at all.

Example code

on("gameEventTriggered", (event, args) => {
  switch (event) {
    case "CEventNetworkEntityDamage":
      const victim = args[0];
      const attacker = args[1];
      const isFatal = args[3];
      const weaponHash = args[4];
      const isMelee = args[9];
      
      console.log("damage", victim, attacker, isFatal, weaponHash, isMelee);
      break;
  }
})

Output

(default) Killing an NPC using a knife
image

(b2060) Killing an NPC using a knife
image

(b2189) Killing an NPC using a knife
Nothing is triggered

33 Likes

It’s not only CEventNetworkEntityDamage, no game event gets triggered at all. Not even the usual CEventNetworkHostSession etc. :thinking:

So I can confirm that no game events are triggered at all on b2189

1 Like

Yeah, I suspected that. But since I only use CEventNetworkEntityDamage in my scripts I wasn’t sure about the others and how to trigger them.

7 Likes

Same here, no events are triggered at all on 2189

1 Like

Hey guys, we need help!

since b2060 one argument has been added to CEventNetworkEntityDamage between ‘attacker’ and ‘isFatal’ a new unknown boolean.

For b2189 game events are disabled, and may be back until a crash is fixed

2 Likes

b2189 events look to be working

Yes, they are working! This is the way I am handling CEventNetworkEntityDamage now:

// You have to set the build you are using to a replicated convar
// in the server.cfg for the code to work properly
// e.g.: +setr build 2189
const BUILD = GetConvarInt("build", 1604);

on("gameEventTriggered", (event, args) => {
  switch (event) {
    case "CEventNetworkEntityDamage": {
      let i = 0;
      const victim = args[i++];
      const attacker = args[i++];

      i++; // skip unknown value

      if (BUILD >= 2060) i++; // skip unknown 2060 new boolean value
      if (BUILD >= 2189) i++; // skip unknown 2189 new boolean value

      const isFatal = !!args[i++];
      const weaponHash = args[i++];

      i += 5; // skip 5 unknown values

      const isMelee = !!args[i++];
      const vehicleDamageTypeFlag = args[i++];
      
      // consume data
      console.log("damage", victim, attacker, isFatal, weaponHash, isMelee, vehicleDamageTypeFlag);

      break;
    }
  }
})
1 Like

Damage Event still buggy…
It triggered dead event nicely.
but damage event triggers badly between players.

Any more details? :roll_eyes:

I think is was that OneSync thing Damage doesn't register client-sided (OneSync Inf)

I attack myself ped and other ped on the road it detect damage nicely.I use fire to burn myself.It called every milliseconds.
But If I attack other players.It called randomly.About 2seconds/2hits a call.

Now I trying to use weaponDamageEvent see if it can solved or not.

weaponDamageEvent does not having the targetid when using guns

CEventNetworkEntityDamage called every times between players when My ped as victim.
randomly call when my ped as attacker.

1 Like

Legend!!!