Garage
Step-by-step installation guide, common issues & solutions, code snippets, error codes, config previews, locales previews, SQL previews, and changelogs; all in 1 easily accessible place.
2. Unzip the
cd_garage.zip
folder and place this folder in your server's resource folder.3. Add the resource to your server start config:
ensure cd_garage
. If you are using a framework, it must be placed anywhere below your framework resource e.g., es_extended, not above.
Depending on your framework and dependencies, you may need to make some changes inside the
[cd_garage/fxmanifest.lua]
. We have made this easier by commenting on the lines you possibly need to change.
You MUST read all configurable options inside the
[cd_garage/configs/config.lua]
file and configure them to suit your server's needs. Please read the ”commented out help text” at the end of each line so you can understand what each config option does.
We have added a new feature we are calling 'auto_detect', which will automatically identify your framework and SQL database resource, and apply the appropriate default settings.
Insert Automatically?
If you set
Config.AutoInsertSQL
in the [cd_garage/configs/config.lua]
to true, the resource will automatically insert the SQL for you. You can set this to false after the SQL has been inserted successfully.
Insert Manually?
Before starting this resource on your main/live server, we highly advise configuring your key binds because this resource uses Fivem's Key Mapping.
Where can I configure my key binds?
You can configure key binds in the Keys and Commands section near the bottom of the
[cd_garage/configs/config.lua]
.
Why do I need to do this?Well long story short;- once a player has joined your server with this resource running you can no longer force change their key binds for this resource through the config.lua, only they can change it in the in-game pause menu settings. Although it will change for the players who join after you have changed it.The benefit of this system is that it's much more optimised and players can easily change their key binds on keyboards or controllers. You can also check out the Default Keybinds for this resource.
Where can I find these dependencies?
Open the
[cd_garage/dependencies]
folder. The folders inside are the required dependencies. You will find a text file inside each folder that includes a GitHub download link. Alternatively, they are listed in the table below.
Where should I put these dependencies?
These resources should be placed in your resources folder like any other, but remember, you shouldn't put them in the cd_garage folder.
Do I need to add them to the server start config?
No, they will start automatically because they are listed as a dependency for this resource.
Resource Name | Download | Details |
---|---|---|
cd_garageshell | cd_garage/dependancies | Required for the inside garage shell. |
cd_drawtextui | Required by default but can be replaced. | |
cd_easytime | Optional, used by default for syncing the time inside the garage shell but can be replaced. | |
cd_keymaster | Optional, used by default for vehicle lockpicking if enabled but can be replaced/removed. |
Yes? Then keys will automatically be given when you spawn a vehicle from the garage. You should read the information in Vehicle Keys, as you may need to add the cd_garage give key event in other resources that spawn vehicles such as vehicle shops or your frameworks /car chat command.
Yes? Then in the
[cd_garage/configs/client_customise_me.lua]
file, find the function named [GiveVehicleKeys]
, and add the event/export from your existing vehicle keys script to give a player keys when a vehicle is spawned from the garage. (See image below).
Then you can skip this step.

cd_garage/configs/cient_cutomise_me.lua
PLEASE READ CAREFULLY!
You must complete this step correctly. You must read the information below and confirm your server's plate format.
Please read all 3 options below carefully before confirming which one you use.
Please note that you NEED to use the plate format your server already uses; changing them just because you like the benefits can cause script-breaking issues.
What is vehicle plate formats?Your vehicle shop/car dealer is the script that usually decides what plate format owned vehicles will use on your server. So you need to configure theConfig.PlateFormats
in the [configs/config.lua] file to what plate format your server uses. We have added compatibility with all 3 known plate formats.
Short ExplanationBy default, every vehicle's plate in FiveM is 8 characters long. So for example if your vehicle shop forces the plate to be 4 characters long, when you use the FiveM native to get a vehicle's plateGetVehicleNumberPlateText(vehicle)
, this will return a string that is 8 characters long even though the plate is 4 characters long on your vehicle in-game (ABCD); because FiveM will add whitespaces until the plate is 8 characters long including whitespaces.
1. Trimmed
2. With Spaces
3. Mixed (qbcore+esx_vehicleshop)
What do you mean by "trimmed" plate format?
By "trimmed", we mean your vehicle shop removes all spaces and whitespaces from the default 8-character plate.

