License Check
licenseCheck = false, -- false = no license required to open dealership
license = 'driver', -- this is the license name required
function ShowroomPreCheck(dealershipId)
local Player = Framework.Client.GetPlayerData()
local licenseCheck = Config.DealershipLocations[dealershipId].licenseCheck
local license = Player.metadata['licences'][Config.DealershipLocations[dealershipId].license]
if licenseCheck then
if not license then
allowed = false
elseif license then
print(license)
allowed = true
end
else
allowed = true
end
if not allowed then
local msg = "You require a ".. Config.DealershipLocations[dealershipId].license
Framework.Client.Notify(msg, "error", 1000 )
return false
end
return true
end
function ShowroomPreCheck(dealershipId)
if dealershipId ~= "boat" then
return true
end
local allowed = true
local Player = Framework.Client.GetPlayerData()
local licenseType = Config.DealershipLocations[dealershipId].license
local licenseCheck = Config.DealershipLocations[dealershipId].licenseCheck
local hasLicense = Player.metadata['licences'] and Player.metadata['licences'][licenseType]
if licenseCheck then
if not hasLicense then
allowed = false
end
end
if not allowed then
local msg = "You require a " .. licenseType .. " license to access this showroom."
Framework.Client.Notify(msg, "error", 1000)
return false
end
return true
end
Last updated
Was this helpful?