NBZ Nathan Bonavia Zammit

09 · Economy · Live showroom and vehicle sales

Car Dealership

A new dealership for the server, replacing the old dealer script and the separate boat shop. Three venues (city, marina and airfield) run under one cardealer job and one company account. Pressing E at the dealer takes you into a private instance with the vehicle in front of you: you look around it with an orbit camera, pick a colour and a plate, and can take a timed test drive. There's no buy button: every sale goes through an employee who bills you from a tablet, and your colour and plate go on the invoice.

Role
Lua (client + server), React + TypeScript NUI
Server
Skyland
Framework
ESX
Stack
Lua, React + TypeScript + Vite + Tailwind, esx_billing, ox_target, oxmysql / MariaDB
Venues
City, marina and airfield
Status
Live on Skyland
A red Itali GTO on the tarmac by a hangar, with its price, performance bars and paint swatches on the left, car categories on the right and a row of supercars below
Trying a colour and a plate on the display car
The aircraft showroom at the airfield with the looping carousel
A test drive on the airport apron with the countdown running
The seller tablet's Stock tab listing every model with its stock and restock cost
The tablet's Admin tab with the catalogue editable in game and a form to add a vehicle
The city showroom: the car is on show in a private instance, with its sheet on the left, the categories on the right and the carousel below 1 / 6

How it works

Start to finish

  1. A red Itali GTO on the tarmac by a hangar, with its price, performance bars and paint swatches on the left, car categories on the right and a row of supercars below
    Trying a colour and a plate on the display car
    The aircraft showroom at the airfield with the looping carousel
    A test drive on the airport apron with the countdown running
    The seller tablet's Stock tab listing every model with its stock and restock cost
    The tablet's Admin tab with the catalogue editable in game and a form to add a vehicle
    The city showroom: the car is on show in a private instance, with its sheet on the left, the categories on the right and the carousel below 1 / 6

    01 — The showroom

    A private instance, not a menu

    • Each visit runs in its own routing bucket. The server spawns the display car on a fixed spot, frozen with the engine off, and there's only ever one per player, even if you click through the carousel fast.
    • Orbit camera: drag to turn around the car, mouse wheel to zoom, smoothed every frame. Pitch, height and distance are clamped, so it can't go under the floor. Your character and the minimap are hidden while you browse and come back on every way out.
    • 201 models in 16 categories across the three venues, shown in a thumbnail carousel that loops with no end (wheel, drag with inertia, or arrows), with a search across all categories; the panels and the carousel slide away when you just want to look at the car.
  2. A red Itali GTO on the tarmac by a hangar, with its price, performance bars and paint swatches on the left, car categories on the right and a row of supercars below
    Trying a colour and a plate on the display car
    The aircraft showroom at the airfield with the looping carousel
    A test drive on the airport apron with the countdown running
    The seller tablet's Stock tab listing every model with its stock and restock cost
    The tablet's Admin tab with the catalogue editable in game and a form to add a vehicle
    Trying a colour and a plate: the display car is repainted and re-plated live, and the server keeps the choice for the seller's invoice 2 / 6

    02 — Colour, plate, test drive

    The server holds the choice

    • 16 paint colours and a custom plate, both applied live to the display car. The server holds the choice, not the UI: the colour has to be in the palette, the plate goes through the same check on both sides, and the choice is kept for 30 minutes after you leave so the seller can still bill it.
    • Test drive in a second car, still inside the private instance: 90 s in the city, 120 s for boats, 180 s for aircraft, and it's the server's timer that ends it. Wreck the car or die at the wheel and you're revived and put back in the showroom.
    • Leaving, the idle timeout, a disconnect and a resource stop all put you back where you came in, in your original routing bucket. If you drop mid-visit, a save hook stores your entry point instead of the showroom, so you don't reconnect inside it.
  3. A red Itali GTO on the tarmac by a hangar, with its price, performance bars and paint swatches on the left, car categories on the right and a row of supercars below
    Trying a colour and a plate on the display car
    The aircraft showroom at the airfield with the looping carousel
    A test drive on the airport apron with the countdown running
    The seller tablet's Stock tab listing every model with its stock and restock cost
    The tablet's Admin tab with the catalogue editable in game and a form to add a vehicle
    The seller tablet's Stock tab: every model with its stock and restock cost, paid from the company account 5 / 6

    03 — The sale

    Sellers bill, the company gets paid

    • Seller tablet on F6, with tabs by grade: new sale, pending invoices and sales history for everyone; restock from grade 2, paid by the company at 70% of the catalogue price; hiring, firing, grades and bonuses for the boss. Admins also get an in-game catalogue editor.
    • Selling: the tablet lists the players within billing range along with the colour and plate they picked. The seller chooses a car in stock and a price no lower than the catalogue, and an esx_billing invoice goes out with one unit of stock reserved. Once it's paid, the server creates the vehicle with those choices and delivers it at the first free spot by the dealer, or to the garage if none is free.
    • Money and stock only move on the server. The invoice row acts as the lock: paying, cancelling and expiry each have to delete it first, so only one of them can act on a sale. Unpaid invoices expire after 48 h and their stock goes back on sale.

Under the hood

What keeps it solid

Why
  • Replaces the old dealer script and the separate boat shop with one module: three venues, one cardealer job, one company account.
Testing
  • 240 vitest unit tests on the UI logic and a written in-game test guide; the showroom and the tablet were tested on the dev server one change at a time.

Tech

Tech and package

  • Lua
  • ESX
  • React
  • MariaDB
  • Client scriptsdealer + showroom
  • Server script
  • Config
  • React appbuilt into the NUI
  • Three SQL migrations

Need something like this on your server?

Email me