> For the complete documentation index, see [llms.txt](https://rip-or-development.gitbook.io/rip-dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rip-or-development.gitbook.io/rip-dev/free-scripts/rip-dialog/functions/client.md).

# Client

## CreateNPC

***

Creates new NPC.

{% code fullWidth="false" %}

```lua
exports['rip_dialog']:CreateNPC(name, model, position, info, options)
```

{% endcode %}

* name: <mark style="color:purple;">`string`</mark>\
  The name of the npc , this has to be unique so it doesn't mess up with other NPCS.
* model: <mark style="color:purple;">`string`</mark>\
  The NPC model, you can find all NPC models [here](https://docs.fivem.net/docs/game-references/ped-models/).
* position: <mark style="color:purple;">`vector4`</mark>\
  The coordinates of the NPC location.
* info: <mark style="color:purple;">`table`</mark>\
  The menu information you can find the info options [here](/rip-dev/free-scripts/rip-dialog/menu-options.md#info).
* options: <mark style="color:purple;">`table`</mark>\
  The menu options you can find the menu options [here](/rip-dev/free-scripts/rip-dialog/menu-options.md#options).

**Examples**

{% tabs %}
{% tab title="First Example" %}

```lua
exports['rip_dialog']:CreateNPC("testnpc", "a_m_m_hillbilly_01", vector4(2768.531, 1391.26, 24.52, 82.20), {
	label = "Talk",
	icon = "fas fa-user",
	title = "Farmer Shop",
	content = "Hello! How can i help you sir?"
}, {
	options = {
		{
			icon = "fas fa-seedling",
			label = "I want to buy plant tools",
			params = {
				type = "action",
				event = function()
					exports.ox_inventory:openInventory('shop', {type = 'farmer'})
				end,
				args = {}
			}
		},
		{
			icon = "fas fa-angle-right",
			label = "i'm just looking around"
		},
	},
})
```

{% endtab %}

{% tab title="Second  Example" %}

```lua
exports['rip_dialog']:CreateNPC("seeds", "g_m_y_mexgoon_01", vector4(2768.531, 1391.26, 24.52, 82.20), {
	label = "Talk",
	icon = "fas fa-user-secret",
	title = "Seeds Dealer",
	content = "Hey! What are you looking for?",
	job = "police",
	color = "#B50000",
	blip = {
		name = "test npc blip",
		sprite = 480,
		color = 1,
		scale = 0.8
	}
}, {
	options = {
		{
			icon = "fas fa-cannabis",
			label = "I want to buy weed seeds",
			params = {
				type = "action",
				event = function()
					exports.ox_inventory:openInventory('shop', {type = 'seeds'})
				end,
				args = {}
			}
		},
		{
			icon = "fas fa-angle-right",
			label = "i'm just looking around"
		},
	},
})
```

{% endtab %}

{% tab title=" Third Example" %}

```lua
exports['rip_dialog']:CreateNPC("testnpc2", "player_zero", vector4(2768.531, 1391.26, 24.52, 82.20), {
	label = "Talk",
	icon = "fas fa-user",
	title = "Title Name",
	content = "Hey! What are you looking for?",
	invisible = false,
	distance = 4.0,
	blip = {}
	
}, {
	options = {
		{
			icon = "fas fa-angle-right",
			label = "First option text, that uses img url",
			image = "https://www.w3schools.com/html/pic_trulli.jpg",
			params = {
				type = "action",
				event = function()
					print('This was called by the first option')
				end,
				args = {}
			}
		},
		{
			icon = "fas fa-angle-right",
			label = "Second option text, that uses img path",
			image = "/html/images/testgifimg.gif",
			params = {
				type = "server",
				event = "server:testoption",
				args = {
					message = "This was called by the second option"
				}
			}
		},
		{
			icon = "fas fa-angle-right",
			label = "Third option text",
			params = {
				type = "client",
				event = "client:testoption",
				args = {
					message = "This was called by clicking this button"
				}
			}
		},
		{
			icon = "fas fa-angle-right",
			label = "Fourth option text, that opens new menu options",
			params = {
				type = "action",
				event = function()
					exports['rip_dialog']:openMenu({
						title = "Title Name",
						content = "What did you have in mind?"
					}, {
						options = {
							{
								icon = "fas fa-angle-right",
								label = "menu option label",
								params = {
									type = "client",
									event = "client:testButton",
									args = {}
								}
							},
						},
					})
				end,
				args = {}
			}
		},
	},
})
```

{% endtab %}
{% endtabs %}

## ChangeNpcOptions

***

Changes an existed NBC menu.

{% code fullWidth="false" %}

```lua
exports['rip_dialog']:ChangeNpcOptions(name, info, options)
```

{% endcode %}

* name: <mark style="color:purple;">`string`</mark>\
  The name of the NPC that you want to change the options for.
* info: <mark style="color:purple;">`table`</mark>\
  The menu information you can find the info options [here](/rip-dev/free-scripts/rip-dialog/menu-options.md#info).
* options: <mark style="color:purple;">`table`</mark>\
  The menu options you can find the menu options [here](/rip-dev/free-scripts/rip-dialog/menu-options.md#options).

**Examples**

{% tabs %}
{% tab title="First Example" %}

```lua
exports['rip_dialog']:ChangeNpcOptions("testnpc", {
	label = "Talk",
	icon = "fas fa-user",
	title = "Farmer Shop",
	content = "Sorry i can't help you now try later."
}, {
	options = {
		{
			icon = "fas fa-cannabis",
			label = "okay i will try later",
			params = {
				type = "action",
				event = function()
					print('This was called by the first option')
				end,
				args = {}
			}
		},
	},
})
```

{% endtab %}

{% tab title="Second  Example" %}

```lua
exports['rip_dialog']:CreateNPC("testnpc", "a_m_m_hillbilly_01", vector4(2768.531, 1391.26, 24.52, 82.20), {
	label = "Talk",
	icon = "fas fa-user",
	title = "Farmer Shop",
	content = "Hello! How can i help you sir?"
}, {
	options = {
		{
			icon = "fas fa-seedling",
			label = "I want to buy plant tools",
			params = {
				type = "action",
				event = function()
					exports['rip_dialog']:ChangeNpcOptions('testnpc', {
						label = "Talk",
						icon = "fas fa-user",
						title = "Farmer Shop",
						content = "Sorry i can't help you now try later."
					}, {
						options = {
							{
								icon = "fas fa-cannabis",
								label = "okay i will try later",
								params = {
									type = "action",
									event = function()
										print('This was called by the first option')
									end,
									args = {}
								}
							},
						},
					})
				end,
				args = {}
			}
		},
		{
			icon = "fas fa-angle-right",
			label = "i'm just looking around"
		},
	},
})
```

{% endtab %}
{% endtabs %}

## DeleteNpc

***

Deletes an existed NBC.

{% code fullWidth="false" %}

```lua
exports['rip_dialog']:DeleteNpc(name)
```

{% endcode %}

* name: <mark style="color:purple;">`string`</mark>\
  The name of the NPC that you want to delete

**Example**

```lua
exports['rip_dialog']:DeleteNpc('testnpc')
```

## openMenu

***

Opens a new menu, you can use it to open a new NPC menu that have other options from the original NPC menu, or you can use it to open the menu without NPC.

{% code fullWidth="false" %}

```lua
exports['rip_dialog']:openMenu(info, options)
```

{% endcode %}

* info: <mark style="color:purple;">`table`</mark>\
  The menu information you can find the info options [here](/rip-dev/free-scripts/rip-dialog/menu-options.md#info)
* options: <mark style="color:purple;">`table`</mark>\
  The menu options you can find the menu options [here](/rip-dev/free-scripts/rip-dialog/menu-options.md#options)

**Examples**

{% tabs %}
{% tab title="First Example" %}

```lua
exports['rip_dialog']:openMenu({
	title = "Title Name",
	content = "What did you have in mind?",
	invisible = false
}, {
	options = {
		{
			icon = "fas fa-angle-right",
			label = "menu option label",
			params = {
				type = "client",
				event = "client:testButton",
				args = {}
			}
		},
	},
})
```

{% endtab %}

{% tab title="Second  Example" %}

```lua
exports['rip_dialog']:CreateNPC("testnpc", "a_m_m_hillbilly_01", vector4(2768.531, 1391.26, 24.52, 82.20), {
	label = "Talk",
	icon = "fas fa-user",
	title = "Farmer Shop",
	content = "Hello! How can i help you sir?"
}, {
	options = {
		{
			icon = "fas fa-seedling",
			label = "I want to buy plant tools",
			params = {
				type = 'action',
				event = function()
					exports['rip_dialog']:openMenu({
						title = "Title Name",
						content = "What did you have in mind?"
					}, {
						options = {
							{
								icon = "fas fa-angle-right",
								label = "menu option label",
								params = {
									type = "client",
									event = "client:testButton",
									args = {}
								}
							},
						},
					})
				end,
				args = {}
			}
		},
		{
			icon = "fas fa-angle-right",
			label = "i'm just looking around"
		},
	},
})
```

{% endtab %}
{% endtabs %}

## closeMenu

***

Closes the menu, (you don't need that because the menu will close automatically when you choose an option, but i add it just in case you needed it)

{% code fullWidth="false" %}

```lua
exports['rip_dialog']:closeMenu()
```

{% endcode %}
