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

# Installation

## Dependencies

{% tabs %}
{% tab title="QBCore" %}
QBCore Framework\
Optional: ps-dispatch - (<https://github.com/Project-Sloth/ps-dispatch>)
{% endtab %}

{% tab title="ESX" %}
ESX Framework\
Optional: ps-dispatch (ESX) - (<https://github.com/adis05/ps-dispatch-esx>)
{% endtab %}
{% endtabs %}

***

## How to install

Drag the script in your folder\
\
1\. Run the SQL `theft_chopshop.sql`

2\. Add the following items to > `yourinventory/data/items.lua`

* QBCore users to `qbcore/shared/items.lua`
* Add the images to `yourinventory/html/images`

{% hint style="info" %}
If you are using a different inventory then literally create the same items for your custom inventory.
{% endhint %}

{% tabs %}
{% tab title="QBCore" %}

```lua
-- Chop Shop
    ['fakeplate'] 			= {['name'] = 'fakeplate', 		['label'] = 'Fake Plate', 		        ['weight'] = 150, 		['type'] = 'item', 		['image'] = 'fakeplate.png', 	['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['airbag'] 			    = {['name'] = 'airbag', 		['label'] = 'AirBag', 		            ['weight'] = 250, 		['type'] = 'item', 		['image'] = 'airbag.png', 	    ['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['lowradio'] 		    = {['name'] = 'lowradio', 		['label'] = 'Low Quality Radio', 	    ['weight'] = 350, 		['type'] = 'item', 		['image'] = 'lowradio.png', 	['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['stockrim'] 		    = {['name'] = 'stockrim', 		['label'] = 'Low Quality Wheel', 	    ['weight'] = 150, 		['type'] = 'item', 		['image'] = 'stockrim.png', 	['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['highradio'] 		    = {['name'] = 'highradio', 	    ['label'] = 'High Quality Radio', 	    ['weight'] = 250, 		['type'] = 'item', 		['image'] = 'highradio.png', 	['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['highrim'] 		    = {['name'] = 'highrim', 		['label'] = 'High Quality Wheel', 	    ['weight'] = 350, 		['type'] = 'item', 		['image'] = 'highrim.png', 		['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['doors'] 			    = {['name'] = 'doors', 		    ['label'] = 'Doors', 		            ['weight'] = 150, 		['type'] = 'item', 		['image'] = 'doors.png', 	    ['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['speaker'] 		    = {['name'] = 'speaker', 		['label'] = 'Speaker', 		            ['weight'] = 250, 		['type'] = 'item', 		['image'] = 'speaker.png', 	    ['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['screwdriver'] 	    = {['name'] = 'screwdriver', 	['label'] = 'Screwdriver', 		        ['weight'] = 250, 		['type'] = 'item', 		['image'] = 'screwdriver.png', 	['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['battery'] 	        = {['name'] = 'battery', 	    ['label'] = 'Battery', 		            ['weight'] = 250, 		['type'] = 'item', 		['image'] = 'battery.png', 	    ['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['belt'] 	            = {['name'] = 'screwdriver', 	['label'] = 'Belt', 		            ['weight'] = 250, 		['type'] = 'item', 		['image'] = 'belt.png', 	    ['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
    ['lockpick'] 	        = {['name'] = 'lockpick', 	    ['label'] = 'Lockpick', 		        ['weight'] = 250, 		['type'] = 'item', 		['image'] = 'lockpick.png', 	['unique'] = false,    ['useable'] = true, 	   ['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
```

{% endtab %}

{% tab title="ESX" %}

```lua
-- Chop Shop (ESX)
	['fakeplate'] = {
		label = 'Fake Plate',
		weight = 200,
		client = {
			image = 'fakeplate.png',
		},
	},
	['airbag'] = {
		label = 'Air Bag',
		weight = 10,
		client = {
			image = 'airbag.png',
		},
	},
	['lowradio'] = {
		label = 'Low Radio',
		weight = 30,
		client = {
			image = 'lowradio.png',
		},
	},
	['stockrim'] = {
		label = 'Stock Rim',
		weight = 10,
		client = {
			image = 'stockrim.png',
		},
	},
	['highradio'] = {
		label = 'High Quality Radio',
		weight = 20,
		client = {
			image = 'highradio.png',
		},
	},
	['highrim'] = {
		label = 'High Rim',
		weight = 100,
		client = {
			image = 'highrim.png',
		},
	},
	['doors'] = {
		label = 'Vehicle Door',
		weight = 200,
		client = {
			image = 'doors.png',
		},
	},
	['speaker'] = {
		label = 'Speaker',
		weight = 10,
		client = {
			image = 'speaker.png',
		},
	},
	['screwdriver'] = {
		label = 'Screw Driver',
		weight = 30,
		client = {
			image = 'screwdriver.png',
		},
	},
	['battery'] = {
		label = 'Battery',
		weight = 10,
		client = {
			image = 'battery.png',
		},
	},
	['belt'] = {
		label = 'Belt',
		weight = 20,
		client = {
			image = 'belt.png',
		},
	},
	['lockpick'] = {
		label = 'Lockpick',
		weight = 100,
		client = {
			image = 'lockpick.png',
		},
	},
```

{% endtab %}
{% endtabs %}

<div data-full-width="true"><figure><img src="https://dunb17ur4ymx4.cloudfront.net/packages/images/de80f639c7e96408ce289a30d462c6e7a534c5ec.gif" alt=""><figcaption></figcaption></figure></div>

***

## Dispatch (Optional)

{% hint style="success" %}
You can plug in **any dispatch script** you like - the choice is completely up to you.
{% endhint %}

Configure it easily via `config.lua`

```lua
Config.EnableDispatch = false
Config.ChopDispatch = function()
    -- Add here your dispatch event or export.
    -- Examples: ps-dispatch, qb-dispatch, erp-dispatch etc.
end
```

### QBCore

{% hint style="warning" %}
This is just an example configuration showing how to hook **ps-dispatch** into the **Chop Shop** script.
{% endhint %}

ps-dispatch/client/alerts

```lua
local function chopcar()
    local coords = GetEntityCoords(cache.ped)
    local vehicle = GetVehicleData(cache.vehicle)
    local dispatchData = {
        message = "Car smashing attempt",
        codeName = 'Car chopping',
        code = '10-13',
        icon = 'fas fa-gun',
        priority = 2,
        vehicle = vehicle.name,
        plate = vehicle.plate,
        color = vehicle.color,
        coords = coords,
        gender = GetPlayerGender(),
        street = GetStreetAndZone(coords),
        jobs = { 'leo' }
    }
    
    TriggerServerEvent('ps-dispatch:server:notify', dispatchData)
    end exports('chopcar', chopcar)
```

ps-dispatch/shared/config.lua

```lua
['chopcar'] = {
        radius = 0,
        sprite = 110,
        color = 1,
        scale = 1.5,
        length = 2,
        sound = 'Lose_1st',
        sound2 = 'GTAO_FM_Events_Soundset',
        offset = false,
        flash = false
   },
```

<div data-full-width="true"><figure><img src="https://dunb17ur4ymx4.cloudfront.net/packages/images/61ec82eefa9e45ef64d2b88f91afd87a901ed4fb.gif" alt=""><figcaption></figcaption></figure></div>

***

### ESX

ps-dispatch/client/cl\_extraalerts

```lua
local function chopcar(vehicle)
    local vehdata = vehicleData(vehicle)
    local currentPos = GetEntityCoords(PlayerPedId())
    local locationInfo = getStreetandZone(currentPos)
    local gender = GetPedGender()
    TriggerServerEvent("dispatch:server:notify",{
        dispatchcodename = "carchop", -- has to match the codes in sv_dispatchcodes.lua so that it generates the right blip
        dispatchCode = "10-13",
        firstStreet = locationInfo,
        gender = gender,
        model = vehdata.name,
        plate = vehdata.plate,
        priority = 2,
        firstColor = vehdata.colour,
        automaticGunfire = false,
        origin = {
            x = currentPos.x,
            y = currentPos.y,
            z = currentPos.z
        },
        dispatchMessage = "Car smashing attempt", -- message
        job = {"police"} -- jobs that will get the alerts
    })
end exports('chopcar', chopcar)
```

ps-dispatch/server/sv\_dispatchcodes

```lua
["carchop"] =  {displayCode = '10-13', description = "Suspicious Activity", radius = 0, recipientList = {'police'}, blipSprite = 66, blipColour = 37, blipScale = 0.5, blipLength = 2, sound = "Lose_1st", sound2 = "GTAO_FM_Events_Soundset", offset = "false", blipflash = "false"},

```

<div data-full-width="true"><figure><img src="https://dunb17ur4ymx4.cloudfront.net/packages/images/c8489bf77e94bbd767d6a4a0ce3d15481357daab.gif" alt=""><figcaption></figcaption></figure></div>
