STG ScriptsDocumentation
Driving School

Exports

Check, give and remove STG Driving School licenses from your own scripts, and see where licenses are saved on ESX, QBCore and QBOX.

Other resources can check, give and remove licenses through Driving School, so a vehicle shop, police menu or job can rely on the same licenses players earn at the school.

Where licenses are saved

FrameworkStorage
ESXOne row per license in the user_licenses table (type, owner)
QBCore, QBOXlicences metadata of the player, for example licences.drive_b = true

Two kinds of license are saved:

  • Driving licenses: the licenseName of each license type, given when the practical exam is passed. Defaults: drive_b, drive_a, drive_c, drive_h, drive_plane, drive_boat.
  • Theory passes: theory_<id>, for example theory_car, given when the theory exam is passed. With sharedTheory = true there is one pass for every type, theory_shared. Removing it makes the player take the theory exam again.

Server exports

hasLicense

local hasCarLicense = exports['stg-drivingschool']:hasLicense(source, 'drive_b')

Returns true when the player has the license, otherwise false.

addLicense

local added = exports['stg-drivingschool']:addLicense(source, 'drive_b')

Gives the license to the player. Returns true when it was added and false when the player already had it.

removeLicense

local removed = exports['stg-drivingschool']:removeLicense(source, 'drive_b')

Takes the license away, for example when a police officer suspends it. Returns true when it was removed and false when the player did not have it.

Client exports

hasLicense

local hasCarLicense = exports['stg-drivingschool']:hasLicense('drive_b')

Asks the server whether the local player has the license and returns true or false. It waits for the answer, so call it from a thread or event handler.

Still having trouble?

Open a ticket on our Discord. Our team answers around 15 hours a day.

Get help on Discord

On this page