License Check
-- License Requirements
-- Configure license requirements for dealerships
-- Note: In V2, dealership locations are stored in the database
-- Use the dealership ID (UUID) from the dealership_locations to configure license requirements
Config.DealershipLicenses = {
["b4dbbcca-a7ba-462a-b772-3c3e6434612c"] = { -- Replace with your dealership ID
enabled = true,
licenseType = "driver" -- The license type required (e.g., "boat", "pilot", "driver")
},
}---@param dealershipId string
---@return boolean allowed
function ShowroomPreCheck(dealershipId)
local licenseConfig = lib.callback.await("jg-dealerships:server:get-dealership-license-config", false, dealershipId)
if not licenseConfig then
return true
end
if not licenseConfig.enabled then
return true
end
local Player = Framework.Client.GetPlayerData()
local hasLicense = Player.metadata and Player.metadata['licences'] and Player.metadata['licences'][licenseConfig.licenseType]
if not hasLicense then
local msg = "You require a " .. licenseConfig.licenseType .. " license to access this showroom."
Framework.Client.Notify(msg, "error", 5000)
return false
end
return true
endLast updated
Was this helpful?

