# Client Exports

{% hint style="info" %}
Here you will find the list of usable exports for Banking, you can use them if you have basic or advanced programming knowledge, we do not recommend using these if you do not have such knowledge.
{% endhint %}

{% hint style="warning" %}
REMEMBER ABOUT CLIENT SIDE AND SERVER SIDE IN CHOOSING EXPORT!
{% endhint %}

***

## Revive Player

Use one of following events to revive player

```lua
-- Any of these events will work :)
TriggerEvent('p_ambulancejob/client/death/revive')
TriggerEvent('esx_ambulancejob:revive')
TriggerEvent('hospital:client:RevivePlayer')
TriggerEvent('hospital:client:Revive')
```

***

## Kill Player

Use one of following events to kill player

```lua
-- Any of these events will work :)
TriggerEvent('p_ambulancejob/client/death/kill')
TriggerEvent('hospital:client:KillPlayer')
```

***

## openDispatch

Use following export to open dispatch menu

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

## openDispatch

Use following export to open dispatch menu

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

***

## 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}}`

***

## Send Alert

Use following event to send alert to EMS

```lua
TriggerServerEvent('p_ambulancejob/server/alerts/new', {
    code = '911',
    title = 'Alert',
    message = 'I need help!',
    coords = GetEntityCoords(PlayerPedId()),
    expire = 60, -- 60 seconds
    blip = {
        sprite = 153,
        color = 1,
        scale = 1.1,
        pulse = true
    }
})
```

code: `string`

* Alert Code

title: `string`

* Alert Title

message: `string`

* Alert Message

coords: `vec3`

* Coords of alert

expire: `number`

* Time in seconds to expire alert

blip: `{sprite: number, color: number, scale: number, pulse: boolean}`

***

## isPlayerOnBed

Use following export to check if player is currently on some hospital bed

```lua
local targetId = 1 -- replace with existing player id
local result = exports['p_ambulancejob']:isPlayerOnBed(targetId)
print(result) -- true / false
```

playerId: `number`

* Existing player server id

Return:

* result: `boolean`

***

## getBleedingValue

Use following export to check player current bleeding value

```lua
local result = exports['p_ambulancejob']:getBleedingValue()
print(result) -- number
```

Return:

* result: `number`

***

## stopBleeding

Use following export to stop player bleeding

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

***

## addBleeding

Use following export to add value to player bleeding

```lua
local value = 5
exports['p_ambulancejob']:addBleeding(value)
```

value: `number`

* Value to add

***

## removeBleeding

Use following export to remove value from player bleeding

```lua
local value = 5
exports['p_ambulancejob']:removeBleeding(value)
```

value: `number`

* Value to remove

***

## isCrutchEnabled

Use following export to check if player has currently enabled crutch

```lua
local result = exports['p_ambulancejob']:isCrutchEnabled()
print(result) -- true / false
```

Return:

* result: `boolean`

***

## getDeathInfo

Use following export to check player death info

```lua
local result = exports['p_ambulancejob']:getDeathInfo()
print(result.isDead, result.stage)
```

Return:

* result: `{isDead: boolean, stage: "death" | "bleeding" | "recovering" | "none"}`

***

## isDead / dead

Use following state bag to check if player is dead

```lua
LocalPlayer.state.isDead
LocalPlayer.state.dead -- compatibility with other ambulance jobs

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

-- all of these state bags return true / false

LocalPlayer.state.deathType
Player(targetId).state.deathType

-- both of this 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}`

***

## isGpsActive

Use following export to check if player gps is active

```lua
local result = exports['p_ambulancejob']:isGpsActive()
print(result) -- true / false
```

Return:

* result: `boolean`

***

## Check Pulse

Use following statebags to check player pulse

<pre class="language-lua"><code class="lang-lua"><strong>LocalPlayer.state.pulse -- number
</strong>LocalPlayer.state.criticalPulse -- true / false

local targetId = 2 -- replace with existing player id
Player(targetId).state.pulse -- number
Player(targetId).state.criticalPulse -- true / false
</code></pre>

***

## resetPulse

Use following export to reset player pulse

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

***

## addPulse

Use following export to add value to player pulse

```lua
local value = 5
exports['p_ambulancejob']:addPulse(value)
```

value: `number`

* Value to add

***

## resetTemperature

Use following export to reset player temperature

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

***

## addTemperature

Use following export to add value to player temperature

```lua
local value = 5
exports['p_ambulancejob']:addTemperature(value)
```

value: `number`

* Value to add
