Browse docs
Coinsystem V2
Installation
Automatic installation of the complete database schema is available from 2.4.5.
Install the current sky_base and configure oxmysql as its SQL adapter. Start the database,
framework and configured integrations before these resources:
ensure sky_base
ensure sky_coinsystem
Coinsystem automatically creates missing tables and adds missing columns through Sky.DB.Migrate.
The included import.sql describes the same schema for reference or manual preparation; no manual
SQL import is needed. Existing player records are retained. The database user needs permission to
create and alter tables and to read and write their data.
This database-based version does not require add_filesystem_permission sky_base write sky_coinsystem.
Other installed Sky scripts may still need their filesystem permissions.
Updating an existing installation
Back up the Coinsystem tables, replace the resource files, and start the resource. Missing tables and columns are installed automatically, including pending case rewards and Tebex delivery records. Balances, VIP data, redeem codes, stock and discounts remain in their existing tables.
Coinsystem already stores its current persistent data in SQL; it has no legacy JSON data files to import.
The old migration.sql for a V1 upgrade is a separate historical migration and is not run automatically.
Configuration
Configure Everything Online
All settings are managed through our config tool
Commands
Gives coins to a specified player.
/givecoins [playerId] [amount]
/givecoins 12 100
Generates a new redeem code with the specified amount.
/gencode [amount]
/gencode 100
Generates a new redeem code for the specified vip tier.
/genvipcode [tierId]
/genvipcode bronze
Creates a discount for a specific shop product or case. You can edit existing discounts by using this command again.
/discount [productLabel] [percentage] [expiresInHours]
/discount "Progen T20" 20 48
"Progen T20")Exports
Open the Shop Interface.
exports.sky_coinsystem:open()
Give coins to a player.
exports.sky_coinsystem:giveCoins(playerId, amount)
Remove coins from a player.
exports.sky_coinsystem:removeCoins(playerId, amount)
Get coins of a player.
exports.sky_coinsystem:getCoins(playerId)
Pause automatic playtime coins while a player is in another script's AFK mode. Server-side only.playerId is the player's server ID; isAfk must be true to pause or false to resume.
Returns true on success. Invalid arguments raise an error.
exports.sky_coinsystem:setAfk(playerId, isAfk)
exports.sky_coinsystem:setAfk(playerId, true)
exports.sky_coinsystem:setAfk(playerId, false)
AFK time does not count toward the next reward and is never paid retroactively. Active playtime earned before AFK is retained. Repeated calls with the same state are safe, and the AFK state is cleared on disconnect. The AFK script must resume rewards when its AFK mode ends, including its own shutdown cleanup. For client-side AFK detection, synchronize the state through your AFK script's server logic and call this export there.
This only pauses automatic playtime rewards. Manual giveCoins credits, redeem codes, and
Tebex purchases continue to work.
Get the vip tier of a player. Returns the tier id or nil.
exports.sky_coinsystem:getVipStatus(playerId)
Custom Rewards
Coinsystem supports custom shop rewards through the shared sky_base/config/sv_functions.lua reward hook.
See Custom Rewards for the full setup guide and examples.
Test Drive Integrations
Coinsystem provides cancelable server blockers, lifecycle events, and a vehicle state bag for test drive integrations.
See Test Drive Events & Blockers for signatures, parameters, end reasons, and examples.
Support
Need help? Our support team is always ready to assist
Join Discord