Rent a CarNewFree

Rent a Car: Configuration

Every option in config/config.lua, from payment accounts and the license check to deposits, durations, vehicles and offices.

v1.0.0Open sourceFreeQBox · QBCore · ESX

Tip

After editing, restart only the resource with ensure hype-rentacar; a full server restart is not needed. Active rentals are kept in the database and loaded again.

All options live in config/config.lua. The file returns one table; the sections below follow its order. Durations are in seconds unless noted, distances in meters and money in whole dollars.

General

config/config.lua
Debug = false,
Framework = "auto",
Notifications = "auto",
VehicleKeys = "auto",

Prop

Type

Fuel

config/config.lua
Fuel = {
    system = "auto",
    level = 100.0,
},

Prop

Type

Company and UI

config/config.lua
CompanyName = "Los Santos Rent a Car",

UI = {
    accent = "#fafafa",
    numberLocale = "en-US",
    currency = "$",
},

ImageUrl = "https://docs.fivem.net/vehicles/%s.webp",

Prop

Type

The phone app takes CompanyName and UI from here as well, so both look the same.

Payment

config/config.lua
PaymentAccounts = { "cash", "bank" },

Prop

Type

Prices are always calculated on the server from the config. The total is rent + deposit, plus Remote.fee for phone rentals, and it is charged from the selected account in one step.

License

Whether players need a driver license to rent, at the office and from the phone.

config/config.lua
License = {
    required = true,
    check = "any",
    metadata = "driver",
    item = "driver_license",
},

Prop

Type

ESX

The default "driver" is the QB key. On ESX with esx_license, set License.metadata = "drive".

The item check works with ox_inventory, qb-inventory, ps-inventory, codem-inventory, core_inventory, jpr-inventory, origen_inventory and tgiann-inventory, and falls back to the framework inventory.

Rental rules

config/config.lua
MaxActiveRentals = 1,
PlatePrefix = "RENT",
CheckInterval = 30,
ExpireWarning = 5,

Prop

Type

Deposit

The deposit is set per vehicle and paid back when the vehicle is returned at an office.

Prop

Type

A phone rental that is returned before it was picked up gets the full deposit back. A rental whose vehicle is missing on return gets nothing back when damageDeduction is on.

Respawn

When a picked up rental's vehicle is deleted while time is left, it can be spawned again.

config/config.lua
Respawn = {
    enabled = true,
    remote = true,
    fee = 250,
    maxDistance = 40.0,
},

Prop

Type

Rentals with less than a minute left cannot be respawned or picked up.

Remote

Phone rentals through hype-rentacar-app. No vehicle is spawned when renting; the player collects it at any office that offers the model.

Prop

Type

Security

Prop

Type

On top of this, only one request per player runs at a time, and vehicles, durations, accounts, office distances and rental ownership are checked on the server.

Durations

Rental durations in real-time hours, with an optional discount in percent.

config/config.lua
Durations = {
    { hours = 1 },
    { hours = 2 },
    { hours = 4,  discount = 5 },
    { hours = 8,  discount = 10 },
    { hours = 24, discount = 20 },
},

Prop

Type

The rent is price × hours × (100 - discount) / 100, rounded to whole dollars.

Vehicles

Every rentable vehicle. Offices offer all of them unless they list their own.

config/config.lua
Vehicles = {
    { model = "blista", label = "Dinka Blista",     category = "compact",    price = 60,  deposit = 400 },
    { model = "sultan", label = "Karin Sultan",     category = "sport",      price = 220, deposit = 2000 },
    { model = "bati",   label = "Pegassi Bati 801", category = "motorcycle", price = 160, deposit = 1500, type = "bike" },
},

Prop

Type

The included categories are compact, sedan, suv, sport, motorcycle and van. A new category only needs a label in locales/*.json under ui.categories.

Camera

A camera turns to the clerk while the menu is open. Set Camera = false to disable it.

Prop

Type

Locations

Each entry is one rental office with its own clerk, blip, spawn points and vehicle list.

config/config.lua
Locations = {
    {
        id = "legion",
        label = "Legion Square",
        coords = vec4(109.95, -1088.62, 29.30, 345.0),
        model = "a_m_y_business_02",
        scenario = "WORLD_HUMAN_CLIPBOARD",
        interaction = "target",
        interactDistance = 2.5,
        maxDistance = 10.0,
        returnRadius = 30.0,
        blip = { enabled = true, sprite = 225, color = 5, scale = 0.75 },
        spawns = {
            vec4(111.37, -1081.27, 28.79, 340.0),
            vec4(107.46, -1079.87, 28.79, 340.0),
            vec4(103.62, -1078.53, 28.79, 340.0),
        },
        vehicles = nil,
    },
},

Prop

Type

A vehicle is returned at any office, not only where it was rented. A phone rental can only be collected at an office that offers its model.

Locales

The language comes from ox_lib, so it is set in server.cfg rather than in the config:

server.cfg
setr ox:locale "en"

en and tr are included. To add a language, copy locales/en.json, translate it, save it with the language code as its name (e.g. de.json) and set ox:locale to that code. The Lua side and the menu share the same file.

config.lua
en.json
tr.json
fxmanifest.lua

Building the UI

The menu ships prebuilt in web/build. To change it, edit the Vue source in web/ and rebuild:

cd web
pnpm install
pnpm build

On this page