Skip to Content

gameevent

Game event object passed to events.<event name> callbacks; fields are read by key name.


Passed to game event callbacks. Fields are read by key name; there are no methods and no setters.

events.player_hurt(function(e)
    print(tostring(e), e.dmg_health, e.weapon)
end)
Key type in the event's descriptore.<key>
stringstring
float, long, short, bytenumber
boolboolean
uint64uint64_t cdata
entity handle (strict_ehandle in the descriptor, including the <name>_pawn keys of player-pawn fields)the entity the handle resolves to (base_entity_t), or nil when it does not resolve or the entity is gone
player controller (such as userid, attacker)the controller entity (base_entity_t), or nil; read the pawn through its fields (m_hPawn) or the matching <name>_pawn key
unknown key, local-only keynil

Key names are exact and case-sensitive. tostring(e) returns gameevent<name>, for example gameevent<player_hurt>.

The event is freed when the callback returns. Reading a field of a retained gameevent afterwards raises gameevent used after its callback returned.

Outside Safe Mode, NIXWARE listens to:

player_death             player_hurt              round_start
vote_cast                weapon_fire              weapon_fire_on_empty
bullet_impact            add_bullet_hit_marker    smokegrenade_detonate
flashbang_detonate       hegrenade_detonate       molotov_detonate
inferno_startburn        decoy_started

Other events are delivered only if the game or NIXWARE already listens to them.