LogoLogo
  • Codesign Documentation
  • Information
    • Discord Roles
    • FiveM Asset Escrow System
    • Authentication & Transfers
  • Coding Information
    • Register Key Mapping
    • Code Snippets
    • Self Debugging
  • Paid scripts
    • Arm Wrestling
      • Configs, Locales & SQL
    • Car HUD
      • Configs, Locales & SQL
    • CCTV Cameras
      • Configs, Locales & SQL
    • Darts
      • Configs, Locales & SQL
    • Dispatch
      • Configs, Locales & SQL
      • Resource Integration
    • Door Lock
      • Configs, Locales & SQL
    • Garage
      • Keys/Chat/Events/Exports
      • Optional Features
      • Configs, Locales & SQL
      • Resource Integration
    • Gun Range
      • Configs, Locales & SQL
    • Identity
      • Configs, Locales & SQL
    • Multicharacter
      • Configs, Locales & SQL
    • Player HUD
      • Configs, Locales & SQL
    • Props
      • Configs, Locales & SQL
    • Radar
      • Configs, Locales & SQL
    • Spawn Select
      • Configs, Locales & SQL
    • Terminal Hacker
      • Configs, Locales & SQL
    • Vehicle Control
      • Configs, Locales & SQL
    • VIP Shop
      • Configs, Locales & SQL
  • Free Scripts
    • Easytime
      • Keys/Chat/Events/Exports
      • Optional Features
      • Configs & Locales
    • Drawtext UI
    • Devtools
    • Keymaster - Minigame
    • Staff Support
    • Notifications
Powered by GitBook
LogoLogo

Codesign Software © All rights reserved

On this page
  • Vehicles Data (vehicle names)
  • Boat & Air garages
  • Private Garages
  • Property Garages
  • Fake Plates
  • Vehicle Keys
  • Persistent Vehicles
  • Job Garages
  • Gang Garages
  • Garage Slots
  • Changing Garage Names
  • Garage Phone Apps
  • Custom vehicle logos

Was this helpful?

  1. Paid scripts
  2. Garage

Optional Features

This section explains how the built-in features work and, if needed, how to make them compatible with other resources. These optional features can be configured in [configs/config.lua].

PreviousKeys/Chat/Events/ExportsNextConfigs, Locales & SQL

Last updated 6 months ago

Was this helpful?

Translate


Vehicles Data (vehicle names)

We will retrieve this data on ESX from the "vehicles" database table, as this is very common in ESX servers. This data will be used to display information in 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 the easiest way to configure everything for your server's needs.

Multiple "vehicles" Database Tables

Some servers use multiple "vehicles" database tables for things like donator or emergency vehicles. To accommodate this, simply add the names of these tables to Config.VehiclesData.VehicleDatabase_TableNames in the config.lua file.

On QBCore, we will retrieve this data from qb-core/shared.lua/QBShared.Vehicles, as this is commonly used in QBCore servers. This data will be used to display information 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 shared.lua. This is the simplest way to fully configure everything to meet 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>. However, the vehicle classes and prices will not be displayed on the garage UIs, and Config.VehiclesData.garage_tax will be automatically disabled.


Boat & Air garages

How Do Boat & Air Garages Work?

When a player buys a boat or aircraft, you'll need to update the garage_type field in the database for that vehicle. If you're not using boat or air vehicles on your server, you can ignore this step since the default value for garage_type is set to "car."

Compatible Code Snippets Provided by Codesign

On our page, we provide photos, customized code snippets, and precise line modifications for full compatibility with ESX, QBCore and Paid Resources.

Ideally, the garage_type should be set in the same SQL query that adds the vehicle to the database when it's purchased.

The garage_type can only have one of three values: 'car', 'boat', or 'air'. These values must be strings.

For example, to make a boat appear 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 that vehicle. The same applies for air vehicles.

You don't need to do this for cars or bikes, as the default value for this column in the database is always set to 'car'.

You can trigger this client-side event to automatically update the garage_type in the owned_vehicles/player_vehicles database table.

