Background information
internal command and general information about how the script works.
Framework Integration
Compatibility Layer
The server/compatibility.lua file provides a unified interface across frameworks:
Wrapper Functions:
user.getName()- Get character full nameuser.getFirstname()- Get first name onlyuser.getMoney()- Get cash amountuser.addMoney(amount)- Add moneyuser.removeMoney(amount)- Remove moneyuser.getItemAmount(name)- Get item countuser.removeItem(name, amount)- Remove items
Implementation Pattern:
if Config.Framework == "custom" then
local Framework = {}
TriggerEvent("getFrameworkCore", function(core) -- <- ADAPT THE EVENT OR REWRITE TO GET YOUR FRAMEWORKS CORE FUNCTIONS
Framework = core
end)
AddEventHandler("d_roulette:custom:getCharacterFromId", function(source, cb)
local _source = source
local char = Framework.GetPlayer(_source) -- <- ADAPT THE FUNCTION ON THE RIGHT OF "=" TO RETURN CHARACTER OBJECT
if char then
local user = {}
-- wrapper functions to return and set data from custom framework
user.getName = function() return char.data.firstname.." "..char.data.lastname end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO RETURN FULL NAME
user.getFirstname = function() return char.data.firstname end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO RETURN FIRSTNAME
user.getMoney = function() return char.func.getMoney(currency) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO RETURN PLAYER MONEY
user.removeMoney = function(amount) char.func.removeMoney(currency, amount) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO REMOVE PLAYER MONEY
user.addMoney = function(amount) char.func.addMoney(currency, amount) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO ADD PLAYER MONEY
user.getItemAmount = function(name) return char.inventory.func.getItemCount(name) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO GET PLAYER INVENTORY ITEM AMOUNT
user.removeItem = function(name, amount) char.inventory.func.removeItem(name, amount) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO REMOVE ITEM FROM PLAYER INVENTORY
cb(user)
else
cb(nil)
end
end)
endAdding New Framework Support
To add support for a new framework:
Set framework identifier to
Config.Framework = "custom"Configure wrapper events names for notifications in
config.lua:
Implement server wrapper in
server/compatibility.lua:
Console Commands
The roulette command can be used for debugging and administration directly from the server console. Only usable server-side.
Toggle Debug Logging: Enables or disables detailed debug prints in the console.
View Active Tables: Shows a list of all currently active roulette tables, their state, and the players at each table.
Reset/Delete a Table: Forcibly stops, resets and deletes a specific game table.
External Events
The script provides events you can use in external scripts, for example, to disable inventory or other UI functions while a player is at a table.
Client-Side Events
These events are triggered on the client.
Player Joins a Table: Fires when the local player sits down at a roulette table.
Player Leaves a Table: Fires when the local player gets up from a roulette table.
Server-Side Events
These events are triggered on the server and provide detailed information about game outcomes.
Player Wins a Round: Fires every time a player has one or more winning bets in a round.
Player Loses All Bets: Fires only when a player loses all chips they placed in a round (i.e., has no winning bets).
Last updated