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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://waypoint-scripts.gitbook.io/waypoint-scripts/scripts/waypoint-ai-ems/exports-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
