- Documentation
- Shared functions
- isPedDead
Function
isPedDead
Checks whether a player or an NPC is dead, i.e. has zero health or is lying dead waiting to respawn. On the server it uses the state reported by the player's game; on the client it uses the health seen in this game. A dead player comes back only through spawnPlayer.
Syntax
bool isPedDead(ped ped)Arguments
pedped- A player or an NPC.
Returns
true when the ped is dead.
Example
addCommandHandler("lecz", function(player)
if isPedDead(player) then
outputChatBox("Najpierw musisz się odrodzić.", player)
return
end
setElementHealth(player, 100)
end)
See also
killPedInstantly kills a player or an NPC: sets health to zero and fires the death event (onPlayerWastedfor a player,onPedWastedfor an NPC) with the given killer, weapon and body part. Scripts that count kills or hand out rewards therefore see the death as if someone really shot the ped. Nothing happens when the ped is already dead.getElementHealthReturns an element's health: peds 0-100 (up to 176 with full stamina), vehicles 0-1000 (below 250 it burns).spawnPlayerSpawns a player at the given place: position, rotation, skin, interior and dimension.