Rent a CarNewFree

Rent a Car: Installation

Get the vehicle rental offices running on your server in a few minutes.

v1.0.0Open sourceFreeQBox · QBCore · ESX

Before you start

Make sure OneSync is enabled and your server artifact is up to date. The script detects your framework, target, notification, vehicle keys, fuel and inventory resources on its own. The database table must be created once by hand.

Requirements

ResourceRequiredNotes
ox_libYesCallbacks, points, text UI and locales
oxmysqlYesRentals are stored in SQL
qbx_core / qb-core / es_extendedYesOne of them, picked automatically
ox_target / qb-targetOptionalWithout one, offices use the E text prompt
ox_lib / okokNotify / ps-uiOptionalNotifications, see Notifications in the config
Vehicle keys resourceOptionalqbx_vehiclekeys, qb-vehiclekeys, wasabi_carlock, MrNewbVehicleKeys, qs-vehiclekeys or Renewed-Vehiclekeys
Fuel resourceOptionalox_fuel, LegacyFuel, cdn-fuel, ps-fuel or lc_fuel
Inventory resourceOptionalOnly for the license item check, see License
lb-phone + hype-rentacar-appOptionalRenting from the phone, see Rent a Car App

See Dependencies for download links and the start order.

Setup

Download the resource

The script is free and open source (MIT). Get it from GitHub, see Free scripts.

Keep the folder name

The folder must be named hype-rentacar. Under any other name the script stops itself and prints a warning, and the phone app cannot reach its exports.

fxmanifest.lua

Database

Run INSTALL/install.sql on your database once. It creates the hype_rentacar_rentals table, which is not created automatically.

ColumnContent
citizenidCharacter id of the renter, citizenid on QB/QBox, identifier on ESX
locationOffice id, remote for a phone rental that was not collected
model / labelRented vehicle
plateRental plate
hours / discountRental duration and the duration discount
rent_pricePaid rent, including the phone service fee
deposit / deposit_refundPaid deposit and the amount paid back
paymentAccount the rental was paid with
picked_up0 while a phone rental waits at the office
statusactive, returned or expired
rented_at / expires_at / ended_atRental times

Start the resource

Add it to server.cfg after its dependencies.

server.cfg
ensure ox_lib
ensure oxmysql
ensure qbx_core          # or qb-core / es_extended
ensure ox_target         # or qb-target (optional)

# HypeScripts
ensure hype-rentacar

Set the basics

Open config/config.lua and check at least Locations, Vehicles, Durations and License. On ESX set License.metadata = "drive". See Configuration for every option.

Start order matters

If hype-rentacar starts before your framework, the console prints No supported framework found and nothing works.

Verify

Set Debug = true in the config and start the server. Look for these lines in the console:

[DEBUG:SERVER] [INFO] framework bridge: qbx_core
[DEBUG:SERVER] [INFO] rentacar server loaded: 1 locations, 12 vehicles, 5 durations, license=true (any), remote=true, respawn=true
[DEBUG:SERVER] [INFO] 0 active rentals loaded, 0 expired while the resource was stopped
[DEBUG:SERVER] [INFO] expiry loop started, checking every 30 seconds

Go to the Rent a Car blip at Legion Square and talk to the clerk. Pick a vehicle, a duration and an account, then rent it. You are put behind the wheel with the keys and a full tank.

Drive the vehicle back next to the clerk, talk to them again and press Return. The deposit is paid back, minus damage. When everything works, set Debug = false again.

How it works

  • Rent: the player talks to the clerk, picks a vehicle, a duration and the account to pay with. Rent and deposit are charged together, and the vehicle spawns at the first free spawn point of the office.
  • Drive: the vehicle gets a unique rental plate (RENT1234), keys and the configured fuel level. The office shows the rental with a live countdown.
  • Return: the vehicle is brought back within returnRadius of any office. The deposit is paid back, reduced by engine and body damage when Deposit.damageDeduction is on.
  • Expire: players are warned ExpireWarning minutes before the end. When the time is up, the vehicle is deleted and the rental closes. Remaining time carries over through server restarts.
  • Respawn: if the vehicle disappears while time is left, the player can respawn it at an office for Respawn.fee.
  • Phone: with hype-rentacar-app, a rental can be booked from the phone and collected later at any office. Talking to the clerk then opens the pickup window first.

Rental statuses

StatusMeaning
activeThe rental is running (phone rentals may not be picked up)
returnedThe vehicle was returned at an office
expiredThe time ran out and the vehicle was recovered

Next steps

On this page