XyraLScripts
Installation guide

XS-Dealerships

Car dealerships you build in game. Let one run itself, or hand it to a job and let the staff sell, order stock and run the money from a tablet.

01

Requirements

Short list:

  • ox_lib
  • oxmysql
  • Qbox (qbx_core) or QBCore (qb-core)
  • ox_target or qb-target

Everything else is found on its own. Business accounts work with Renewed-Banking, qb-banking, qb-management, okokBanking, tgg-banking, wasabi_banking and fd_banking, or the dealership keeps its own books. Keys work with qbx_vehiclekeys, qb-vehiclekeys, qs-vehiclekeys, wasabi_carlock, Renewed-Vehiclekeys, mk_vehiclekeys, cd_garage, okokGarage, t1ger_keys and vehicles_keys. Fuel works with ox_fuel, LegacyFuel, cdn-fuel and ps-fuel.

No ESX.

02

Installation

  1. Drop the folder into your resources.
  2. Add ensure XS-Dealerships after ox_lib, oxmysql and your framework.
  3. Paste the dealer tablet from items/ — ox_inventory.lua or qb_core.lua — and copy inventory_images/dealer_tablet.png into your inventory's images folder.
  4. Give yourself the creator: add_ace group.admin xs.dealerships allow.
  5. In game, run /dealerships.

The database sets itself up on first start. There is no SQL to import.

On ox_inventory the client = { export = ... } line in the item block is not optional. Without it, using the tablet does nothing at all.

03

Building a dealership

/dealerships opens the creator: a book with a page for each part of a dealership. Press New dealership and work through it:

  • Details — the name, what it sells, who runs it, and the map blip.
  • Selling — whether customers can buy, swap and test drive on their own, cash and bank, where a bought car goes, the test drive length, and the plate on display cars.
  • Finance — the terms, with a worked example of what a buyer would pay.
  • Staff — job-run only. Which grades sell, order stock and see the money, and commission for each grade.
  • Points — where everything stands.
  • Cars — what it sells, at what price, and how many are in stock.

Save, and everyone on the server sees it straight away. Close the creator whenever you like; nothing unsaved is lost.

Most of config.lua is only the starting point for a new dealership. Once one is made, change it in the creator.

04

Points

A dealership has four kinds of point, all placed in game with a free camera:

  • Sales desk — where people browse every car, buy, and pay their finance. A laptop is put on it so there is something to walk up to.
  • Showcase spots — a car on display, as many as you like.
  • Bought cars — where a car is handed over once it is paid for. If something is parked on it, the car goes to the garage instead.
  • Test drives — where the test car is brought round.

Car points show the actual car while you place them, so you can see it fits. Every other point shows as an outline with its name, and the one you are placing turns red if it would hit one. Press Enter twice to put it there anyway.

05

Buying and test drives

Customers walk up to the desk or a car on display. Every car has a window sticker with its top speed, acceleration, braking and handling, read from the car itself, so addon cars show their own numbers.

Cars are sold stock. Paint is the only choice, picked on the buy screen. Pay with cash, bank or finance, and the new owner is put in the driver's seat with the keys, a plate and a full tank.

A test drive puts them straight in the car for as long as the dealership allows, then brings them back to where they started. /endtestdrive hands the car back early.

06

Finance

A down payment from the bank, then payments that come out on their own. A payment that cannot be taken counts as missed, and after too many in a row the car is taken back: gone for good, or held for a few days so the buyer can pay what is left at the desk and get it back.

A payment that falls due while someone is offline is taken when they are next on, after a few minutes to move money around. Agreements keep the terms they were signed on, even if the dealership changes its own later.

07

Job-run dealerships

Make the job in your framework first, then pick it in the creator. The Staff page lists the job's own grades, so you choose who sells, who orders stock and who sees the money by name. Grades the job marks as boss can always see the money.

Staff sell to the customer standing with them: they pick the car, the customer picks the paint and how to pay, and the salesperson gets their commission when the customer accepts.

Each dealership decides whether customers can also buy, swap and test drive on their own, or only through staff. With buying set to staff only, nothing is sold while nobody is on duty.

08

The dealer tablet

Staff carry the dealer tablet. It has a page for each part of the job:

  • Floor — what every showcase spot is showing. Change it, put a spot's own car back, or sell any car to the customer standing with you.
  • Stock — every car and how many are left. Order more from the business account at the wholesale price; they arrive after the time set in the creator.
  • Orders — what is on the way and when it lands.
  • Money — the business account, paying in and taking out.
  • Sales — every sale, who sold it and the commission.
  • Team — who is on, and their sales and commission for the week.

Money and Sales are for the grades that see the money. Rather not have an item? Set Config.Tablet.item = '' and staff open the same screen from the sales desk.

09

Photos

Every car that comes with the game has a photo. For an addon car, put a .png named after its spawn name in html/images/vehicles/. It is used before anything else, and anything without a photo gets a drawn silhouette.

10

Troubleshooting

/dealerships does nothing

You do not have access. Run add_ace group.admin xs.dealerships allow, or put your framework's admin groups or your license in Config.Admin.

Using the tablet does nothing

On ox_inventory, the client = { export = ... } line is missing from the item. ox_inventory only calls an export named in the item itself.

The tablet says I do not work at a dealership

No dealership is bound to your job, or you are off duty and the dealership has "Have to be on duty" switched on. Check the job on the Details page.

Bought cars go to the garage instead of out front

Something is parked on the bought-car point, the point is not placed yet, or the dealership sends cars straight to the garage. Check the Selling and Points pages.

Buyers get no keys

No keys resource was found. Run /dealerdiag to see what the resource detected, and set Config.Bridges.keys if yours runs under a different name.

A car has no photo

It is an addon car. Put a .png named after its spawn name in html/images/vehicles/.

Customers cannot buy anything

Buying is set to staff only on the Selling page, so a salesperson has to sell to them. With nobody on duty, nothing is sold.

11

Updating

  1. Back up the database first.
  2. Keep a copy of your edited config.lua.
  3. Replace the resource folder, merge your config back and restart.

The database updates itself on start. Your dealerships, stock and finance agreements live there, so nothing you built is lost.

12

Support

Bugs and questions go to the Discord. Include your server's console output — the resource prints the reason when it refuses to do something, and that line is usually the whole answer.

XS-Dealerships on GitHub