Firstly you will need to add the following to each dealership in the config.lua
licenseCheck =false, -- false = no license required to open dealershiplicense ='driver', -- this is the license name required
You will need to replace the following function in config-sv.lua
"jg-dealerships:server:showroom-pre-check"
Framework.Server.CreateCallback("jg-dealerships:server:showroom-pre-check", function(src,cb,dealershipId)local allowed =false-- QBCORE LICENSE CHECKSlocal Player = QBCore.Functions.GetPlayer(src)local licenseCheck = Config.DealershipLocations[dealershipId].licenseChecklocal license = Player.PlayerData.metadata['licences'][Config.DealershipLocations[dealershipId].license]if licenseCheck thenifnot license then allowed =falseelseif license then allowed =trueendelse allowed =trueend-- Write some server-sided code here. Again, update the "allowed" variableifnot allowed then Framework.Server.Notify(src, "You require a ".. Config.DealershipLocations[dealershipId].license.. " license", "error")
returncb({ error =true })endreturncb()end)
Only want to setup individual dealerships and not all you can replace config-sv function with the following config-sv.lu
Framework.Server.CreateCallback("jg-dealerships:server:showroom-pre-check", function(src,cb,dealershipId)local allowed =false-- QBCORE License Check-- dealershipId is the name of your dealership in the config.luaif dealershipId =="boat" thenlocal Player = QBCore.Functions.GetPlayer(src)local license = Player.PlayerData.metadata['licences'][Config.DealershipLocations[dealershipId].license]ifnot license then allowed =falseendend-- Write some server-sided code here. Again, update the "allowed" variableifnot allowed then Framework.Server.Notify(src, "You require a ".. Config.DealershipLocations[dealershipId].license.. " license", "error")
returncb({ error =true })endreturncb()end)