This section lists all available commands, exports, and events included in the script. You’ll find client-side, server-side, and shared functions designed to help developers integrate, extend, or interact with the system easily within their own scripts or frameworks.
Commands
This section lists all available commands included in the script. Each command is designed to simplify administration, player interaction, or debugging tasks. You’ll find detailed descriptions, usage examples, and permission requirements to help you manage and customize your server efficiently.
Command
Description
/hospital_creator
Command to open the creation menu.
/ambulance
Command to open the doctors radial menu.
/revive [id]
Command to revive players, must give the id.
/qheal [id]
Exclusive command to cure people, it is a custom command due to ESX or QB dependencies.
Client Exports
This section provides all available client exports for the script. These functions allow you to interact directly with the system from the client side, enabling custom features, UI interactions, and integrations with other resources. Each export includes a short description and usage example for easy implementation.
isDead (dead state)
The LocalPlayer.state.dead property allows you to check if the local player is currently dead. This is useful for restricting actions, disabling menus, or triggering custom logic when the player has died.
How to Use
To check whether the player is dead, use the following code:
local isDead = LocalPlayer.state.deadprint("Is the player dead? " .. isDead)
This will return one of the following values:
"dead" → The player is dead.
"lastStand" → The player is in last stand mode (downed, not fully dead).
nil → The player is alive.
You can then use this information to implement conditions.
Example
local state = LocalPlayer.state.deadif state =='dead' or state =='lastStand' then-- block shooting, interactions, animations, etc.DisableAllControlActions(0)-- your custom logic...end
Server Exports
This section provides all available server exports for the script. These functions allow developers to interact with the system from the server side, manage data, trigger actions, and integrate with other resources. Each export includes a clear description and a practical example to simplify its implementation.
isDead (dead state)
This check allows you to know whether a player is dead ("dead"), knocked down/last stand ("lastStand") or active (nil). It’s useful for blocking actions, pausing job logic, or triggering events while the player can’t interact.
How to Use
-- Read the player state bag using source
local isDead = Player(source).state.dead -- possible values: 'dead' | 'lastStand' | nil
print('isDead', isDead)
Return values
"dead" → the player is dead (requires respawn/revive).
"lastStand" → the player is downed (bleeding/KO, can still be revived).
nil → the player is alive and functional.
Compatibility: if you use esx_ambulancejob or qb-hospital, they automatically set this value. No need to adjust or add custom exports.
Practical Examples
1) Block actions when the player is not active
local state = Player(source).state.dead
if state == 'dead' or state == 'lastStand' then
-- block shooting, interactions, animations, etc.
DisablePlayerFiring(source, true)
-- your custom logic...
end
2) Prevent opening a menu if dead/knocked
function TryOpenMenu()
local state = Player(source).state.dead
if state ~= nil then
lib.notify({
title = 'Unavailable',
description = 'You cannot open this menu while incapacitated.',
type = 'error'
})
return
end
OpenMyMenu()
end
3) Differentiate between “dead” and “lastStand”
local state = Player(source).state.dead
if state == 'dead' then
-- dead logic (respawn UI, hard disable controls)
elseif state == 'lastStand' then
-- downed logic (call for help, bleeding timer, limited movement)
else
-- alive: normal behavior
end
revivePlayer
The ambulance:revivePlayer event allows you to instantly revive a player. This is useful for scripts that need to bring a player back to life after death without using the standard hospital or respawn flow.