# Interaction Prompts

### CreatePromptGroup

Create a group of prompts that can be enabled/disabled.

<table><thead><tr><th width="154">Parameter</th><th width="104" data-type="checkbox">Required</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>prompts</td><td>true</td><td>List</td><td>A list of prompts to create the prompt group for</td></tr></tbody></table>

```lua
local promptGroupId = TMC.Functions.CreatePromptGroup({
    {
        Id = 'prompt_internal_name',
        Complete = function()
            -- function to call when user selects item
        end,
        Title = '', -- The title of the prompt
        Description = '', -- Optional description text
        Icon = '', -- The font-awesome icon I.e. 'fas fa-circle'
        AutoComplete = false, -- Optional, auto-complete the prompt selection if only 1 prompt is available
    }
})
```

### DeletePromptGroup

Remove a prompt group and delete it.

<table><thead><tr><th width="164">Parameter</th><th width="104" data-type="checkbox">Required</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>promptGroupId</td><td>true</td><td>Int</td><td>The prompt group id</td></tr></tbody></table>

```lua
TMC.Functions.DeletePromptGroup(promptGroupId)
```

### ShowPromptGroup

Enable interaction and visibility of a prompt group

<table><thead><tr><th width="192">Parameter</th><th width="104" data-type="checkbox">Required</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>promptGroupId</td><td>true</td><td>Int</td><td>The prompt group Id to enable</td></tr><tr><td>promptRestrictions</td><td>false</td><td>List</td><td>A list of prompts to enable if you don't want to enable them all</td></tr><tr><td>forceUpdate</td><td>false</td><td>Boolean</td><td>If we should force an update when the prompt group is already enabled. I.e. to enable a new restricted set of prompts</td></tr></tbody></table>

```lua
TMC.Functions.ShowPromptGroup(promptGroupId, { 'prompt_internal_name' })
```

### HidePromptGroup

Hides all prompts from a group

<table><thead><tr><th width="162">Parameter</th><th width="104" data-type="checkbox">Required</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>promptGroupId</td><td>true</td><td>Int</td><td>The prompt group Id</td></tr></tbody></table>

```lua
TMC.Functions.HidePromptGroup(promptGroupId)
```

## Full Example:

This is a full example of the features available with the PromptGroups

```lua
Citizen.CreateThread(function()
    TMC.Functions.AddCircleZone('test_zone', vector3(-223.7, -1536.3, 31.6), 5.0, {
        useZ = true,
        data = {
            job = 'testjob'
        }
    })

    TestPrompt = TMC.Functions.CreatePromptGroup({
        {
            Id = 'test_prompt',
            Complete = function()
                -- Do work
                TMC.Functions.HidePromptGroup(TestPrompt)
                TMC.Functions.SimpleNotify('Test Prompt')
            end,
            Title = 'Test Prompt',
            Description = 'This is a test prompt, see what it can do',
            AutoComplete = true,
            Icon = 'fa-solid fa-circle-question'
        },
        {
            Id = 'test_job_prompt',
            Complete = function()
                TMC.Functions.SimpleNotify('Test Job Prompt')
            end,
            Title = 'Hidden Job Prompt',
            Description = 'This is a private prompt, ooh scary :D',
            AutoComplete = false,
            Icon = 'fa-solid fa-circle-question'
        }
    })

    TMC.Functions.AddPolyZoneEnterHandler('test_zone', function(data)
        if TMC.Functions.HasJob(data.job) then
            -- Show all as player has the job
            TMC.Functions.ShowPromptGroup(TestPrompt)
        else
            -- Only show the main prompt
            TMC.Functions.ShowPromptGroup(TestPrompt, { 'test_prompt' })
        end
    end)

    TMC.Functions.AddPolyZoneExitHandler('test_zone', function()
        if TMC.Functions.IsPromptGroupVisible(TestPrompt) then
            TMC.Functions.HidePromptGroup(TestPrompt)
        end
    end)
end)
```

<figure><img src="https://1641620980-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9dB0Nx2LQfvVHPWOFLLU%2Fuploads%2FSXo7L7uHs5Bc6QP4KtCb%2Fimage.png?alt=media&#x26;token=71f71311-938a-4df7-81a6-92aff9ac6a03" alt=""><figcaption></figcaption></figure>
