R_ArmWrestle
r_armwrestle Exports & Hooks
r_armwrestle server exports SpawnTable, RemoveTable and GetTables, and the custom hooks in cl_custom.lua and sv_custom.lua.
Server exports
SpawnTable
Adds a table from your own resource.
local id = exports.r_armwrestle:SpawnTable(vec3(-1172.6, -1572.2, 4.66), 35.0)
local id2 = exports.r_armwrestle:SpawnTable(vec4(1990.4, 3047.1, 46.21, 240.0), nil, 'bkr_prop_clubhouse_arm_wrestle_02a')| Parameter | Type | Description |
|---|---|---|
coords | vector3 or vector4 | Base of the table. |
heading | number? | Heading in degrees. |
model | string? | Table prop. Defaults to R.TableModel. |
Returns the table id. Tables added this way are removed when r_armwrestle stops, so add them again when it starts (see the example below).
RemoveTable
local removed = exports.r_armwrestle:RemoveTable(id)Removes a table. A match on it ends and stakes are returned. Returns true or false.
GetTables
local tables = exports.r_armwrestle:GetTables()
-- { { id = 1, x = -1172.6, y = -1572.2, z = 4.66, h = 35.0, model = 'prop_arm_wrestle_01', kind = 'config' }, ... }kind is 'config', 'export' or 'detected' (a table on the map).
Is the player in a match?
if LocalPlayer.state.r_armwrestle then
return -- in an arm wrestling match, don't open the phone
endCustom hooks
client/cl_custom.lua and server/sv_custom.lua are open for you to edit.
Client: client/cl_custom.lua
| Hook | What it's for |
|---|---|
Custom.CanSit(tableId) | Return false to stop the player sitting down. |
Custom.IsDown() | Return true while your ambulance script has the player downed. |
Custom.OnMatchStart(tableId) | Runs when a match starts. |
Custom.OnMatchEnd(tableId, reason, wins) | Runs when the player stands up. |
Custom.Notify(message, kind) | Every notification. Swap in your own notify here. |
function Custom.Notify(message, kind)
lib.notify({ description = message, type = kind == 'info' and 'inform' or kind })
endIf you use ox_lib here, add '@ox_lib/init.lua' to shared_scripts in fxmanifest.lua.
Server: server/sv_custom.lua
| Hook | What it's for |
|---|---|
Custom.CanSit(src, tableId) | Return false to refuse, for example for a jailed player. |
Custom.CanBet(src, amount) | Return false to block betting. |
Custom.IsDown(src) | Return true for a downed player. |
Custom.OnRoundEnd(tableId, winner, loser, pot) | A round was won. winner is 'npc' for a local. |
Custom.OnMatchEnd(tableId, players, wins, reason) | The match is over. |
Custom.Notify(src, message, kind) | Sends a notification to a player. |
Need help?
Common Issues
Check the troubleshooting guide