Skip to content

SetPlayerHealth

Sets the player’s health; 0 kills.

Clamped to 0 .. max; the player’s client shows the new value. 0 kills the player at once - OnPlayerDeath with attacker -1, the respawn after [combat] respawn_seconds. A dead player’s health stays 0 until they respawn; use HealPlayer or SpawnPlayer to bring one back. A player who is not in the world yet is ignored (the call still returns true).

SetPlayerHealth(pid, health)
Parameter Type
pid number the player
health number the new health

boolean - false when there is no such player; true otherwise, also for a player not yet in the world, whom the call ignores

-- /slap <name>: a nudge
SetPlayerHealth(target, GetPlayerHealth(target) - 10)

GetPlayerHealth · HealPlayer · OnPlayerDeath · the Vitals group of the index