addPedNativeDamageEvent
Replay a server-approved native NPC hit on the victim client so GTA applies the health, armour, hit reaction, and fall response once.
Syntax
bool addPedNativeDamageEvent(player damagedPlayer, ped attackingPed, int weapon, int bodypart, int damageFactor, int direction, int token)GTA task mapping
Submits GTA's native damage event on the victim owner so its stock calculator and physical response run in one place. There is no direct SCM opcode for the bridge.
Arguments
damagedPlayerplayerLiving local player whose client is authoritative for the physical damage.
attackingPedpedDifferent streamed script ped that produced the validated native hit.
weaponintGTA weapon ID from 0 through 54.
bodypartint0 for unknown, or an MTA body-part ID from torso through head.
damageFactorintRaw native pre-calculator damage value from 1 through 10000.
directionintNative local hit direction from 0 through 3.
tokenintActive native event-profile observer token for the attacker.
Returns
true when the authenticated local-player damage event was accepted; false for invalid actors, values, ownership, streaming, or token state.
Ownership and lifecycle
Candidate queries create nothing. A multiplayer resource must validate each proposal, create and own the real NPCs and vehicles, assign one current syncer, handle ownership changes, and clean up every element. Native AI and event tokens belong to the calling resource and are revoked when that resource stops.
- This is a low-level bridge for cross-owner native AI hits. A server should authenticate and relay the original attempt; calling it for an ordinary synchronized hit can apply damage twice.
Where this comes from
Continue exploring
← Back to the SA:O Lua API · How Synchronized NPCs and road traffic works →