Skip to content
ESX Addons
Addon Account

esx_addonaccount

https://github.com/esx-framework/esx_addonaccount

Special Accounts System, used by esx_society and esx_billing for storing money.

Usage

There is two types of accounts: shared and not shared.

  • Shared accounts doesn’t belong to a specific user. Example: society accounts.
  • None-shared accounts are created for every user in the server. They are created in db when player is loaded, Example: esx_property accounts.

Database Information

An addon account must be configured in the database before using it. you must run a server restart after this.

Table Structure

  • name
    • type: string
    • description: name of the account
  • label
    • type: string
    • description: label of the account (not used)
  • shared
    • type: boolean
    • description: is the account shared with others? (boolean either 0 or 1)

API

getAccount

  • Event: esx_addonaccount:getAccount

    • Usage: TriggerEvent('esx_addonaccount:getAccount', name, owner, cb)
    • Example:
    TriggerEvent('esx_addonaccount:getSharedAccount', 'society_realestateagent', function(account)
      account.addMoney(500)
    end)
  • Export: exports['esx_addonaccount']:getAccount

    • Usage: exports['esx_addonaccount']:getAccount(name, owner)
    • Example:
    local account = exports['esx_addonaccount']:getAccount('property_black_money', 'steam:0123456789')
    account.addMoney(500))

getSharedAccount

  • Event: esx_addonaccount:getSharedAccount

    • Usage: TriggerEvent('esx_addonaccount:getSharedAccount', name, cb)
    • Example:
    TriggerEvent('esx_addonaccount:getSharedAccount', 'society_realestateagent', function(account)
      account.addMoney(500)
    end)
  • Export: exports['esx_addonaccount']:getSharedAccount

    • Usage: exports['esx_addonaccount']:getSharedAccount(name)
    • Example:
    local account = exports['esx_addonaccount']:getSharedAccount('society_realestateagent')
    account.addMoney(500)