> For the complete documentation index, see [llms.txt](https://hrscripts.gitbook.io/hrscripts-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hrscripts.gitbook.io/hrscripts-documentation/resources/hrnpcdialogue.md).

# HRNPCDialogue

## Installation

* Download the dependency [HRLib](broken://pages/Ep5kSHLO83LleEO9rVP4)
* Download [HRNPCDialogue](https://github.com/HRScripts/HRNPCDialogue)
* Write this in your server.cfg:\
  `start HRLib`\
  `start HRNPCDialog`

## Preview

<figure><img src="/files/IIV1aRVCsgYFU4wQJkoi" alt=""><figcaption></figcaption></figure>

```lua
local config = {}

config.turnOff = { -- Choose the different options to turn off on focus
    minimap = true,
    playerVisibility = true
}

config.transitionDuration = 2500 -- In miliseconds
```

## External Connections

### Client Export

```lua
exports.HRNPCDialog:startDialogue(targetPed, options, createPed)
```

### Callback

```lua
HRLib.Callback('HRNPCDialog:startDialogue', targetPed, options, createPed) -- Client side
HRLib.ClientCallback('HRNPCDialog:startDialogue', targetPed, options, createdPed)
```

### Parameters

* targetPed: integer?
  * the ped, the camera must be focused on
* options: HRNPCDialgueOptions
  * dialgue settings/options
* createPed: { model: string|integer, animation: { dict: string, anim: string }?, coords: vector4 }?
  * feature that allows you to create a ped directly with this function

## Example

```lua
exports.HRNPCDialog:startDialogue(nil, {
    npcName = 'John Smith',
    questions = {
        {
            label = 'Is John Smith a real name?',
            possibleAnswers = {
                {
                    label = 'Yes, it is',
                    closeOnSelect = true,
                    onSelect = function()
                        print('Wrong Answer!')
                    end
                },
                {
                    label = 'No, it isn\'t',
                    closeOnSelect = true,
                    onSelect = function()
                        print('Correct answer!')
                    end
                }
            }
        }
    },
    onCancel = function()
        print('Don\'t you know the name John Smith?')
    end
}, {
    model = 'a_m_m_eastsa_02',
    animation = { dict = 'mini@strip_club@idles@bouncer@base', anim = 'base' },
    coords = vector4(1404.2367, -1565.6797, 56.4536, 91.8913)
})
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://hrscripts.gitbook.io/hrscripts-documentation/resources/hrnpcdialogue.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.
