Shop Account

Instructions on using tuner shop account in other resources

The resource offers a custom account system that is standalone and not dependent on frameworks.

Get Shop ID

You can get the player's tuner shop id with this export:

local src = source
local shopID = exports['t1ger_tuningsystem']:GetPlayerTunerId(src)
-- src(INT): player server id

Add Account Money

Requires: Tuner Shop ID (use exports to get the ID based on player's server id or player's job name)

exports['t1ger_tuningsystem']:AddAccountMoney(shopId, amount)
-- shopId(INT): tuner shop id
-- amount(INT): amount of money to add to the account

Remove Account Money

Requires: Tuner Shop ID (use exports to get the ID based on player's server id or player's job name)

exports['t1ger_tuningsystem']:RemoveAccountMoney(shopId, amount)
-- shopId(INT): tuner shop id
-- amount(INT): amount of money to add to the account

Usage - Example #1

Here's an example to easily add/remove money from a tuner shop:

local src = source -- player server id
local amount = 5000 -- how much should be added/removed? 

-- export to get the shop id based on player server id:
local shopId = exports['t1ger_tuningsystem']:GetPlayerTunerId(src)

-- add money:
exports['t1ger_tuningsystem']:AddAccountMoney(shopId, amount)

-- remove oney:
exports['t1ger_tuningsystem']:RemoveAccountMoney(shopId, amount)

Usage - Example #2

Here's an alternative example using TriggerEvent (similar to esx_addonaccount)

local playerJob = 't1tuner' -- add function/export to get the player's job here. 
local amount = 5000 -- how much should be added/removed? 

TriggerEvent('tuningsystem:server:getPlayerTunerShop', playerJob, function(tunerShop)
    -- remove money:
    if tunerShop.account >= amount then
        exports['t1ger_tuningsystem']:RemoveAccountMoney(tunerShop.id, amount)
    else
        print("not enough money")
    end
    -- add money:
    exports['t1ger_tuningsystem']:AddAccountMoney(tunerShop.id, amount)
end)

Last updated