# Installation

## Dependencies

<details>

<summary>ES EXTENDED</summary>

You will need the latest version of [es\_extended](https://github.com/ESX-Official/es_extended).

* Extract the contents of the archive to your resources folder.
* Start the resource near the top of your resources in your server.cfg.

</details>

<details>

<summary>RADIAL MENU</summary>

You will need any radial menu script.

* Extract the contents of the archive to your resources folder.
* Start the resource near the top of your resources in your server.cfg.

</details>

***

## Inventory setup

<details>

<summary> QB-INVENTORY or PS-INVENTORY</summary>

* 1 - Paste the code below in qb-core/shared/items.lua

```lua
   b_glasses                    = { name = 'b_glasses',          label = 'Broke Glasses',                           weight = 100,       type = 'item',      image = 'b_glasses.png',                    unique = false, useable = false,     shouldClose = true,    combinable = nil,   description = 'Broke Glasses...' },
   b_tv                         = { name = 'b_tv',               label = 'Broke TV',                                weight = 100,       type = 'item',      image = 'b_tv.png',                         unique = false, useable = false,     shouldClose = true,    combinable = nil,   description = 'Broke TV...' },
   b_laptop                     = { name = 'b_laptop',           label = 'Broke Laptop',                            weight = 100,       type = 'item',      image = 'b_laptop.png',                     unique = false, useable = false,     shouldClose = true,    combinable = nil,   description = 'Broke Laptop...' },
   b_camera                     = { name = 'b_camera',           label = 'Broke Camera',                            weight = 100,       type = 'item',      image = 'b_camera.png',                     unique = false, useable = false,     shouldClose = true,    combinable = nil,   description = 'Broke Camera...' },
   b_phonefix                   = { name = 'b_phonefix',         label = 'Broke Phone',                             weight = 100,       type = 'item',      image = 'b_phonefix.png',                   unique = false, useable = false,     shouldClose = true,    combinable = nil,   description = 'Broke Phone...' },

```

* 2 - Copy the images from \[images] and paste them into qb/ps-inventory/html/images.<br>

</details>

<details>

<summary>OX-INVENTORY</summary>

* 1 - Paste the code below under ox\_inventory/data/items.lua

```lua
	["b_laptop"] = {
		label = "Broke Laptop",
		weight = 100,
		stack = true,
		close = true,
		description = "Broke Laptop...",
		client = {
			image = "b_laptop.png",
		}
	},

	["b_camera"] = {
		label = "Broke Camera",
		weight = 100,
		stack = true,
		close = true,
		description = "Broke Camera...",
		client = {
			image = "b_camera.png",
		}
	},

	["b_glasses"] = {
		label = "Broke Glasses",
		weight = 100,
		stack = true,
		close = true,
		description = "Broke Glasses...",
		client = {
			image = "b_glasses.png",
		}
	},

	["b_tv"] = {
		label = "Broke TV",
		weight = 100,
		stack = true,
		close = true,
		description = "Broke TV...",
		client = {
			image = "b_tv.png",
		}
	},

	["b_phonefix"] = {
		label = "Broke Phone",
		weight = 100,
		stack = true,
		close = true,
		description = "Broke Phone...",
		client = {
			image = "b_phonefix.png",
		}
	},
```

* 2- Copy the images from \[images] and paste them into ox\_inventory/web/images.

</details>

<details>

<summary>QS-INVENTORY</summary>

* 1- Add the code below into qs-inventory/shared/items.lua:

```lua
    ['b_laptop']                  = {
        ['name'] = 'b_laptop',
        ['label'] = 'Broke Laptop',
        ['weight'] = 0,
        ['type'] = 'item',
        ['image'] = 'b_laptop.png',
        ['unique'] = true,
        ['useable'] = true,
        ['shouldClose'] = false,
        ['combinable'] = nil,
        ['description'] = 'Broke Laptop...'
    },
    ['b_camera']                  = {
        ['name'] = 'b_camera',
        ['label'] = 'Broke Camera',
        ['weight'] = 0,
        ['type'] = 'item',
        ['image'] = 'b_camera.png',
        ['unique'] = true,
        ['useable'] = true,
        ['shouldClose'] = false,
        ['combinable'] = nil,
        ['description'] = 'Broke Camera...'
    },
    ['b_glasses']                  = {
        ['name'] = 'b_glasses',
        ['label'] = 'Broke Glasses',
        ['weight'] = 0,
        ['type'] = 'item',
        ['image'] = 'b_glasses.png',
        ['unique'] = true,
        ['useable'] = true,
        ['shouldClose'] = false,
        ['combinable'] = nil,
        ['description'] = 'Broke Glasses...'
    },
    ['b_tv']                  = {
        ['name'] = 'b_tv',
        ['label'] = 'Broke TV',
        ['weight'] = 0,
        ['type'] = 'item',
        ['image'] = 'b_tv.png',
        ['unique'] = true,
        ['useable'] = true,
        ['shouldClose'] = false,
        ['combinable'] = nil,
        ['description'] = 'Broke TV...'
    },
    ['b_phonefix']                  = {
        ['name'] = 'b_phonefix',
        ['label'] = 'Broke Phone',
        ['weight'] = 0,
        ['type'] = 'item',
        ['image'] = 'b_phonefix.png',
        ['unique'] = true,
        ['useable'] = true,
        ['shouldClose'] = false,
        ['combinable'] = nil,
        ['description'] = 'Broke Phone...'
    },

```

* 2- Copy  the images from \[images] and paste them into qs-inventory/html/images.

</details>

***

### RADIAL MENU

<details>

<summary>STANDARD RADIAL MENU</summary>

* 1 - Add the code below into the qb-radialmenu/client/main.lua

```lua
RegisterNetEvent("isGarbage")
AddEventHandler("isGarbage", function(bool)
    if bool then
        AddOption({
            id = 'SanitaireVehicles',
            title = 'Vehicle List',
            icon = 'car',
            type = 'client',
            event = 'zat-garbagejob:client:VehicleList',
            shouldClose = true
        }, 'SanitaireVehicles')
        AddOption({
            id = 'SanitaireOpenMenu',
            title = 'Groups',
            icon = 'people-group',
            type = 'client',
            event = 'zat-groups:client:OpenUi',
            shouldClose = true
        }, 'SanitaireOpenMenu')
        AddOption({
            id = 'SanitaireGenerate',
            title = 'New Area',
            icon = 'location-pin',
            type = 'client',
            event = 'zat-garbagejob:client:GenerateNewLocation',
            shouldClose = true
        }, 'SanitaireGenerate')
    else
        RemoveOption('SanitaireVehicles')
        RemoveOption('SanitaireOpenMenu')
        RemoveOption('SanitaireGenerate')
    end
end)
```

</details>

<details>

<summary>QBX RADIALMENU</summary>

Add the code below to the bottom fo client/main.lua

```
RegisterNetEvent("isGarbage")
AddEventHandler("isGarbage", function(bool)
    if bool then
        addOption({
            id = 'SanitaireVehicles',
            label = 'Vehicle List',
            icon = 'circle-exclamation',
            onSelect = function ()
                TriggerEvent('zat-garbagejob:client:VehicleList')
                lib.hideRadial()
            end
        }, 'SanitaireVehicles')
        addOption({
            id = 'SanitaireOpenMenu',
            label = 'Groups',
            icon = 'circle-exclamation',
            onSelect = function ()
                TriggerEvent('zat-groups:client:OpenUi')
                lib.hideRadial()
            end
        }, 'SanitaireOpenMenu')
        addOption({
            id = 'SanitaireGenerate',
            label = 'New Area',
            icon = 'circle-exclamation',
            onSelect = function ()
                TriggerEvent('zat-garbagejob:client:GenerateNewLocation')
                lib.hideRadial()
            end
        }, 'SanitaireGenerate')
    else
        removeOption('SanitaireVehicles')
        removeOption('SanitaireOpenMenu')
        removeOption('SanitaireGenerate')
    end
end)
```

</details>

<details>

<summary>OTHER RADIAL MENUS</summary>

* 1 - Add the code below into the top of your radialmenu script /config.lua :&#x20;

```lua
local isGarbage = false
```

* 2- Add the code below into the bottom of your radialmenu script/config.lua :&#x20;

```lua
RegisterNetEvent("isGarbage") -- these are all up to you and your job system, if person become Judge, script will see him as Judge too.
AddEventHandler("isGarbage", function(bool)
    isGarbage = bool
end)
```

* 3- Depending on your radial menu :&#x20;
* 3-1- if it uses <mark style="color:green;">**rootMenuConfig**</mark> then add the code below <mark style="background-color:green;">under rootMenuConfig</mark> :

```lua
    {
        id = "Sanitaire",
        displayName = "Sanitaire",
        icon = "#recycle",
        enableMenu = function()   
            return isGarbage
        end,
        subMenus = {"Sanitaire:Vehicles", "Sanitaire:OpenMenu", "Sanitaire:Generate"}
    },
```

* 3-2- If it uses <mark style="color:green;">newSubMenus</mark> then then add the code below <mark style="background-color:green;">under newSubMenus</mark> :

```lua
    ['Sanitaire:Vehicles'] = {
        title = "Vehicle List",
        icon = "#vehicle-vehicleList",
        functionName = "zat-garbagejob:client:VehicleList" -- must be client event, work same as TriggerEvent('emotes:OpenMenu')
    },
    ['Sanitaire:OpenMenu'] = {
        title = "Groups",
        icon = "#prisoner-group",
        functionName = "zat-groups:client:OpenUi" -- must be client event, work same as TriggerEvent('emotes:OpenMenu')
    },
    ['Sanitaire:Generate'] = {
        title = "New Area",
        icon = "#k9-huntfind",
        functionName = "zat-garbagejob:client:GenerateNewLocation" -- must be client event, work same as TriggerEvent('emotes:OpenMenu')
    },
```

</details>

### NPC DIALOG

<details>

<summary>ADD THIS TO THE ZAT DIALOG CONFIG</summary>

```lua
    {
        img         = 'https://i.postimg.cc/RZnBXFHP/Capture-d-cran-2024-11-25-102447.png',
        ped         = 's_m_y_garbage',
        anim        = 'CODE_HUMAN_MEDIC_TIME_OF_DEATH',
        coords      =  vector4(-322.08, -1539.33, 26.73, 272.88),
        job         = "all", -- { ["police"] = 0, ["ambulance"] = 0}  if you are using target
        gang        = "all", -- { ["ballas"] = 2, ["thelostmc"] = 0}  if you are using target
        groups      = "all", -- { ["police"] = 2, ["ambulance"] = 0}  if you are using intearaction
        firstname   = 'LEO',
        lastname    = 'EARTHWELL',
        rep         = 0,
        mission     = 'Garbage Job',
        text        = 'Nice To see you again, What can I do for you?',
        buttons     = {
            {
                text = 'Sign in/out',
                shop =false,
                rep = 0,
                action= {
                    isServer= false,
                    event= 'zat-garbagejob:client:ToggleSingin',
                    data= {}
                },
                canInteract = true,
            },
            {
                text = 'Join/Create Group',
                shop =false,
                rep = 0,
                action= {
                    isServer= false,
                    event= 'zat-groups:client:OpenUi',
                    data= {}
                },
                canInteract = true,
            },
            {
                text= 'I want to work',
                answer ='Ready for a day of hard work?',
                rep = 0,
                buttons={{
                        text = 'yes',
                        shop =false,
                        rep = 0,
                        action= {
                            isServer= false,
                            event= 'zat-garbagejob:client:StartWorking',
                            data= {}
                        },
                        canInteract = true,
                    },
                    {
                        text = 'Leave Conversation',
                        shop =false,
                        rep = 0,
                        action= {
                            isServer= false,
                            event= 'zat-dialog:client:HideUi',
                            data= {}
                        },
                        canInteract = true,
                    }
                },
                canInteract = true,
            },
            {
                text = 'Work Clothes',
                shop =false,
                rep = 0,
                action= {
                    isServer= false,
                    event= 'zat-garbagejob:client:Clothes',
                    data= {}
                },
                canInteract = true,
            },
        },
        items={}
    }, 
```

</details>

***

## ENSURE RESOURCES

* [ ] ensure zat-garbagejob


---

# 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://zat-scripts.gitbook.io/zat-scripts/esx/garbage-job/installation.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.
