1
0
Fork 0
forked from Simnation/Main

Update server.lua

This commit is contained in:
Nordi98 2025-06-29 05:06:27 +02:00
parent f1922f2eaa
commit 071df6cc88

View file

@ -312,9 +312,35 @@ end)
RegisterServerEvent("okokBanking:SetIBAN")
AddEventHandler("okokBanking:SetIBAN", function(iban)
local xPlayer = QBCore.Functions.GetPlayer(source)
local src = source
local xPlayer = QBCore.Functions.GetPlayer(src)
xPlayer.Functions.ChangeIban(iban)
if not xPlayer then
print("[okokBanking] Error: Player not found")
return
end
if not iban or type(iban) ~= "string" then
print("[okokBanking] Error: Invalid IBAN provided")
return
end
-- Method 1: Store in charinfo (recommended for QBCore, if IBAN is part of charinfo)
if xPlayer.PlayerData.charinfo then
xPlayer.PlayerData.charinfo.iban = iban
xPlayer.Functions.SetPlayerData('charinfo', xPlayer.PlayerData.charinfo)
-- Optional: Sync with database (standard QBCore method)
exports['qb-database']:update('UPDATE players SET charinfo = ? WHERE citizenid = ?', {
json.encode(xPlayer.PlayerData.charinfo),
xPlayer.PlayerData.citizenid
})
else
-- Method 2: Fallback to metadata if charinfo isn't available
xPlayer.Functions.SetMetaData("iban", iban)
end
print(("[okokBanking] Updated IBAN for %s (%s)"):format(xPlayer.PlayerData.name, iban))
end)
QBCore.Functions.CreateCallback("okokBanking:HasCreditCard", function(source, cb)