Exports

Open Menu in client side:

TriggerEvent('ata_coinshop:openMenu')

Server Exports

GetCoin

exports['ata_coinshop']:GetCoin(identifier)

Returns the coin amount for a player

  • Parameters:

    • identifier: Player's identifier (steam/license)

  • Returns:

    • Number: Player's coin amount

  • Example:

local coins = exports['ata_coinshop']:GetCoin('steam:123456789')

AddCoin

exports['ata_coinshop']:AddCoin(identifier, amount)

Adds coins to a player's balance

  • Parameters:

    • identifier: Player's identifier

    • amount: Number of coins to add

  • Example:

exports['ata_coinshop']:AddCoin('steam:123456789', 100)

RemoveCoin

exports['ata_coinshop']:RemoveCoin(identifier, amount)

Removes coins from a player's balance

  • Parameters:

    • identifier: Player's identifier

    • amount: Number of coins to remove

  • Example:

exports['ata_coinshop']:RemoveCoin('steam:123456789', 50)

SetCoin

exports['ata_coinshop']:SetCoin(identifier, amount)

Sets a player's coin balance

  • Parameters:

    • identifier: Player's identifier

    • amount: New coin balance

  • Example:

exports['ata_coinshop']:SetCoin('steam:123456789', 200)

Client Events

Open Menu Event

TriggerEvent('ata_coinshop:openMenu')

Opens the coin shop menu for the player

  • Example:

RegisterCommand('shop', function()
    TriggerEvent('ata_coinshop:openMenu')
end)

Integration Examples

Adding Coins on Player Join

AddEventHandler('playerConnecting', function()
    local identifier = GetPlayerIdentifier(source)
    exports['ata_coinshop']:AddCoin(identifier, 100) -- Give 100 coins on join
end)

Checking Coins Before Purchase

local function CanPlayerAfford(identifier, price)
    local coins = exports['ata_coinshop']:GetCoin(identifier)
    return coins >= price
end

Custom Shop Integration

RegisterCommand('customshop', function()
    local identifier = GetPlayerIdentifier(source)
    local coins = exports['ata_coinshop']:GetCoin(identifier)
    
    if coins >= 50 then
        exports['ata_coinshop']:RemoveCoin(identifier, 50)
        -- Give item to player
    end
end)

Database Integration

The script uses the following database structure:

  • ESX: users table with coinVIP column

  • QB-Core: players table with coinVIP column

Next Step: Would you like me to add more examples or specific integration scenarios?

Last updated