qbcore-framework / qb-cityhall

City Hall Script For QB-Core
GNU General Public License v3.0
25 stars 186 forks source link

[]Weapon Lic at city hall #106

Closed wscooter closed 9 months ago

wscooter commented 10 months ago

Describe the bug I'm having the problem of when you issue the Weapon lic thru ps mdt or the /grantlic. command you go to the city hall and is does not show at all now i can go restart just city hall and it shows up then but i if i revoke the weapon lic and reissue it the lic it won't show up unless you restart the script then it shows up just fine.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'City Hall'
  2. Type in '/grantlic (id) weapon'
  3. Check to see if lic cause on my side i dont see it
  4. if it not there then restart city hall only

Expected behavior Give Weapon Lic..

Screenshots If applicable, add screenshots to help explain your problem.

Questions (please complete the following information):

Additional context Here is the Code for Grant Lic. QBCore.Commands.Add("grantlicense", Lang:t("commands.license_grant"), {{name = "id", help = Lang:t('info.player_id')}, {name = "license", help = Lang:t('info.license_type')}}, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) if Player.PlayerData.job.name == "police" and Player.PlayerData.job.grade.level >= Config.LicenseRank then if args[2] == "driver" or args[2] == "weapon" then local SearchedPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) if not SearchedPlayer then return end local licenseTable = SearchedPlayer.PlayerData.metadata["licences"] if licenseTable[args[2]] then TriggerClientEvent('QBCore:Notify', src, Lang:t("error.license_already"), "error") return end licenseTable[args[2]] = true SearchedPlayer.Functions.SetMetaData("licences", licenseTable) TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t("success.granted_license"), "success") TriggerClientEvent('QBCore:Notify', src, Lang:t("success.grant_license"), "success") else TriggerClientEvent('QBCore:Notify', src, Lang:t("error.error_license_type"), "error") end else TriggerClientEvent('QBCore:Notify', src, Lang:t("error.rank_license"), "error") end end)

QBCore.Commands.Add("revokelicense", Lang:t("commands.license_revoke"), {{name = "id", help = Lang:t('info.player_id')}, {name = "license", help = Lang:t('info.license_type')}}, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) if Player.PlayerData.job.name == "police" and Player.PlayerData.job.grade.level >= Config.LicenseRank then if args[2] == "driver" or args[2] == "weapon" then local SearchedPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) if not SearchedPlayer then return end local licenseTable = SearchedPlayer.PlayerData.metadata["licences"] if not licenseTable[args[2]] then TriggerClientEvent('QBCore:Notify', src, Lang:t("error.error_license"), "error") return end licenseTable[args[2]] = false SearchedPlayer.Functions.SetMetaData("licences", licenseTable) TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t("error.revoked_license"), "error") TriggerClientEvent('QBCore:Notify', src, Lang:t("success.revoke_license"), "success") else TriggerClientEvent('QBCore:Notify', src, Lang:t("error.error_license"), "error") end else TriggerClientEvent('QBCore:Notify', src, Lang:t("error.rank_revoke"), "error") end end)

I have tried going to a discord support call but no one was wanting too help out on this any help will be helpful. THANK YOU!!!

wscooter commented 10 months ago

Also the problem is doing it on the driver lic too only way they would show up is if you restart the script