# le-dispatch

{% embed url="<https://www.youtube.com/watch?v=F9fh8d7rVDM>" fullWidth="false" %}
Preview Style 1<br>
{% endembed %}

{% embed url="<https://www.youtube.com/watch?t=&v=KRUE6ioSRwg>" %}
Preview Style 2
{% endembed %}

## Intallation Guide

1. Place `le-dispatch` file in your `resources` forder
2. Add the script to your `server.cfg`
3. Go to the `config.lua` file and setup to your preferences
4. Add this **client** event in your other scripts where you want to create a dispatch and restart your server!<br>

   <pre class="language-lua" data-full-width="true"><code class="lang-lua">local coords = vector3(-630.95, -230.64, 38.06) -- The position of the dispatch
   local street, crossingroad = GetStreetNameAtCoord(coords.x, coords.y, coords.z) -- Get the street according to the dispatch position
   local data = {
       job = "police",                             -- The job that will receive the dispatch
       priority = 2,                               -- Can be 1, 2, 3, or more if configured in config.lua
       code = "10-31",                             -- The dispatch code
       title = "Jewelry store robbery",            -- The dispatch title and the name of the blip on the map
       message = "",                               -- The message displayed in the center, can be empty
       street = GetStreetNameFromHashKey(street),  -- The street where the dispatch is located
       officer = "A.Leroux [25-08]",                  -- Who/What sends the dispatch, can be anything
       pos = coords,                               -- The position of the dispatch in vector3
       duration = 10,                              -- The time the dispatch is displayed on the screen, in seconds
       source = true,                              -- If you would like the option to send a message to the person dispatching a call
       dispatch = '911',                           -- The response sent when you reply will be: Respond to your [This Variable] call: [Message]
       blip = {                                    -- Information containing the blip, not mandatory
           color = 81,                             -- The color of the blip
           sprite = 58,                            -- The sprite of the blip
           fadeOut = 30,                           -- The time before the blip is removed from the map
           area = {                                -- Information containing the blip zone, not mandatory
               pos = coords,                       -- The central position of the zone
               radius = 100.0,                     -- The radius of the zone, must be a decimal number
               color = 1,                          -- The color of the zone
               sprite = 9,                         -- The sprite of the zone, do not change
               alpha = 50,                         -- The transparency of the zone
               time = 60,                          -- The time the zone is displayed on the map, in seconds
           },
           flash = {                               -- Information containing the blip flash, not mandatory
               coord = coords,                     -- The central position of the flash
               time = 480,                         -- The time the flash is displayed on the map, in seconds
               color = 1,                          -- The color of the flash
               scale = 2.0,                        -- The size of the flash
           },
       }
   }
   TriggerServerEvent('le-dispatch:server:newDispatch', data)
   </code></pre>


---

# 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://test-360.gitbook.io/leroux-scripts/scrips/le-dispatch.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.
