# Server Exports

## Revive Player

Use one of following events to revive player

```lua
-- Any of these events will work :)
local targetId = 1 -- replace with existing player id
TriggerClientEvent('p_ambulancejob/client/death/revive', targetId)
TriggerClientEvent('esx_ambulancejob:revive', targetId)
TriggerClientEvent('hospital:client:RevivePlayer', targetId)
TriggerClientEvent('hospital:client:Revive', targetId)
```

targetId: `number`

* Existing player server ID

***

## Kill Player

Use one of following events to kill player

```lua
-- Any of these events will work :)
local targetId = 1 -- replace with existing player id
TriggerClientEvent('p_ambulancejob/client/death/kill', targetId)
TriggerClientEvent('hospital:client:KillPlayer', targetId)
```

targetId: `number`

* Existing player server ID

***

## getDispatchAlerts

Use following export to get all active alerts on dispatch

```lua
exports['p_ambulancejob']:getDispatchAlerts()
```

Return:

* alerts: `table {id: number, player: number, code: string, title: string, message: string, coords: vec3, expire: number, blip: {sprite: number, scale: number, color: number}}`&#x20;

***

## isDead / dead

Use following state bag to check if player is dead

```lua
local targetId = 2 -- replace with existing player id

Player(targetId).state.isDead
Player(targetId).state.dead -- compatibility with other ambulance jobs

-- both of them return true / false

Player(targetId).state.deathType

-- this one return stage: "death" | "bleeding" | "recovering" | "none"
```

***

## onDeathStateChange

You can use this event handler to follow players death state

```lua
RegisterNetEvent('p_ambulancejob/onDeathStateChange', function(deathType, deathData)
end)
```

* deathType: `"death" | "bleeding" | "recovering" | "none"`
* deathData: `{victimCoords: vec3, killerCoords: vec3 | nil, distance: number | nil, killer: number | nil, cause: number, weapon: number, weaponLabel: string | nil}`

***

## Check Pulse

Use following statebags to check player pulse

```lua
local targetId = 2 -- replace with existing player id
Player(targetId).state.pulse -- number
Player(targetId).state.criticalPulse -- true / false
```
