Skip to main content

Client exports & events

Exports

PEFCL exposes a few useful exports that be used from other resources to integrate better with the financing system. The exports support both callback & promises.

openBank

Opens the Bank UI. This can be used to open the bank anywhere

exports.pefcl:openBank()

closeBank

Closes the Bank UI

exports.pefcl:closeBank()

openAtm

Opens the ATM UI

exports.pefcl:openAtm()

closeAtm

Closes the ATM UI

exports.pefcl:closeAtm()

giveNearestPlayerCash

Gives amount of cash to the nearest player.

exports.pefcl:giveNearestPlayerCash(amount)
  • amount: number
    • Amount of cash to be given to the nearest player.

createInvoiceForNearestPlayer

Creates an invoice for the nearest player.

exports.pefcl:createInvoiceForNearestPlayer(amount, message)
  • amount: number
    • Decides how much the invoice should be
  • message: string
    • Invoice description

depositMoney

Deposits money into default account, without ATM.

exports.pefcl:depositMoney(amount)

withdrawMoney

Withdraws money from default account, without ATM.

exports.pefcl:withdrawMoney(amount)

Events

pefcl:newTransaction

interface Account {
id: number;
number: string;
balance: number;
isDefault: boolean;
accountName: string;
ownerIdentifier: string;
role: 'owner' | 'admin' | 'contributor';
type: 'personal' | 'shared';
createdAt?: string;
}

interface Transaction {
id: number;
toAccount?: Account;
fromAccount?: Account;

amount: number;
message: string;
type: 'Outgoing' | 'Incoming';

updatedAt?: string;
createdAt?: string;
}
AddEventHandler('pefcl:newTransaction', function(transaction)
ShowNotification("You got a new transaction of" .. transaction.amount)
end)