downloadExports

Exports & API

The Cue Coin System provides a comprehensive API through exports and events, allowing seamless integration with your other resources.

Server Exports

GetPlayerCoins

Returns the player's current coin balance.

local coins = exports['coinsystem_esx']:GetPlayerCoins(source)

Parameters:

  • source - Player server ID

Returns:

  • number - Player's coin balance

Example:

RegisterServerEvent('myshop:checkBalance')
AddEventHandler('myshop:checkBalance', function()
    local source = source
    local balance = exports['coinsystem_esx']:GetPlayerCoins(source)
    TriggerClientEvent('chat:addMessage', source, {args = {"Balance", "You have " .. balance .. " coins"}})
end)

AddPlayerCoins

Adds coins to a player's account.

Parameters:

  • source - Player server ID

  • amount - Number of coins to add

  • reason - String describing the reason (for logging)

Example:

RemovePlayerCoins

Removes coins from a player's account.

Parameters:

  • source - Player server ID

  • amount - Number of coins to remove

  • reason - String describing the reason (for logging)

Example:

GetPlayerVIP

Returns player's VIP status and remaining days.

Parameters:

  • source - Player server ID

Returns:

  • table - VIP data object with properties:

    • isVip - Boolean indicating VIP status

    • daysRemaining - Number of VIP days left

    • expireDate - VIP expiration date

Example:

SetPlayerVIP

Sets a player's VIP status for a specified number of days.

Parameters:

  • source - Player server ID

  • days - Number of VIP days to grant

Example:

LogTransaction

Manually logs a transaction to the database.

Parameters:

  • identifier - Player identifier

  • action - Action type (e.g., "purchase", "reward", "admin_give")

  • itemName - Item involved (can be nil)

  • amount - Coin amount

  • oldBalance - Balance before transaction

  • newBalance - Balance after transaction

Example:

Client Exports

OpenShop

Opens the coin shop UI for the player.

Example:

CloseShop

Closes the coin shop UI.

Example:

IsShopOpen

Returns whether the coin shop UI is currently open.

Returns:

  • boolean - True if shop is open, false otherwise

Example:

Events

Server Events

Listening for Events

Available Server Events

Event Name
Parameters
Description

coinsystem:playerCoinsChanged

newBalance, oldBalance, reason

Triggered when player's coin balance changes

coinsystem:playerVIPChanged

isVip, daysRemaining

Triggered when player's VIP status changes

coinsystem:missionCompleted

missionId, reward

Triggered when player completes a mission

coinsystem:purchaseCompleted

itemType, itemName, price

Triggered when player makes a purchase

Client Events

Available Client Events

Event Name
Parameters
Description

coinsystem:shopOpened

None

Triggered when shop UI opens

coinsystem:shopClosed

None

Triggered when shop UI closes

coinsystem:balanceUpdated

newBalance

Triggered when player's coin balance updates

Integration Examples

Job System Integration

Shop System Integration

Housing System Integration

Vehicle Shop Integration

Casino/Gambling Integration

VIP Benefits Integration

Admin Commands

Database Queries

Custom Database Operations

circle-check
  • Always check coin balance before deducting coins

  • Use meaningful reasons when logging transactions

  • Consider VIP multipliers for enhanced user experience

  • Test all integrations thoroughly before deploying

  • Use events to create seamless integration between resources

circle-info

Framework Compatibility

All exports work with both ESX and QBCore frameworks. The system automatically detects your framework and adapts accordingly.

Last updated