Developers
How respawning works
- The player dies. The server records the time of death (the client can't change it).
- The respawn timer is
respawn.timeif at leastrespawn.minEmsEMS are on duty, otherwiserespawn.timeNoEms. - When the timer ends, the player holds E (or clicks). Or they pay for Face Death once
faceDeath.timehas passed. - The server checks the timer again, takes the Face Death fee and the hospital bill (cash first, then bank) and wipes the inventory if configured.
- The player is moved to the nearest
respawn.locationsspot and revived. On Qbox withrespawn.mode = 'bed', qbx_ambulancejob puts them in a hospital bed instead.
On Qbox, gs-deathscreen also registers a qbx_medical respawn hook, so respawns from anywhere else are blocked until the timer has passed.
Custom dispatch
To send EMS calls through your own dispatch script, set ems.dispatch = 'custom' and write the function in config.lua. It runs on the client when the player presses Call EMS.
ems = {
dispatch = 'custom',
---@param phase 'downed'|'dead'
custom = function(phase)
local coords = GetEntityCoords(cache.ped)
exports['my-dispatch']:SendAlert({
title = phase == 'dead' and 'Civilian unresponsive' or 'Civilian down',
coords = coords,
job = 'ambulance',
})
end,
},
exports['my-dispatch']:SendAlert is an example. Use the export your dispatch script provides.
Callbacks and events
These are used internally by gs-deathscreen. You normally don't need to call them yourself.
| Name | Side | Type | Description |
|---|---|---|---|
gs-deathscreen:server:getInfo | Server | ox_lib callback | Returns ems, remaining, total, cost, hospital, wipe and faceDeath for the calling player. |
gs-deathscreen:server:respawn | Server | ox_lib callback | Respawns the calling player. Pass true to pay for Face Death. Returns true on success. |
gs-deathscreen:client:respawnAt | Client | Net event | Sent by the server to move the player to the respawn point. |
gs-deathscreen:server:finishRespawn | Server | Net event | Sent by the client once it has arrived, to finish the revive. |
gs-deathscreen:server:bledOut | Server | Net event | ak47_ambulancejob only: marks a downed player as dead when the bleed-out timer ends. |
Checking if the screen is running
Other scripts can check whether gs-deathscreen is active with:
if GetResourceState('gs-deathscreen') == 'started' then
-- gs-deathscreen handles the death screen
end
This is the same check the ambulance script changes use.
Adding another ambulance script
Everything gs-deathscreen needs from an ambulance script is in bridge/client.lua and bridge/server.lua: reading the death state, reviving, the bleed-out timer and the distress call. The framework side (money, jobs, metadata, notifications) is in bridge/framework_client.lua and bridge/framework_server.lua.