Skip to content
Documentation
Server Essentials4In-Game Store

r_store Exports

Server exports to give, take and read r_store credits from your own scripts, plus sharing credits with r_casino and r_ffa.

All exports are server-side. The amount comes first.

addCoinsToPlayer

exports.r_store:addCoinsToPlayer(100, source)

-- offline player, by their stored identifier
exports.r_store:addCoinsToPlayer(100, nil, 'char1:abcdef0123456789')

Returns true when the credits were added. The player doesn't need to have opened the store before.

removeCoinsFromPlayer

local ok = exports.r_store:removeCoinsFromPlayer(50, source)

Returns false and takes nothing if the player doesn't have enough.

getPlayerCoinBalance

local balance = exports.r_store:getPlayerCoinBalance(source)

getCreditExchange

local info = exports.r_store:getCreditExchange(source)

Returns the R.BuyCredits rates, limits and the player's money, or nil when buying credits is off.

exchangeCredits

local result = exports.r_store:exchangeCredits(source, "buy", 500)   -- or "sell"

Buys or cashes out credits for in-game money at the R.BuyCredits rates. Returns { success = true, balance = ... } or { success = false, reason = ... }.

Shared credits