# Client Events

{% hint style="danger" %}

## Please read

You are interacting directly with the script, it can cause errors if you pass the wrong arguments to the event
{% endhint %}

```lua
TriggerEvent("vrs-ambulance:client:menu")
```

|                 |                                                                |
| --------------- | -------------------------------------------------------------- |
| Description     | Opens the ox\_lib context menu, same as when you do /ambumenu  |
| Use case        | Opening the menu through target on ped or object               |
| Additional info | Checks if the player has a correct job before opening the menu |

```lua
TriggerEvent("vrs-ambulance:client:StartJob")
```

|                 |                                                                                           |
| --------------- | ----------------------------------------------------------------------------------------- |
| Description     | Starts the job for the player                                                             |
| Use case        | Not using the ox\_lib menu and making your own menu or a custom integration to a dispatch |
| Additional info |                                                                                           |

```lua
TriggerEvent("vrs-ambulance:client:StopJob")
```

|                 |                                                                                           |
| --------------- | ----------------------------------------------------------------------------------------- |
| Description     | Stops the job for the player                                                              |
| Use case        | Not using the ox\_lib menu and making your own menu or a custom integration to a dispatch |
| Additional info |                                                                                           |

```lua
local CHOSEN_ANIMATION = { -- Make sure the values are same as in Config.Animations
    Anim = "idle_f",
    AnimDict = "timetable@tracy@sleep@",
}

local CHOSEN_LOCATION = vector4(-110.31, -1450.86, 32.42, 93.28)

--- @param CHOSEN_LOCATION vector4
--- @param CHOSEN_ANIMATION table
TriggerEvent("vrs-ambulance:client:StartDispatchJob", CHOSEN_LOCATION, CHOSEN_ANIMATION)
```

|                 |                                                                            |
| --------------- | -------------------------------------------------------------------------- |
| Description     | Skips the built-in dispatch and starts the job immediately                 |
| Use case        | Creating your own dispatch system for the job                              |
| Additional info | Make sure that the location and chosen animation is also defined in Config |

```lua
TriggerEvent("vrs-ambulance:client:FailDispatchJob")
```

|                 |                                                           |
| --------------- | --------------------------------------------------------- |
| Description     | Fails the dispatch job for the player and deletes the ped |
| Use case        |                                                           |
| Additional info |                                                           |
