diff --git a/client/nui.lua b/client/nui.lua index fa35599..c48959d 100644 --- a/client/nui.lua +++ b/client/nui.lua @@ -55,13 +55,24 @@ end --- Setup the items for the NUI function NUI:SetupItems() local items = {} + items[1] = { + name = "ID Card", + price = 100, + id = 1 + } + + local PlayerLicenses = QBCore.Functions.GetPlayerData().metadata["licences"] for key = 1, #Config.items, 1 do - items[#items + 1] = { - name = Config.items[key].label, - price = Config.items[key].price, - id = key - } + for k, value in pairs(PlayerLicenses) do + if (value == true and Config.items[key].meta == k) then + items[#items + 1] = { + name = Config.items[key].label, + price = Config.items[key].price, + id = key + } + end + end end SendNUIMessage({ diff --git a/config.lua b/config.lua index 3ea44d1..75c9a6f 100644 --- a/config.lua +++ b/config.lua @@ -22,24 +22,44 @@ Config.blip = { } -- Jobs for hire -Config.jobs = {{ - job = "police", - label = "LSPD", - salary = 100 -}, { - job = 'ambulance', - label = "EMS", - salary = -1 -}} +Config.jobs = { + { + job = "trucker", + label = "Trucker", + salary = 50 + }, + { + job = "taxi", + label = "Taxi", + salary = 50 + }, + { + job = "tow", + label = "Tow Truck", + salary = 50 + }, + { + job = "reporter", + label = "News Reporter", + salary = 50 + }, +} -- Items for purchase Config.items = {{ item = "id_card", + meta = 'id', label = "ID Card", price = 100 }, { item = "driver_license", label = "Driver License", + meta = 'driver', + price = 100 +}, { + item = "weaponlicense", + label = "Weapon License", + meta = 'weapon', price = 100 }} @@ -50,4 +70,7 @@ Config.licenseItems = {{ }, { item = 'driver_license', label = 'Driver License' +}, { + item = 'weaponlicense', + label = 'Weapon License' }} diff --git a/html/js/app.js b/html/js/app.js index e4cacf0..501bb01 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -157,6 +157,12 @@ class Main { document.getElementById('Sidebar.close').onclick = () => { this.HideCityhall(); } + + document.onkeyup = (data) => { + if (data.which == 27) { + this.HideCityhall(); + } + } } } @@ -362,4 +368,4 @@ let job = new Jobs(); let identity = new Identity(); let information = new Information(); -let main = new Main(); \ No newline at end of file +let main = new Main(); diff --git a/html/js/lang.js b/html/js/lang.js index daaa8f7..95b1654 100644 --- a/html/js/lang.js +++ b/html/js/lang.js @@ -28,11 +28,11 @@ let stringsEN = { "text_information": "My info", "text_close": "Close", - "text_identification": "Identification", - "desc_identification": "Below you can see which identification methods you currently have.", + "text_identification": "ID Cards", + "desc_identification": "Below you can see which ID cards you currently have in your pockets.", - "text_licenses": "Licenses", - "desc_licenses": "Below you can see which licenses you currently have.", + "text_licenses": "Permissions", + "desc_licenses": "Below you can see which ID cards you currently have access to print.", "text_buy": "Buy", "text_apply": "Apply", diff --git a/server/server.lua b/server/server.lua index 2779186..a241cb9 100644 --- a/server/server.lua +++ b/server/server.lua @@ -10,14 +10,15 @@ RegisterNetEvent('mtc-cityhall:server:ApplyJob', function(id) end) RegisterNetEvent('mtc-cityhall:server:BuyIdentity', function(id) - local Player = QBCore.Functions.GetPlayer(source) + local src = source + local Player = QBCore.Functions.GetPlayer(src) if not Player then return end local item = Config.items[id] if not item then return end if not Player.Functions.RemoveMoney('bank', item.price, "Cityhall purchase") then - TriggerClientEvent('QBCore:Notify', source, Lang['not_enough_money'], 'error') + TriggerClientEvent('QBCore:Notify', src, Lang['not_enough_money'], 'error') return end @@ -43,6 +44,6 @@ RegisterNetEvent('mtc-cityhall:server:BuyIdentity', function(id) end Player.Functions.AddItem(item.item, 1, false, info) - TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items[item.item], 'add') - TriggerClientEvent('QBCore:Notify', source, Lang['bought']:format(item.label), 'success') + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item.item], 'add') + TriggerClientEvent('QBCore:Notify', src, Lang['bought']:format(item.label), 'success') end) \ No newline at end of file