TriggerEvent('cd_garage:UpdateGarageType')
TriggerClientEvent('cd_garage:UpdateGarageType', source)

This event will only work if the player is sitting inside the vehicle when it’s triggered. You don't need to use this for cars or bikes, as the default value for this column in the database is always set to 'car'.


Private Garages

How Do Private Garages Work?

Private garages operate like public garages but can be placed anywhere using a chat command. Only the player who purchased them can see or use them. In the config.lua, you can enable specific jobs, like real estate, to create and sell private garages to players.


Property Garages

How Do Property Garages Work?

If you use a paid property resource, it's best to contact the resource developer for assistance with property garages, as the Codesign Team doesn't have access to those resources without the developer’s permission. However, we've made it very simple for you to integrate property garages into your property resource.

Do You Use QBCore?

No changes are needed—everything is already pre-configured!

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)

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)

Fake Plates

How Do Fake Plates Work?

In the config.lua, you can set the spawn name for the usable fake plate item. To use it, stand near a vehicle you own, use the item, and enter the new plate in the text box. The fake plate will be applied to your vehicle. When the vehicle is stored in the garage, the fake plate will be removed. You or specific jobs (like the police) can also remove the fake plate using a chat command.

Built-in Vehicle Keys Required!

This is only pre-configured for our built-in keys system. It won’t work with other key resources by default unless you trigger an event or export to give keys after a fake plate has been added.


Vehicle Keys

How Do Vehicle Keys Work?

If you're using the built-in vehicle keys system, you'll need to trigger an event every time a vehicle is spawned in non-Codesign resources, such as the /car command, vehicle shops, or civilian job vehicles.

Script Conflicts!

If you're using our built-in key system, you must stop or remove any other key scripts. Be sure to double-check that they are fully stopped, as they might still start automatically if listed as a dependency, even if you've removed them from the server start config.

Compatible Code Snippets Provided by Codesign

Copy the code snippet below and paste it into any resource where you want the player to receive vehicle keys.

Notes:

  • This event must be placed after the vehicle has been created or spawned.

  • If the vehicle’s plate changes after spawning, place the event below that code.

You need to make sure vehicle is defined.
TriggerEvent('cd_garage:AddKeys', exports['cd_garage']:GetPlate(vehicle))

If the plate is already defined, pass the plate as the second argument, as shown in the code snippet below.

Notes:

  • If the plate is not defined, you cannot give keys to a player from the server side.

  • This event must be placed after the vehicle has been created or spawned.

  • If the vehicle's plate changes after spawning, place the event below that code.

TriggerClientEvent('cd_garage:AddKeys', source, plate)

Persistent Vehicles

How Do Persistent Vehicles Work?

Our persistent vehicle feature automatically saves and respawns any vehicles that despawn, whether you're still in the server or after re-logging. By default, only vehicles spawned through our garage will be persistent, but you can make additional vehicles persistent using the events listed below. A vehicle’s position is saved when it remains stationary for more than 5 seconds. Note that vehicles will not save or respawn after a server restart.

Possible Modifications Required!

If you use this feature, you must add the event below to remove a persistent vehicle in external resources (e.g., in your /dv chat command, external impound resources, or when the plate changes). Otherwise, the vehicle will respawn.

Compatible Code Snippets Provided by Codesign

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))

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)

Job Garages

How Do Job Garages Work?

We offer 3 options for job garages, with each location configurable to use a different method. Each method needs to be implemented differently.

This garage script does not include a vehicle shop, so if you choose the Personal Owned or Society Owned methods, you'll need to set that up separately.

Compatible Code Snippets Provided by Codesign

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.

What Are Regular Job Vehicles?

These are vehicles that are spawned in and not owned by anyone.

To configure them, add the vehicles of your choice to the Config.JobVehicles.RegularMethod table in the config. Each job has its own selection of vehicles that only players with that job can use.

What Are Personal Owned Job Vehicles?

Personal owned job vehicles are vehicles that you’ve purchased from a vehicle shop, and only you can access them from your job garage.

