Banking & ATMs

Commands, Exports & Events

Every command, export and event of Banking & ATMs, with what to pass, what you get back and an example.

View in store

Everything other resources can use to work with Banking & ATMs: chat commands, exports you can call from your own scripts, and events you can listen to or trigger.

Commands

Command

/fine

Opens the fines tablet: issue a fine to a nearby player or look through the fines history. The command name is Config.Fines.Command.

Arguments

None.

Who can use it

Jobs listed in Config.Fines.Jobs

Server exports

ServerExport

GetSocietyMoney

Reads the balance of a job's society account.

What you pass

  • jobstring

    Job name, e.g. 'police'.

What you get back

  • balancenumber

    The current balance. 0 when the job has no account yet.

Example

Lua
local balance = exports.lg_banking:GetSocietyMoney('police')
print(('Police account: $%d'):format(balance))
ServerExport

AddSocietyMoney

Adds money to a job's society account (the account is created if it does not exist).

What you pass

  • jobstring

    Job name.

  • amountnumber

    Amount to add. Must be more than 0; decimals are rounded down.

What you get back

  • successboolean

    true when it worked, false when the input was invalid.

Example

Lua
-- Pay the mechanics' society for a repair
exports.lg_banking:AddSocietyMoney('mechanic', 750)
ServerExport

RemoveSocietyMoney

Takes money out of a job's society account. Nothing is taken if the account does not have enough.

What you pass

  • jobstring

    Job name.

  • amountnumber

    Amount to remove. Must be more than 0.

What you get back

  • successboolean

    false when the account does not have enough money or the input is invalid.

Example

Lua
if not exports.lg_banking:RemoveSocietyMoney('police', 5000) then
    print('Not enough money in the police account')
end
ServerExport

SetSocietyMoney

Sets a job's society balance to an exact amount.

What you pass

  • jobstring

    Job name.

  • amountnumber

    New balance, 0 or more.

What you get back

  • successboolean

    true when it worked, false when the input was invalid.

Example

Lua
exports.lg_banking:SetSocietyMoney('ambulance', 100000)
ServerExport

IssueFine

Gives a player a fine, exactly like an officer would from the fines tablet. The player gets a notification and can pay it at a bank.

What you pass

  • targetSourcenumber

    Server id of the player who gets the fine.

  • amountnumber

    Fine amount, more than 0.

  • reasonstring

    Why the fine was given. Shown to the player and in the history.

  • jobstringoptional

    Job that issued the fine. Defaults to 'police'.

  • issuerNamestringoptional

    Name shown as the issuer, e.g. 'Speed Camera'. Defaults to "System".

What you get back

  • fineIdnumber | nil

    Id of the new fine, or nil if the player is not loaded or the amount / reason is invalid.

Example

Lua
-- A speed camera fines a player
local fineId = exports.lg_banking:IssueFine(source, 500, 'Speeding (92 km/h in a 50 zone)', 'police', 'Speed Camera')
ServerExport

GetUnpaidFines

Lists a character's fines that are not paid yet.

What you pass

  • citizenIdstring

    Character identifier (citizenid on QBCore / Qbox, identifier on ESX).

What you get back

  • finestable[]

    Array of fines, each with id, amount, reason, job_name, officer_name, target_name, status and created_at. Empty when there are none.

Example

Lua
local fines = exports.lg_banking:GetUnpaidFines(citizenId)
for _, fine in ipairs(fines) do
    print(fine.id, fine.amount, fine.reason)
end
ServerExport

OpenBank

Opens the bank screen for a player.

What you pass

  • sourcenumber

    The player's server id.

What you get back

Nothing.

Example

Lua
exports.lg_banking:OpenBank(source)
ServerExport

OpenATM

Opens the ATM screen for a player.

What you pass

  • sourcenumber

    The player's server id.

What you get back

Nothing.

Example

Lua
exports.lg_banking:OpenATM(source)

Client exports

ClientExport

OpenBank

Opens the bank screen for the local player, e.g. from your own target or interaction script.

What you pass

Nothing.

What you get back

Nothing.

Example

Lua
exports.lg_banking:OpenBank()
ClientExport

OpenATM

Opens the ATM screen for the local player.

What you pass

Nothing.

What you get back

Nothing.

Example

Lua
exports.lg_banking:OpenATM()
ClientExport

IsOpen

Tells you whether the bank or ATM screen is open right now.

What you pass

Nothing.

What you get back

  • openboolean

    true while the screen is open.

Example

Lua
if exports.lg_banking:IsOpen() then return end

Events

ServerEventYou listen to it

lg_banking:server:societyChanged

Fired whenever a society balance changes (deposits, withdrawals, exports and admin changes).

What you receive

  • jobstring

    Job whose account changed.

  • newBalancenumber

    Balance after the change.

Example

Lua
AddEventHandler('lg_banking:server:societyChanged', function(job, newBalance)
    print(job .. ' now has $' .. newBalance)
end)
ServerEventYou listen to it

lg_banking:server:transferred

Fired after a player sends money to another player.

What you receive

  • fromSourcenumber

    Server id of the sender.

  • toSourcenumber

    Server id of the receiver.

  • amountnumber

    Amount sent.

Example

Lua
AddEventHandler('lg_banking:server:transferred', function(fromSource, toSource, amount)
    -- e.g. log large transfers
end)
ServerEventYou listen to it

lg_banking:server:fineIssued

Fired when a fine is given (from the tablet or the IssueFine export).

What you receive

  • fineIdnumber

    Id of the fine.

  • targetSourcenumber

    Server id of the fined player.

  • amountnumber

    Fine amount.

  • jobstring

    Job that issued it.

ServerEventYou listen to it

lg_banking:server:finePaid

Fired when a player pays a fine.

What you receive

  • fineIdnumber

    Id of the fine.

  • sourcenumber

    Server id of the player who paid.

  • amountnumber

    Amount paid.

  • jobstring

    Job that issued the fine.

ServerEventYou trigger it

lg_banking:server:addSocietyMoney

Same as the AddSocietyMoney export, as an event. Only works when triggered from a server script (TriggerEvent); players cannot trigger it.

What you send

  • jobstring

    Job name.

  • amountnumber

    Amount to add.

Example

Lua
TriggerEvent('lg_banking:server:addSocietyMoney', 'police', 2500)
ServerEventYou trigger it

lg_banking:server:removeSocietyMoney

Same as the RemoveSocietyMoney export, as an event. Server scripts only.

What you send

  • jobstring

    Job name.

  • amountnumber

    Amount to remove.

ServerEventYou trigger it

lg_banking:server:setSocietyMoney

Same as the SetSocietyMoney export, as an event. Server scripts only.

What you send

  • jobstring

    Job name.

  • amountnumber

    New balance.

ClientEventYou trigger it

lg_banking:client:openBank

Opens the bank screen. Trigger it from the server for one player.

What you send

No data.

Example

Lua
TriggerClientEvent('lg_banking:client:openBank', source)
ClientEventYou trigger it

lg_banking:client:openATM

Opens the ATM screen. Trigger it from the server for one player.

What you send

No data.

Example

Lua
TriggerClientEvent('lg_banking:client:openATM', source)

Last updated