Every menu opened on a networked car starts a session on the server. The server refuses it unless:
- the car exists and the player is within
Config.MaxDistanceof it - the server sees the player as the car's network owner (the client gets 1.5 seconds to take control)
- the player is sitting in the car, for order mode
- the player has not started another session in the last half second
- the opening resource called
AllowSessionfor this player, car and mode, whenConfig.RequireSessionGrantis on
The server then keeps the original look. Colours, livery, roof livery and window tint are read from the car on the server and replace what the client sent.
Putting the car back#
When the menu closes, the client puts the car back itself for order previews and unpaid workshop jobs, then tells the server. The server sends the original look to whoever owns the car through ox_lib's ox_lib:setVehicleProperties state bag in these cases:
- the client could not take control of the car
- the client disconnected or crashed without reporting back
- the resource stopped
If the bag is still set 5 seconds later, the server sends it again, up to 6 times, then clears it. A workshop session only puts back the properties of the parts it hands out. An order session puts back the whole look.
When the client reports that it put the car back, the server reads the car again 2.5 seconds later and restores it if the colours, livery or tint still differ.
Paid workshops#
The bill is what the server sees changed on the car since the menu opened, plus what the client reports that the server cannot read (paint type, extras, the livery mod). A client can add parts to the bill but cannot leave one out. Parts are kept only after ConfirmSessionPaid, or after a seen call to a callback listed in Config.LegacyPayCallbacks. Any part changed after the bill was made goes back.
Saving#
Save is admin only. The server checks the ACE, an open admin session on the same car and the distance. Before the properties reach qbx_vehicles, it keeps only known ox_lib keys and plain values, clamps health and fuel, and reads the model and plate from the car. The only database query the resource runs itself is a read of the owner's name for the menu header.
Open files#
Under escrow these stay readable and editable: config.lua, locales/*.json, shared/parts.lua, server/guard.lua, paints/, stream/, README.md, LICENSE and CHANGELOG.md.
The gen9 paint data in paints/ and stream/vehicle_paint_ramps.ytd come from qbx_customs by the Qbox Project and stay under GPL-3.0 (full text in paints/COPYING). The bundled fonts are under the SIL Open Font License 1.1 and the icons are Tabler Icons (MIT).