Licenses

Check whether a player holds a specific driving or skill license.

HasLicense (Client)

The license check is initiated from the client using a server callback:

KOJA.Client.HasLicense(licenseName, callback)
Parameter
Type
Description

licenseName

string

Name of the license to check

callback

function(result: boolean)

Called with the result

Example

KOJA.Client.HasLicense('driver', function(has)
    if not has then
        print('No driver license')
    end
end)

License Names

Framework
License Examples

ESX

"driver", "weapon", "pilot", "boat"

QBCore

"driver", "weapon", "hunting", "business"

The name you pass must match what is stored in the framework's database.

How it Works

Internally, KOJA.Client.HasLicense triggers the server callback koja-lib:HasLicense. The server then queries the framework:

  • ESX — triggers the esx_license:checkLicense event

  • QBCore — reads Player.PlayerData.metadata.licenses

  • Custom — returns false by default (implement in CustomFramework.Server)

Implementing License Check for Custom Framework

In editable/custom/framework_server.lua, the license check is handled by the koja-lib:HasLicense callback. If you use a custom framework you can override this by registering the callback yourself before koja-lib loads, or by modifying server/modules/licenses.lua.

Example for a custom framework:

Last updated