ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. isPedDead

Function

isPedDead

Server and clientPedsIdentical to MTA:SA

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