GIG ScriptsGIG Scripts

Rental

Vehicle rental kiosks with a live in-world screen, player-owned businesses and an admin panel.

Dependencies

  • OneSync
  • ox_lib
  • oxmysql
  • gig-rental-assets (the kiosk props in nine colours, and the green wall for the photo studio)
  • Qbox, QB-Core or ESX
  • ox_target or qb-target, or the built-in [E] prompt (cfg.interaction)
  • screenshot-basic, only for the vehicle photo studio

A vehicle keys script and a fuel script are detected automatically. Supported keys: qbx_vehiclekeys, qb-vehiclekeys, qs-vehiclekeys, wasabi_carlock, MrNewbVehicleKeys. Supported fuel: ox_fuel, LegacyFuel, cdn-fuel, ps-fuel, lc_fuel, Renewed-Fuel, qb-fuel. Anything else is set through cfg.keys and cfg.fuel.

server.cfg
ensure gig-rental-assets
ensure gig-rental

add_ace group.admin gig.rental allow

The ace is one way into the admin panel. Your framework's own admin or god rank works as well; edit bridge/server/admin.lua to allow a job instead.

Items

The resource adds no items. Rentals are paid from the account in cfg.payout.

How it works

Players walk up to a kiosk and interact. The camera moves in front of the screen and the crosshair becomes a cursor: the interact key or the left mouse button clicks, the wheel scrolls, Escape or walking away leaves. They pick a car, pay for a number of days, and it spawns on one of the kiosk's spawn points with keys and fuel. A dashed trail on the ground leads them to it.

Anyone standing near the machine sees the same page live, with balances, earnings and personal data removed on the server. Only the pointer, the scroll and the clicks are relayed.

Every kiosk has its own fleet, prices and spawn points, built in the admin panel one spawn name at a time. There is no server-wide vehicle list. Any model on the server works, addons included; the readable name and class come from the game. Fleet cars never run out: the same model can be out with any number of customers at once, each on its own plate.

A kiosk comes in two modes:

  • shop: the rental company itself. It rents its own fleet, nobody can buy it and it keeps no money.
  • owned: a business a player runs. An owned kiosk with no owner can be sold outright or leased for a number of real days. Once bought, the owner lists their own vehicles on it and collects the income; nobody else can list there, and an owned kiosk without an owner takes no listings at all. When a lease ends the kiosk goes back on the market by itself, and the register stays collectable by the old owner even offline.

A listed car is parked out of the normal garage while it is on the floor, so the same plate never exists twice. Rentals that run out are deleted once nobody is sitting in them; an occupied one is flagged overdue and swept again later.

Commands and keys

Both commands are admin-only and checked on the server every time, so binding or typing them gets an unauthorised player nothing.

CommandDefault keyWhat it does
/rentalmenunone (cfg.admin.key)the admin panel: place, edit and remove kiosks
/rentalssnoneopens the photo studio as a live set, to line up the framing

The command name comes from cfg.admin.command. The keybind is rebindable under Settings, Key Bindings, FiveM.

Admin panel

The panel lists every kiosk and opens an editor per kiosk:

  • Machines: one kiosk record can stand in several places at once. They share one screen, one fleet, one register and one set of spawn points, a business with two counters rather than two businesses. Placement is a freecam with the prop shown in place.
  • Spawn points: where rented cars appear, and whether the player walks to the car or spawns inside it.
  • Fleet: spawn name, price per day and an on/off switch per vehicle. The panel says which vehicles have no photo yet and shoots them in one go.
  • Mode, purchase and commission: shop or owned, the sale or lease offer, and the share of each listing that goes to the kiosk register.
  • Owner and register: who runs the kiosk, the money in its till, and forced returns of listings.

Vehicle photos for the kiosk cards are shot in-game: the car is spawned in front of a green wall, photographed with screenshot-basic, and the green is keyed out to transparency. Photos are written to disk and become visible after the next ensure gig-rental, because FiveM reads a resource's file list when it starts. Shoot them around 12:00 in clear weather for the cleanest cut-out.

