Exports
Give and take licenses, open the wallet and refresh cards from your own scripts, plus the server hooks that run on every license change.
Other resources can give licenses that show up in the wallet, open or close the wallet and refresh a player's cards.
A license is saved where your framework keeps licenses: the user_licenses table of esx_license on ESX, the player's licences metadata on QBCore and QBOX. A license whose type matches a driver or weapon class in Config.StaticCards, or the license name of a custom card from the admin panel, appears in the wallet right away.
Server exports
giveLicense / removeLicense
exports['stg-walletv2']:giveLicense(source, 'drive_b')
exports['stg-walletv2']:removeLicense(source, 'drive_b')Prop
Type
Gives or takes the license and refreshes the player's cards. Giving a license the player already owns does not add it twice.
refreshCards
exports['stg-walletv2']:refreshCards(source)Reloads the cards of one player. Use it after your script writes licenses straight to the database or the player metadata.
getVersion
local version = exports['stg-walletv2']:getVersion()Returns the installed version, for example 1.2.4.
Client exports
openWallet / closeWallet
exports['stg-walletv2']:openWallet('black')
exports['stg-walletv2']:closeWallet()Opens the wallet without checking for a wallet item. The color is the item name without _wallet: black, purple, brown or one you added.
isInWallet
local open = exports['stg-walletv2']:isInWallet()Returns true while the wallet is open.
openLicenseMenu
exports['stg-walletv2']:openLicenseMenu()
exports['stg-walletv2']:openLicenseMenu(targetServerId)Opens the license control menu. Without an id it lists nearby players, with an id it goes straight to the give and take menu for that player. Only the jobs in Config.LicenseMenu.jobs can open it.
giveLicenseClient / removeLicenseClient
exports['stg-walletv2']:giveLicenseClient(targetServerId, 'drive_b')
exports['stg-walletv2']:removeLicenseClient(targetServerId, 'drive_b')Same as the server exports, called from the client.
refreshCards
exports['stg-walletv2']:refreshCards()Reloads the cards of the local player.
License hooks
stg-walletv2/server/editable.lua stays editable in the escrow version and runs two functions after every license change, from the license menu, the admin panel, the exports or esx_license:
Config.Functions.onLicenseAdded = function(officer, target, licenseName)
end
Config.Functions.onLicenseRemoved = function(officer, target, licenseName)
endProp
Type
Use them to log changes to Discord, or to block a player from retaking the exam at your driving school right after the police took their license.
On ESX, the same file also listens to esx_license:addLicense and esx_license:removeLicense, so licenses given by other scripts through esx_license show up in the wallet 3 seconds later.
Still having trouble?
Open a ticket on our Discord. Our team answers around 15 hours a day.