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

# Used Cars Job

{% embed url="<https://www.youtube.com/watch?v=F_Nw-pD-7Qs>" %}
Preview
{% endembed %}

{% hint style="info" %}
TEBEX: [Ruxo Shop - Used Cars](https://ruxo-shop.tebex.io/package/5859180)
{% endhint %}

## How to Install

Copy the script folder in your server resource forlder, add the script in the server config file, then add the SQL to your DB

## Requirements

* ESX
* ESX Context

## Key

To open ingame menu use the default key "f6", you can change it in config:

```lua
	DefaultKey = "f6", --you can change this value for open menu ingame
```

<figure><img src="/files/sUWmHzNs8DettWLIg94N" alt=""><figcaption><p>F6 to open menu</p></figcaption></figure>

## Job Settings

Select the minimum grade to buy or sell a vehicle, they can be indipendent,&#x20;

{% code overflow="wrap" %}

```lua
buyGrade = 1, --Minimum grade to buy a vehicle

sellGrade = 1, --Minimum grade to sell a vehicle
```

{% endcode %}

Also decide the zones, where you can open the menu with the selected job!

```lua
	Zone = {
		{
			job = "usato", -- job name
			coords = vec3(-1245.2511, -354.0174, 37.3329), --center of the zone
		},
	},
```

You can decide how much range a player have from the zone to open the menu:

```lua
	ZoneRange = 59000, --Max range to open the menu from coords position (suggest 30/50)
```

## Logs

Put your Discord Webhook links in cofig, log when a vehicle is bought or sold

```lua
	WebhookBuy= "", --https://discord.com/api/webhooks/114040590

	WebhookSell= "", --You must put a link inside
```

## Translations

Select from config your local

```lua
	Local = "en", -- it,es,fr,en,de Transaltion
```

You can change or add translations in config

```lua
	--EN
	TranslateEN = {
		used_vehicle = "Buy Vehicle",
		notify_error = "This vehicle does not belong to anyone!",
		notify_ok = "Vehicle successfully delivered!",
		garage_vehicle = "Garage",
		show_vehicle = "Show Vehicle",
		show_notify = "Vehicle locked",
		show_notify2 = "Vehicle unlocked",
		check_vehicle = "Check Modifications",
		check_engine = "Engine Modifications",
		check_brakes = "Brake Modifications",
		check_transmission = "Transmission Modifications",
		check_suspension = "Suspension Modifications",
		check_armor = "Armor Modifications",
		check_turbo = "Turbo Modifications",
		veh_error = "You need to be in a vehicle",
		sell_vehicle = "Sell Vehicle",
		store_vehicle = "Store Vehicle",
		owner_no = "Owner don't want to sell",
		sale_confirm = "Confirm",
		sale_cancell = "Cancell",
		grade_error = "Your grade is too low",

	},
```

## Keys System

If you don't have a key system with your garage, disable it with ***KeySystem*** = <mark style="color:red;">false</mark>&#x20;

```lua

KeySystem = true, --If you have a key system for vehicles based on plate, set true 

TriggerKeySystem = "daichiaviNOWL", --Your server trigger name to give keys, es: TriggerServerEvent("daichiaviNOWL", plate), for cd_garage use cd_garage:AddKeys

TriggerKeyType = "server", --Trigger type: server for TriggerServerEvent or client for TriggerEvent, for cd_garage is client

KeySystemRemove = true, --Set this false if you use cd_garage

TriggerKeyRemove = "rimuovichiaviNOWL", --Your server trigger name to remove keys

```

Change the triggers names in config with your keys-system triggers

{% hint style="warning" %}
CD Garage Support: if you use cd garage script, please set ***KeySystemRemove*** = <mark style="color:red;">false</mark>,
{% endhint %}

## Garage SQL

You can adapt this to any type of garage script

{% tabs %}
{% tab title="KC Garage" %}
Change tables/fields name with your garage tables and fields

```lua
DBTable = "owned_vehicles", -- Your DB table name for garage system, to insert and delete cars

DBParking = "Legion", -- Your DB Garage name to store new swapped vehicle, cd_garage default is: MP

DBPlate = "plate", -- Your DB Garage plate field

DBOwner = "owner", -- Your DB Garage owner chardID field

DBGarageFields = "owner, plate, vehicle, stored, type, parking", --Your DB Garage fields
	
USEDdbGarageFields = "owner, plate, vehicle, stored, type, parking", --Script DB Garage fields

CdGaragePersistentVehicles = false, 
```

{% endtab %}

{% tab title="CD Garage" %}

```lua
DBTable = "owned_vehicles", -- Your DB table name for garage system, to insert and delete cars

DBParking = "Legion", -- Your DB Garage name to store new swapped vehicle, cd_garage default is: MP

DBPlate = "plate", -- Your DB Garage plate field

DBOwner = "owner", -- Your DB Garage owner chardID field

DBGarageFields = "owner, plate, vehicle, in_garage, garage_type, garage_id"

USEDdbGarageFields = "owner, plate, vehicle, stored, type, parking", --Script DB Garage fields

CdGaragePersistentVehicles = true, --If you use PersistentVehicles set it true.
```

{% endtab %}
{% endtabs %}

## Notifications

Default ESX notification are already supported,&#x20;

```lua
Notification = function(message, type) -- You can change here events for notifications
	--es client side
	TriggerEvent("esx:showNotification", message, type)-- type can be "info", "error", "success"
end,

ServerNotification = function(source, message, type) -- You can change here events for notifications
	--es server side
	TriggerClientEvent("esx:showNotification",source, message, type)-- type can be "info", "error", "success"
end
```

if you use a **custom script** for notification, just change the triggers:

```lua
TriggerEvent("your custom trigger", ?)-- 
```

## Support

If you need support join:&#x20;

{% content-ref url="/pages/e58lwPfWuNyRRzPTvcYd" %}
[Support](/ruxo-shop/overview/support.md)
{% endcontent-ref %}