Example of what the "trimmed" plate looks like in the DATABASE.

Example of what the "trimmed" plate looks like IN-GAME.

Then you need to set the
Config.PlateFormats
in the config.lua
to 'trimmed'
.What do you mean by "with spaces" plate format?
By "with spaces", we mean your vehicle shop does not modify the plate, so all plates will be 8 characters long no matter how many letters or numbers are in the plate because it will include whitespaces to make the length 8.

Example of what the "with spaces" plate looks like in the DATABASE.

Example of what the "with spaces" plate looks like IN-GAME.

Then you need to set the
Config.PlateFormats
in the config.lua
to 'with_spaces'
.What do you mean by "mixed" plate format?
By "mixed", we mean your vehicle shop will remove any whitespaces at the start and the end of the plate, but it will not remove spaces in the centre of the plate. You should only be using this option if you use Qbcore or esx_vehicleshop.
QBCore: This option is recommended for QBCore servers as this is what QBCore also uses in its get plate function. Normally, QBCore's plates are 8 characters long with no spaces, so the examples below may not be relevant to you.
esx_vehicleshop: If your vehicle plates in the database are the same format as the examples below, you should use this option, as some esx vehicle shops by default, force the plate format to be 7 characters long with a space in the middle.

Example of what the "mixed" plate looks like in the DATABASE.

Example of what the "mixed" plate looks like IN-GAME.

