API REFERENCE
SendNetworkDamage
Sends a synthetic network damage event from a source entity to a target entity at a world position.
Syntax
ONYX.SendNetworkDamage(source, target, posX, posY, posZ, damage, weaponHash, flags, actionResultHash, actionResultId, actionResult, hitComponent)Parameters
source(int) — Entity handle of the damage source.target(int) — Entity handle of the damage target.posX, posY, posZ(number) — World position of the hit.damage(number) — Damage amount.weaponHash(int (optional)) — Weapon used for the hit; defaults to the unarmed hash.flags(int (optional)) — Damage event flag bitset. Defaults to 522.actionResultHash / actionResultId(int (optional)) — Action result fields; default 0.hitComponent(int (optional)) — Body part index; default 0.
Return(s)
None
Behavior
- Raises NetworkDamage with an invalid source or target instead of crashing.
- The internal direction vector is fixed and the trailing flags are sent as false.
Example(s)
local me = PlayerId()
local target = GetPlayerPed(GetNearestPlayerToEntity(me))
ONYX.SendNetworkDamage(me, target, 0.0, 0.0, 0.0, 50.0)