Death state
See the Death system for states, rules and the downed flow.Read
UgCore.Players.GetDeathState(source) -> 'Alive' | 'Downed' | 'Dead'
UgCore.Players.IsDead(source) -> boolean
UgCore.Players.IsDowned(source) -> boolean
UgCore.Players.GetInjuries(source) -> UgInjury[]
UgCore.Players.GetCauseOfDeath(source) -> UgCauseOfDeath?
table
table
Change
UgCore.Players.ClearInjuries(source, region?) -> ok, errorCode
UgCore.Players.Down(source, cause?) -> ok, errorCode
UgCore.Players.Kill(source, cause?) -> ok, errorCode
UgCore.Players.Revive(source, options?) -> ok, errorCode
UgCore.Players.Respawn(source, coords?) -> ok, errorCode
| Function | From | To | Hook |
|---|---|---|---|
Down | Alive | Downed | Players:BeforeDown |
Kill | Alive, Downed | Dead | |
Revive | Downed, Dead | Alive, in place | Players:BeforeRevive |
Respawn | Downed, Dead | Alive, at coords | Players:BeforeRespawn |
UgReviveOptions
vector4
Respawn position. Defaults to
respawn.coords in config/players.lua. Respawn always clears injuries.-- An ambulance resource, after its own job, item and distance checks
local ok, err = UgCore.Players.Revive(target, { by = source, reason = 'cpr', clearInjuries = false })
Hooks
| Hook | Payload | Cancelling |
|---|---|---|
Players:BeforeDown | { source, cause } | Keeps the player alive. Down returns no_permission. |
Players:BeforeBleedout | { source } | Keeps the player downed. The bleedout retries later. |
Players:BeforeRevive | { source, by, reason, health, clearInjuries } | Revive returns no_permission. |
Players:BeforeRespawn | { source, coords } | Respawn returns no_permission. |
Enums
| Enum | Values |
|---|---|
UgCore.Enums.DeathState | Alive, Downed, Dead |
UgCore.Enums.BodyRegion | Head, Neck, Torso, LeftArm, RightArm, LeftLeg, RightLeg, Unknown |
UgCore.Enums.DamageCategory | Gunshot, Stab, Blunt, Explosion, Fire, Fall, Vehicle, Drowning, Animal, Unknown |