Skip to content

Commit

Permalink
Reverts #414
Browse files Browse the repository at this point in the history
Reverts PR, breaks licenses not showing correctly, will push a better update
  • Loading branch information
MonkeyWhisper committed Dec 14, 2023
1 parent dbe4705 commit 04725d6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
15 changes: 12 additions & 3 deletions server/dbm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ function GetPlayerLicenses(identifier)
if metadata["licences"] ~= nil and metadata["licences"] then
return metadata["licences"]
else
return Config.Licenses
return {
['driver'] = false,
['business'] = false,
['weapon'] = false,
['pilot'] = false
}
end
end
end
Expand Down Expand Up @@ -143,8 +148,12 @@ function UpdateAllLicenses(identifier, incomingLicenses)
local result = MySQL.scalar.await('SELECT metadata FROM players WHERE citizenid = @identifier', {['@identifier'] = identifier})
result = json.decode(result)

result.licences = result.licences or Config.Licenses
result.licences['driver'] = true
result.licences = result.licences or {
['driver'] = true,
['business'] = false,
['weapon'] = false,
['pilot'] = false
}

for k, _ in pairs(incomingLicenses) do
result.licences[k] = incomingLicenses[k]
Expand Down
7 changes: 6 additions & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,12 @@ QBCore.Functions.CreateCallback('mdt:server:GetProfileData', function(source, cb
if type(target.charinfo) == 'string' then target.charinfo = json.decode(target.charinfo) end
if type(target.metadata) == 'string' then target.metadata = json.decode(target.metadata) end

local licencesdata = target.metadata['licences'] or Config.Licenses
local licencesdata = target.metadata['licences'] or {
['driver'] = false,
['business'] = false,
['weapon'] = false,
['pilot'] = false
}

local job, grade = UnpackJob(target.job)

Expand Down
9 changes: 0 additions & 9 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ Config.InventoryForWeaponsImages = "lj-inventory"
-- "LegacyFuel", "lj-fuel", "ps-fuel"
Config.Fuel = "ps-fuel"

-- ['License Name'] = true/false. If false, license are set to false by default.
Config.Licenses = {
['driver'] = false,
['business'] = false,
['weapon'] = false,
['pilot'] = false,
['weed'] = false
}

-- Google Docs Link
Config.sopLink = {
['police'] = '',
Expand Down
1 change: 0 additions & 1 deletion ui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var DispatchNum = 0;
var playerJob = "";
let rosterLink = "";
let sopLink = "";
const licenseTypesGlobal = ['business', 'pilot', 'weapon', 'driver', 'weed'];

//Set this to false if you don't want to show the send to community service button on the incidents page
const canSendToCommunityService = false
Expand Down

0 comments on commit 04725d6

Please sign in to comment.