ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. isPlayerSpawned

Function

isPlayerSpawned

ServerPlayersTrilogy Hub only

Checks whether the player is in the world and alive. After death it returns false until the next spawn.

Syntax

bool isPlayerSpawned(player thePlayer)

Arguments

thePlayerplayer
The player.

Returns

true if alive in the world.

Example

addCommandHandler("auto", function(player)
    if not isPlayerSpawned(player) then return end
    local x, y, z = getElementPosition(player)
    warpPedIntoVehicle(player, createVehicle(411, x, y, z))
end)

See also