Koja Scripts
NEW

Database

KOJA HUD does not create its own tables.

Database

KOJA HUD does not create its own tables. The only thing it stores is the nitro amount of each vehicle, in a column it adds to your existing vehicles table. Nothing else — settings, stress, key binds — is saved on the server.

The nitro column

When KOJA.Nitro.Enabled is true, the server runs this once oxmysql is ready:

ALTER TABLE <GaragesTable> ADD COLUMN IF NOT EXISTS nitro INT DEFAULT 0

<GaragesTable> is KOJA.Nitro.Tables.GaragesTable. Set it to the table your server uses for owned vehicles:

FrameworkTable
ESXowned_vehicles
QBCoreplayer_vehicles
Oxox_vehicles

The table must have a plate column and an owner column named in KOJA.Nitro.Tables.OwnerColumn (owner by default).

If the table does not exist, the query fails. Check KOJA.Nitro.Tables.GaragesTable when you see an SQL error in the console at start-up.

With KOJA.Nitro.Enabled = false, nothing is created or read.

How nitro is stored

MomentWhat happens
Driver enters a vehicleThe server looks up the nitro amount by plate and owner. Only the owner gets a value.
Driver leaves the vehicleThe remaining amount is written back by plate, if it is above 0.
Nitro runs outThe amount is set to 0.
Nitro is installedThe amount is set to 100 and the nitro item is removed, when KOJA.Nitro.Item is set.

Vehicles that are not in the table (for example admin-spawned ones) cannot hold nitro.

Server events

These events are used internally between the HUD's client and server scripts. You normally do not call them.

EventPurpose
koja_hud:setVehicleNitroSaves a nitro amount for a plate.
koja_hud:removeNitroItemRemoves one nitro item from the calling player.

The server callback koja_hud:getVehicleNitro returns the nitro amount for a plate owned by the caller.

  • Installation — Read the entire installation process to ensure the resource is fully usable.
  • Configuration — Changing Language, Debug Prints, Settings Command, Hide Minimap, Notifications, Nitro, Engine, Seatbelt and Cruisemode.
  • Guides — Creating/Editing Locales, Progress Bar, Text UI and Stress.
  • Features
  • Exports & Commands
  • HUD — back to the section overview