Then you need to set the
Config.PlateFormats
in the config.lua
to '
mixed'
.
This section is to help you understand how the built-in features of this resource work, and if applicable, how you can make them compatible with other resources. These features are not required, they are optional and can be configured in the
[configs/config.lua]
.
ESX
QBCore
Disabled
We will grab this data on ESX from the
"vehicles"
database table, as this is very common in esx servers. So we will use this to store information for us to display on the garage UIs.
If
Config.VehiclesData
is enabled, the script will fetch the vehicle display name, vehicle class, vehicle price, and the garage tax amount (if Config.VehiclesData.garage_tax
is enabled) from the "vehicles" database table. This is simply the easiest way to fully configure everything for your server's needs.
Multiple "vehicles" database tables
We were informed that some servers use multiple "vehicles" database tables for donator vehicles, emergency vehicles etc. So all you need to do is add the names of these database tables into the
Config.VehiclesData.VehicleDatabase_TableNames
in the config,lua.On QBCore, we will grab this data from the
qb-core/shared.lua/QBShared.Vehicles
, as this is very common in QBCore servers. So we will use this to store information for us to display on the garage UIs.
If
Config.VehiclesData
is enabled, the script will fetch the vehicle display name, vehicle class, vehicle price, and the garage tax amount (if Config.VehiclesData.garage_tax
is enabled) from the shared.lua. This is simply the easiest way to fully configure everything for your server's needs.Although this is not required because if
Config.VehiclesData
is disabled, the script will alternatively get the vehicle display names from the vehicle handling files vehicles.meta
. Example: <gameName>Adder</gameName>
. But the vehicle classes/prices will not be displayed on the garage UIs and the Config.VehiclesData.garage_tax will be automatically disabled.
How does boat & air garages work?When a player purchases a boat/air vehicle, the script requires you to update thegarage_type
for this vehicle in the database. If you do not use boat/air vehicles, you can ignore this as the default garage_type value in the database is “car.”
Compatible Code Snippets Provided by Codesign
On our Garage Resource Integration page, we provide photos, customized code snippets, and the exact lines to modify for full pre-configured compatibility with ESX and QBCore.
Option 1 - SQL query
Option 2 - event
Ideally the
garage_type
should be set in the same SQL query that adds the vehicle to the database when the vehicle is purchased.
The
garage_type
can only be set to 3 values: 'car'
'boat'
'air'
. These values must be a string.
For example, to make a boat show in the boat garage, you need to edit the SQL query in your vehicle shop to insert
'boat'
into the garage_type
column in the owned_vehicles / player_vehicles database table for this vehicle. And the same for air vehicles.
You don't need to do this for cars/bikes, as the default value In the database for this column is always ’car’.
You can trigger this client-side event to automatically update the
garage_type
in the owned_vehicle/player_vehicles database table.
client-side to client-side
server-side to client-side
TriggerEvent('cd_garage:UpdateGarageType')
TriggerClientEvent('cd_garage:UpdateGarageType', source)
This event will only work if the player is sitting inside the vehicle when the event is triggered, and you don't need to do this for cars/bikes, as the default value In the database for this column is always ’car’.
How do private garages work?Private garages function the same way as normal public garages, but they can be placed anywhere using a chat command, and only the player who purchased them can see or use them. In the config.lua you can allow certain jobs, such as real estate, to create and sell these private garages to players.
How does property garages work?If you use a paid property resource, then the developer of said resource will be best suited to help you with the property garages, as the Codesign Team doesn't have access to their resources. We can't access them without the developer's permission, considering we haven't purchased them. But, we have made it extremely simply for you to implement this into your property resource.
Do you use QBCore?
You don't need to make any changes; this is already pre-configured!
Spawning a vehicle from a property garage
Storing a vehicle in a property garage
client-side to client-side
server-side to client-side
How do I choose the type of garage to open:
Choose either 'quick' or 'inside' in the 1st argument.
Choose the shell to enter if you use the inside garage:
Replace nil with '10cargarage_shell' or '40cargarage_shell' in the 2nd argument.
TriggerEvent('cd_garage:PropertyGarage', 'quick', nil)
How do I choose the type of garage to open:
Choose either 'quick' or 'inside' in the 2nd argument.
Choose the shell to enter if you use the inside garage:
Replace nil with '10cargarage_shell' or '40cargarage_shell' in the 3rd argument.
TriggerClientEvent('cd_garage:PropertyGarage', source, 'quick', nil)
client-side to client-side
server-side to client-side
The 1st and 2nd argument must always stay the same.
TriggerEvent('cd_garage:StoreVehicle_Main', 1, false, false)
The 2nd and 3rd argument must always stay the same.
TriggerClientEvent('cd_garage:StoreVehicle_Main', source, 1, false, false)
How to fake plates work?In the config.lua, you can configure the usable item’s spawn name. Stand close to a vehicle you own, use the item, enter the new plate in the text box and the new fake plate will be applied to your vehicle. When you store your car in the garage it will remove the fake plate. You and/or configured jobs such as the police can also use the chat command to remove a fake plate.
Built-in Vehicle Keys Required!
This only comes pre-configured for our built-in keys system. It will not work by default with other key resources unless you trigger an event/export to give keys after a fake plate has been added.
How does vehicle keys work?If you are using the built-in vehicle keys system, you will need to trigger an event every time you spawn a vehicle in other non-codesign resources eg., /car command, vehicle shop(s), civilian job vehicles(s), etc.
Script Conflicts!
You MUST stop/remove other key scripts if you are using our built-in key system. Always double-check to see if they are stopped because if your keys script is listed as a dependency, it will automatically start even if you removed it from the server start config.
Compatible Code Snippets Provided by Codesign
On our Garage Resource Integration page, we provide photos, customized code snippets, and the exact lines to modify for full pre-configured compatibility with ESX and QBCore.
client-side to client-side
server-side to client-side
Copy the code snippet below and paste it into any resource where you want the player to have the keys to a vehicle.
Notes:
- This event must be placed after the vehicle has been created/spawned.
- If the vehicle’s plate changes after it has been created/spawned, the event must be placed below that.
You need to make sure vehicle is defined.
TriggerEvent('cd_garage:AddKeys', exports['cd_garage']:GetPlate(vehicle))
If the "plate" is already defined, send the plate in the 2nd argument, as seen in the code snippet below.
Notes:
- If the plate is not defined, you can not give keys to a player from the server side.
- This event must be placed after the vehicle has been created/spawned.
- If the vehicle’s plate changes after it has been created/spawned, the event must be placed below that.
TriggerClientEvent('cd_garage:AddKeys', source, plate)
How does persistent vehicles work?Our persistent vehicle feature will save and respawn any vehicles that have despawned either while you are in the server or after you have re-logged. Only vehicles spawned through our garage will be persistent by default unless you add more persistent vehicles by using the events below. A vehicle’s last saved position will be set when the vehicle has been sitting still for longer than 5 seconds. Please note that vehicles will not save and respawn after a server restart.
Possible Modifications are Required!
If you use this feature, you must add the event below to remove a persistent vehicle in external resources; for example., in your /dv chat command, in an external impound resource or if the plate changes; otherwise, it will respawn.
Compatible Code Snippets Provided by Codesign
On our Garage Resource Integration page, we provide photos, customized code snippets, and the exact lines to modify for full pre-configured compatibility with ESX and QBCore.
Add a persistent vehicle
Remove a persistent vehicle
client-side to client-side
server-side to server-side
This should be triggered when a vehicle is spawned that you want to be persistent. The 1st argument is the vehicle's plate and the 2nd argument is the vehicle's network id.
TriggerServerEvent('cd_garage:AddPersistentVehicles', exports['cd_garage']:GetPlate(vehicle), NetworkGetNetworkIdFromEntity(vehicle))
This should be triggered when a vehicle is spawned that you want to be persistent. The 1st argument is the vehicle's plate and the 2nd argument is the vehicle's network id.
TriggerEvent('cd_garage:AddPersistentVehicles', plate, NetworkGetNetworkIdFromEntity(vehicle))
client-side to client-side
server-side to server-side
This should be triggered when a vehicle is deleted and it should no longer be persistent. You must send the vehicle's plate in the 1st argument.
TriggerServerEvent('cd_garage:RemovePersistentVehicles', exports['cd_garage']:GetPlate(vehicle))
This should be triggered when a vehicle is deleted and it should no longer be persistent. You must send the vehicle's plate in the 1st argument.
TriggerEvent('cd_garage:RemovePersistentVehicles', plate)
How do job garages work?We have 3 options for job garages, each job garage location can be set to use a different method and needs to be implemented in a different way.This garage script does not include any kind of vehicle shop, so if you choose to use the Personal Owned or Society Owned methods you would need to sort that out yourself.
Compatible Code Snippets Provided by Codesign
On our Garage Resource Integration page, we provide photos, customized code snippets, and the exact lines to modify for full pre-configured compatibility with ESX and QBCore.
Do you use QBCore?
By default, QBCore uses the regular job garage method. So, unfortunately, we don't have any guides for setting up personal or society garages.
Regular
Personal Owned
Society Owned
What are regular job vehicles?These are spawned in vehicles and are not owned by anyone.
Add the vehicles of your choice to the
Config.JobVehicles.RegularMethod
table in the config. Each job has its own choice of vehicles that players with a said job can only use.What are personal owned job vehicles?Personal owned job vehicles are vehicles that you have purchased from a vehicle shop and only you can access them from your job garage.
Option 1 - SQL query
Option 2 - event
Ideally, this should be set in the same SQL query that adds the vehicle to the database when the vehicle is purchased.
For example, when a player purchases a vehicle from the vehicle shop, the
job_personalowned
column in the owned_vehicles / player_vehicles
database table needs to be set to the job name
of the player.You can also trigger this client-side event to set the vehicle a player is currently in into a personal owned job vehicle. But this event will only work if the player is sitting inside the vehicle when the event is triggered.
client-side to client-side
TriggerEvent('cd_garage:SetJobOwnedVehicle', 'personal')
server-side to client-side
TriggerClientEvent('cd_garage:SetJobOwnedVehicle', source, 'personal')
This is how personal owned job vehicles should look in your database:
What are society owned job vehicles?Society owned vehicles will allow all players of the same job to use all of the vehicles their job owns at their job garage.
Option 1 - SQL query
Option 2 - event
Ideally, this should be set in the same SQL query that adds the vehicle to the database when the vehicle is purchased.
For example, when a player purchases a vehicle from the vehicle shop, the
identifier
column in the owned_vehicles / player_vehicles
database table needs to be set to a job name
.You can also trigger this client-side event to set the vehicle a player is currently in into a society-owned job vehicle. But this event will only work if the player is sitting inside the vehicle when the event is triggered.
client-side to client-side
TriggerEvent('cd_garage:SetJobOwnedVehicle', 'society')
server-side to client-side
TriggerClientEvent('cd_garage:SetJobOwnedVehicle', source, 'society')
The latest versions of QBCore do not support society owned garages.
How do gang garages work?The difference between job and gang garages is that once a player stored their personal car in a gang garage, anyone in that gang can take it out and use it until the owner puts in back into their personal garage. Other gang members can not store your vehicle in their personal garage.
Do you use ESX?
Gang garages can only be used on Qbcore because gangs on esx are standard jobs. You should use the job garage for gangs on ESX.
If you wish to change the names of the garages from eg.,
A
to Legion
you would need to configure the Garage_ID variable in the Config.Locations in the configs/config.lua
file. The script will automatically take care of the rest for you regarding the database.
How do garage phone apps work?By default, most likely, your phone's garage app wont be compatible with cd_garage, but we provide you with code snippets for compatibility to resolve this problem in our Garage Resource Integration.
Credits to @Baby Amnesia for making this tutorial.
These keys can be modified and/or disabled in the Keys and Commands section of the
[configs/config.lua]
.Key | Description |
E | Open the outside quick garage. |
H | Enter the inside garage. |
G | Store your vehicle. |
E | Hotwire a vehicle. |
M | Toggle vehicle lock. |
These chat commands can be renamed and/or disabled in the Keys and Commands section of the
[configs/config.lua]
.The exact usage for each command will be displayed in the chat suggestions when using the commands in-game.
Command | Description |
/impound | Impound system to impound a vehicle. |
/transfervehicle | Transfer system to transfer a vehicle to another player. |
/checkmiles | Check the mileage of the vehicle you are in. |
/garagespace | Players with defined jobs can sell garage slots to other players. |
/garagespacecheck | Check how many garage spaces you have. |
/vehicle-add | (Staff only) Add the vehicle you are currently sat inside to a player's garage. |
/vehicle-delete | (Staff only) Delete the vehicle you are currently sat inside from the database. |
/vehicle-plate | (Staff only) Change the plate of the vehicle you are currently sat inside. |
/vehicle-keys | (Staff only) Give yourself keys to the vehicle you are currently sat inside. |
/privategarage | Players with defined jobs can create and sell private garages to players. |
/removefakeplate | Remove a fake plate from the closest vehicle. |
/givekey | Give temporary keys (keys delete after server restart) to to the closest player to the closest vehicle. |
/givekeysave | Give saved keys (keys save in database) to to the closest player to the closest vehicle. |
/removekey | Open the keys UI to remove keys you have given out to other players. |
/vehlock | Toggle vehicle lock. |
/lockpick | Lockpick closest vehicle. |
These events are completely optional; you can use them if needed.
client-side to client-side
server-side to client-side
server-side to server-side
Mileage
Check a vehicle's mileage.
TriggerEvent('cd_garage:checkmileage')
Impound Vehicle
Opens the impound UI. You can send a vehicles id as the first argument, otherwise, it will choose the closest vehicle.
TriggerEvent('cd_garage:ImpoundVehicle')