Ideally, this should be set in the same SQL query that adds the vehicle to the database when it’s purchased.

For example, when a player buys a vehicle from the vehicle shop, the job_personalowned column in the owned_vehicles / player_vehicles database table should be set to the player's job name.

You can also trigger this client-side event to set the vehicle a player is currently in as a personal owned job vehicle. However, 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 appear in your database:

What Are Society Owned Job Vehicles?

Society owned job vehicles allow all players of the same job to use any vehicles owned by their job at the job garage.

Ideally, this should be set in the same SQL query that adds the vehicle to the database when it’s purchased.

For example, when a player purchases a vehicle from the vehicle shop, the identifier column in the owned_vehicles / player_vehicles database table should be set to the job name.

You can also trigger this client-side event to set the vehicle a player is currently in as a society-owned job vehicle. However, 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.

This is how society owned job vehicles should appear in your database:


Gang Garages

How Do Gang Garages Work?

The main difference between job garages and gang garages is that when a player stores their personal vehicle in a gang garage, any member of that gang can take it out and use it until the owner retrieves it and puts it back in their personal garage. However, other gang members cannot store your vehicle in their personal garages.

Disabled on ESX!

Gang garages can only be used on QBCore, as gangs in ESX are considered standard jobs. For ESX, you should use the job garage for gang-related vehicles.


Garage Slots

How Do Garage Slots Work?

Our garage slots feature allows players to manage the number of vehicles they can own by limiting garage slots. By default, there are no limits, but you can enable restrictions and control how many cars each player can store. Players can purchase additional slots through in-game commands, and only authorized jobs, like car dealers, can sell these extra garage slots. Pricing for extra slots can be customized, and players can easily check their available garage slots using a designated chat command.

This code should be placed server-side within your vehicle shop resource. It ensures that when a player tries to buy a new car, the system checks whether they have enough available garage slots to store the new vehicle before allowing the purchase.

Usage Example for Garage Slots (Server-Side Only):

if exports['cd_garage']:GetGarageCount(source, 'car') + 1 <= exports['cd_garage']:GetGarageLimit(source) then
    print('allow purchase') -- Allow the purchase if the new car will fit within the limit
else
    print('garage limit reached') -- Deny the purchase if the new car will exceed the limit
end

In this example:

  • GetGarageCount(source, 'car'): Retrieves the number of cars the player currently has in their garage.

  • GetGarageLimit(source): Retrieves the maximum number of cars the player can store based on their garage slots.

  • The code checks if the player’s current vehicle count plus the new car (hence + 1) is still within the allowed garage slot limit. If it is, the purchase is allowed; otherwise, it’s denied with the message "garage limit reached."


Changing Garage Names

To change the names of the garages (e.g., from "A" to "Legion"), you need to configure the Garage_ID variable in the Config.Locations section of the configs/config.lua file. The script will automatically handle the necessary database updates for you.


Garage Phone Apps

How Do Garage Phone Apps Work?


Custom vehicle logos

Credits to @Baby Amnesia for making this tutorial.

On our page, we provide photos, customized code snippets, and precise line modifications for full compatibility with ESX, QBCore and Paid Resources.

On our page, we provide photos, customized code snippets, and precise line modifications for full compatibility with ESX, QBCore and Paid Resources.

On our page, we provide photos, customized code snippets, and precise line modifications for full compatibility with ESX, QBCore and Paid Resources.

By default, your phone's garage app may not be compatible with cd_garage. However, we provide code snippets for compatibility in our to help resolve this issue.

Click here to translate this page.
How do I change language?
Garage Resource Integration
Click here for ESX.
Click here for QBCore.
Click here for Paid Resources.
Garage Resource Integration
Click here for ESX.
Click here for QBCore.
Click here for Paid Resources.
Garage Resource Integration
Click here for ESX.
Click here for QBCore.
Garage Resource Integration
Click here for ESX.
ESX Database
QBCore Database
ESX Database
QBCore Database
Garage Resource Integration