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
- Lua Example
- JS Example
- TS Example
exports.pefcl:openBank()
exports.pefcl.openBank()
exports.pefcl.openBank()
closeBank
Closes the Bank UI
- Lua Example
- JS Example
- TS Example
exports.pefcl:closeBank()
exports.pefcl.closeBank()
exports.pefcl.closeBank()
openAtm
Opens the ATM UI
- Lua Example
- JS Example
- TS Example
exports.pefcl:openAtm()
exports.pefcl.openAtm()
exports.pefcl.openAtm()
closeAtm
Closes the ATM UI
- Lua Example
- JS Example
- TS Example
exports.pefcl:closeAtm()
exports.pefcl.closeAtm()
exports.pefcl.closeAtm()
giveNearestPlayerCash
Gives amount of cash to the nearest player.
- Lua Example
- JS Example
- TS Example
exports.pefcl:giveNearestPlayerCash(amount)
exports.pefcl.giveNearestPlayerCash(amount)
exports.pefcl.giveNearestPlayerCash(amount: number)
- amount:
number
- Amount of cash to be given to the nearest player.
createInvoiceForNearestPlayer
Creates an invoice for the nearest player.
- Lua Example
- JS Example
- TS Example
exports.pefcl:createInvoiceForNearestPlayer(amount, message)
exports.pefcl.createInvoiceForNearestPlayer(amount, message)
exports.pefcl.createInvoiceForNearestPlayer(amount: number, message: string)
- amount:
number
- Decides how much the invoice should be
- message:
string
- Invoice description
depositMoney
Deposits money into default account, without ATM.
- Lua Example
- JS Example
- TS Example
exports.pefcl:depositMoney(amount)
exports.pefcl.depositMoney(amount)
exports.pefcl.depositMoney(amount: number)
withdrawMoney
Withdraws money from default account, without ATM.
- Lua Example
- JS Example
- TS Example
exports.pefcl:withdrawMoney(amount)
exports.pefcl.withdrawMoney(amount)
exports.pefcl.withdrawMoney(amount: number)
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;
}
- Lua
- JavaScript
- Typescript
AddEventHandler('pefcl:newTransaction', function(transaction)
ShowNotification("You got a new transaction of" .. transaction.amount)
end)
onNet('pefcl:newTransaction', (transaction) => {
showNotification(`You got a new transaction of ${transaction.amount}`)
}
onNet('pefcl:newTransaction', (transaction: Transaction) => {
showNotification(`You got a new transaction of ${transaction.amount}`)
}