Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add offline player account statement support #138

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ local function CreateGangAccount(accountName, accountBalance)
end
exports('CreateGangAccount', CreateGangAccount)

local function CreateBankStatement(playerId, account, amount, reason, statementType, accountType)
local Player, citizenid = getPlayerAndCitizenId(playerId)
if not Player or not citizenid then return false end
local function _createBankStatement(Player, account, amount, reason, statementType, accountType)
if not Player then return false end
local citizenid = Player.PlayerData.citizenid

local newStatement = {
citizenid = citizenid,
Expand All @@ -90,8 +90,19 @@ local function CreateBankStatement(playerId, account, amount, reason, statementT
if not insertSuccess then return false end
return true
end

local function CreateBankStatement(playerId, account, amount, reason, statementType, accountType)
local Player, _ = getPlayerAndCitizenId(playerId)
return _createBankStatement(Player, account, amount, reason, statementType, accountType)
end
exports('CreateBankStatement', CreateBankStatement)

local function CreateCitizenBankStatement(citizenId, amount, reason, statementType)
local Player = QBCore.Functions.GetPlayerByCitizenId(citizenId) or QBCore.Functions.GetOfflinePlayerByCitizenId(citizenId)
_createBankStatement(Player, 'checking', amount, reason, statementType, 'player')
end
exports('CreateCitizenBankStatement', CreateCitizenBankStatement)

local function AddMoney(accountName, amount, reason)
if not reason then reason = 'External Deposit' end
local newStatement = {
Expand Down
Loading