# Task's - Location Messages

This part is the part where an event trigger can be created when a message is triggered or called when entering a location.

### 1- When you enter a location send message

```lua
Config.Locations = {
    [vector3(1398.11, 3669.86, 33.35)] = {
        message = "#121632*",
        name = 'B***k M****',
        isSended = false
    }
}
```

You can add a new coordinate and message to the table as follows, you can also change the name of the messenger. isSended = true, if you do, the number will be registered and can be called, but it will not be shown in that laconation, so think of it as a hidden code.

```lua
Config.Locations = {
    [vector3(1398.11, 3669.86, 33.35)] = {
        message = "#121632*",
        name = 'B***k M****',
        isSended = false
    },
    [vector3(0, 0, 0)] = { -- coords
        message = "#111111*", -- edit number & name
        name = 'Example Example', -- like this
        isSended = false
    }
}
```

### 2- When call a number - trigger

```lua
Config.Numbers = { -- You can add more numbers
    {
        number = '#111631*',
        name = 'B***k M****',
        haveVocal = '../tasks/blackmarket.wav',
        action = function(tinfo)
            Task.BlackMarketLocation(tinfo)
        end
    }...
```

As you can see, you can create a new table with similar logic to the other table.

| type      | value         | desc                                                   |
| --------- | ------------- | ------------------------------------------------------ |
| number    | string        | The number at which the code is triggered.             |
| name      | string        | Display name.                                          |
| haveVocal | bool - string | if you have an audio file - if not you can set "false" |
| action    | function      | Triggerable part                                       |

#### How it works?

1- Create a new number

```lua
Config.Numbers = { -- You can add more numbers
    {
        number = '#111631*',
        name = 'B***k M****',
        haveVocal = '../tasks/blackmarket.wav',
        action = function(tinfo)
            Task.BlackMarketLocation(tinfo)
        end
    },
    {
        number = '#111111*', -- display number
        name = 'Example', -- display name
        haveVocal = '../tasks/example.wav', -- have vocal
        action = function(tinfo)
            Task.Example(tinfo) -- trigger
        end
    }
}
```

2- How it works trigger

Open the tasks/tasks.lua, and go all the way down. Create a new function.

It must have the same name as the trigger you will name above - like "Task.Example"

```lua
Task.Example = function(tinfo)
    --- you can adapt your heist open door code or you can s
end
```

3- If you have vocal

You must enter the search entries as follows and if there is sound, you must set it this way.

```lua
Task.Example = function(tinfo)
    UpdateCallInfo(tinfo.number, tinfo.name, 'Calling...') -- Updates call info
    Wait(2000) -- waiting for ringing -- for realistism
    UpdateCallInfo(tinfo.number, tinfo.name, 'In Call') -- Updates call info
    if tinfo.haveVocal then
        Task.Sound(tinfo.haveVocal)  -- you need to use to play sounds
    end
    Wait(10000)
    UpdateCallInfo(tinfo.number, tinfo.name, 'End Call')   -- Updates 
    
    --- YOUR CODE HERE
    exports["example-script"].exampleTrigger()
    TriggerServerEvent("example-script:exampletrigger")
end
```

<table><thead><tr><th>value</th><th width="210">type</th><th>desc</th></tr></thead><tbody><tr><td>UpdateCallInfo</td><td>function</td><td>Allows you to update the call info without which the call cannot be set up and will give an error.</td></tr><tr><td>Wait</td><td>function</td><td>It's there to provide realism, you can use it at all if you want. Recommended for use.</td></tr><tr><td>Task.Sound</td><td>function</td><td>It is used to play sound.</td></tr></tbody></table>


---

# 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://docs.0resmon.org/0resmon/s4-resources/illegal-phone/tasks-location-messages.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.