Screens

The kiosk screen is a browser drawn on the prop's texture. A texture swap affects every prop sharing that texture, so gig-rental-assets ships each colour five times, one model per screen slot. The server gives every machine a slot and keeps same-colour machines within kiosk.slotRadius (100 m) on different ones, so up to five machines standing together each run their own page. A sixth of the same colour inside that radius is refused; change its colour or move it further out.

Colours: red, orange, yellow, green, blue, purple, pink, white, black.

If the cursor does not line up with the panel, tune kiosk.screen in data/tuning.lua (offset, width, height, and facing if the camera ends up behind the machine). Those are the only values that need eyeballing in-game.

Config

FileContents
cfg.luawhich scripts the resource talks to, the payout account, the admin command and key
cfg_sv.luaDiscord webhooks
data/tuning.luakiosk screen and camera, photo studio, spectating, rental day length, the trail, blip colour
bridge/server/garage.luayour framework's vehicle table
bridge/server/plates.luaplate generation
bridge/server/admin.luawho may open the admin panel

The keys in cfg.lua:

  • cfg.framework, cfg.notify, cfg.notifyTitle: the usual bridge switches.
  • cfg.textUI: ox, qb, esx, okok or draw for the built-in floating text.
  • cfg.interaction: ox_target, qb-target or prompt. If the target resource is not running the prompt is used instead.
  • cfg.keys and cfg.fuel: auto, one of the supported scripts by name, or false. Exactly one keys script is called, otherwise the renter would get the keys twice.
  • cfg.interactKey: the letter for the [E] prompt and for clicking the screen. cfg.fuelLevel: how full a rental is handed over.
  • cfg.payout: bank or cash. Where collected earnings, register withdrawals and leftover lease money land. A refund always goes back to the account it was paid from.
  • cfg.admin.command and cfg.admin.key.

data/tuning.lua loads after cfg.lua and never overwrites it. To change one of its values, copy just that key into cfg.lua and it wins. The ones worth knowing:

  • rental.dayMinutes (1440): how long a rental "day" is in real minutes. Shorten it for a server where nobody keeps a car for a real day.
  • rental.despawnWhenEmpty and rental.checkInterval: the expiry sweep.
  • rental.trail: the dashed ribbon to the spawned car; enabled = false turns it off.
  • kiosk.spectate: whether bystanders see the screen and from how far.
  • kiosk.interactDistance, useDistance, streamDistance: interaction, walk-away and prop streaming ranges.
  • kiosk.camera and kiosk.approach: the camera move and the walk to the panel.
  • admin.ace and admin.studio: the ace name and the photo studio framing.
  • blip.colour: the map blip colour; blips are switched on per kiosk in the panel.

bridge/server/garage.lua names the table and columns of your framework's vehicle storage (player_vehicles for QB and Qbox, owned_vehicles for ESX). bridge/server/plates.lua generates rental plates with a RENT prefix; set PLATE_PREFIX to '' for ordinary-looking plates.

Exports

Server side:

exports['gig-rental']:IsRental(plate)          -- true while the plate is out on rent
exports['gig-rental']:GetRental(plate)         -- { plate, kioskId, carId, listingId, renterId, expiresAt, overdue } or nil
exports['gig-rental']:IsRentalVehicle(entity)
exports['gig-rental']:GetPlayerRentals(who)    -- server id or identifier; everything they have out
exports['gig-rental']:GetKiosks()
exports['gig-rental']:CanOpenAdmin(src)

A rented car also carries Entity(vehicle).state.gigRental, readable on the client too, for garages, impounds and insurance scripts.

Webhooks

cfg_sv.lua has one URL per category. Leave a category empty to skip it; default catches everything that has no URL of its own. cfg.logToConsole mirrors every line to the server console.

CategoryFires on
rentalvehicle rented, listed, taken back, earnings collected, refunds
purchasea player buys or leases a kiosk
kioskCreatean admin places a new kiosk
kioskDeletean admin removes a kiosk
adminkiosk edited, register adjusted, forced return, listing removed

On this page