Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job locked licenses #7

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions client/nui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function NUI:SetupItems()
}

local PlayerLicenses = QBCore.Functions.GetPlayerData().metadata["licences"]
local PlayerJobLicenses = QBCore.Functions.GetPlayerData().job.name

for key = 1, #Config.items, 1 do
for k, value in pairs(PlayerLicenses) do
Expand All @@ -73,6 +74,13 @@ function NUI:SetupItems()
}
end
end
if (Config.items[key].job == PlayerJobLicenses) then
items[#items + 1] = {
name = Config.items[key].label,
price = Config.items[key].price,
id = key
}
end
end

SendNUIMessage({
Expand Down
25 changes: 13 additions & 12 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,21 @@ Config.jobs = {

-- Items for purchase
Config.items = {{
item = "id_card",
meta = 'id',
label = "ID Card",
price = 100
item = "id_card", -- Name of ID Document
meta = 'id', -- Metadata to check if eligible for ID document
label = "ID Card", -- Label to show in the menu for the ID document
price = 100 -- Price of the ID document
}, {
item = "driver_license",
label = "Driver License",
meta = 'driver',
price = 100
item = "driver_license", -- Name of ID Document
label = "Driver License",-- Label to show in the menu for the ID document
meta = 'driver', -- Metadata to check if eligible for ID document
price = 100 -- Price of the ID document
}, {
item = "weaponlicense",
label = "Weapon License",
meta = 'weapon',
price = 100
item = "weaponlicense", -- Name of ID Document
label = "Weapon License", -- Label to show in the menu for the ID document
meta = 'weapon', -- Metadata to check if eligible for ID document
--job = 'ammunation' -- Job check this will show the ID document to anyone with this job, Make sure to comment out "meta" if wanting to use the job check
price = 100 -- Price of the ID document
}}

-- Items shown in the information tab
Expand Down