Closed altefwan closed 1 year ago
Created a quick fix by updating the following event:
RegisterNetEvent('qb-banking:updatePin', function(currentBankCard, newPin)
if newPin ~= nil then
local src = source
local xPlayer = QBCore.Functions.GetPlayer(src)
if not xPlayer then return end
MySQL.update('UPDATE bank_cards SET cardPin = ? WHERE record_id = ?', {
newPin,
currentBankCard.record_id
}, function(result)
if result == 1 then
local invItems = xPlayer.PlayerData.items
for _, v in pairs(invItems) do
if v.name == currentBankCard.cardType and currentBankCard.cardNumber == tostring(v.info.cardNumber) then
v.info.cardPin = newPin
end
end
xPlayer.Functions.SetPlayerData("items", invItems)
TriggerClientEvent('qb-banking:openBankScreen', src)
TriggerClientEvent('qb-banking:successAlert', src, Lang:t('success.updated_pin'))
else
TriggerClientEvent('QBCore:Notify', src, 'Error updating pin', "error")
end
end)
end
end)
Describe the bug When changing card PIN, the new PIN won't be recognized on ATMs. The PIN stays at when you first created the card. Looking at the database and quick look at the code, it seems that the record updates the data on bank_cards but is not being cascaded to the inventory field in players. Thus, the PIN stays at when you first created the card. Additionally, the ATM login page does not show errors and notifications.
To Reproduce Steps to reproduce the behavior: