> For the complete documentation index, see [llms.txt](https://waypoint-scripts.gitbook.io/waypoint-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://waypoint-scripts.gitbook.io/waypoint-scripts/scripts/waypoint-ai-ems/exports-events.md).

# Exports / Events

### Client Event

```lua
-- Called on the client where the AI EMS should be dispatched to
--- @param isInstantDispatch: boolean if true dispatch immediately, else delay based on Config.DispatchEMSWaitTime
TriggerClientEvent('wp-ai-ems:client:DispatchAIEMS', isInstantDispatch)
```

```lua
-- Add this event to your HUD script to show an indicator when EMS are enroute to the player
--- @param isEnroute boolean of whether the EMS is enroute to the player
RegisterNetEvent('hud:client:ToggleEMSEnroute', function(isEnroute)
    showEmsEnroute = isEnroute
end)
```

```lua
-- Returns a boolean of whether the player is currently being transported by AI EMS
exports["wp-ai-ems"]:isPlayerBeingTransported()
```

### Server Event

```lua
-- Server event to dispatch AI EMS, can be used to dispatch to other players.
--- @param targetId - the serverId of the downed player that the AI EMS is dispatched to
--     Example of how to get the current users serverId: GetPlayerServerId(PlayerId())
--- @param isInstantDispatch: boolean boolean if true dispatch immediately, else delay based on Config.DispatchEMSWaitTime
TriggerServerEvent('wp-ai-ems:server:DispatchAIEMS', targetId, isInstantDispatch)
```
