The Two Sides#
Chess has a side for players and a side for admins, and it helps to know which is which from the start:
Who | Opened with | What it is for |
|---|---|---|
Players |
| Choosing a mode, an opponent, a difficulty or a bet — then playing. |
Admins |
| Placing, naming, pricing, moving and deleting tables, and teleporting to them. |
Three Ways to Add a Table#
A table is playable the moment the server knows about it, and there are three ways to tell it:
Way | Kept in | Entry fee | Best for |
|---|---|---|---|
The creator | The database | Yes — per table, cash or bank | Most tables. Placed in game in seconds, changed at any time. |
|
| Free | Fixed tables that travel with your server files. |
A map | Your YMAP or MLO | Free, unless given one in the creator | Arcades, parks and cafés built in a map editor. |
Creator and config tables spawn the table and both chairs themselves, for every player within 45 m. Map tables use the map's own props: with Config.AutoDetect on, any table_chess a player walks near is picked up and made playable — Integrations covers building one into a map.
-- config/config.lua
Config.Tables = {
{ coords = vec3(-1372.65, -472.27, 71.56), heading = 99.2 },
{ coords = vec3(-1380.10, -468.90, 71.56), heading = 99.2 },
}You never have to measure one by hand: every table saved in the creator also prints its Config.Tables line in the F8 console, ready to paste.
Config and map tables show up in the creator's list too, as Table # followed by their id. Editing one and saving gives it a name and an entry fee and stores it in the database — which is how a table that came from a map gets a price. Deleting one does not stick: the prop or the config line is still there, so it is registered again.
Placing a Table#
/chesscreator opens the creator. The left panel lists every table the server knows, sorted by name, with its fee and a search box that matches a name or an id. Press + for a new one and fill in the form on the right:
Section | What you set there |
|---|---|
Information | The table's name. Required — it is how you find the table in the list. |
Price | The entry fee each player pays to start a game, and whether it comes from Cash or the Bank. |
Placement | Place puts you in placement mode. Once placed, the card shows X, Y, Z and the heading, and the button becomes Reposition. |
Placement mode#
The creator closes and a see-through table follows whatever you look at, up to 50 m away, with a red line from you to it. You can walk around while placing, and the keys are shown at the bottom right of the screen:
Key | Does |
|---|---|
| Aim. The table stands on the surface you look at. |
| Rotate the table, smoothly, while held. |
| Raise or lower it in 5 cm steps, for a floor the aim does not land on cleanly. |
| Confirm the position. |
| Cancel and go back to the creator. |
Back in the creator, Save table lights up once the table has a name and a position. Saving stores it and spawns it, with both chairs, for every player nearby.
Managing tables#
Click a table in the list to edit it: rename it, change its fee or how it is paid, or press Reposition to move it, then Save changes. The pin beside each table teleports you on top of it after a confirmation, which is the quickest way to visit tables spread around the map.
Delete asks once, then removes the table from the world and the database. A match being played there ends at once: bets are refunded as for a draw, entry fees are not.
Starting a Game#
Walk up to a free table and [E] - Play Chess appears over the board. A table that is already in use shows no prompt. Press E and choose a mode:
Mode | What happens next |
|---|---|
Player vs Player | A list of the players near the table, then the bet, then the challenge. |
Player vs AI | The difficulty, then the game starts straight away. |
Against the AI#
Pick Easy, Medium (preselected) or Hard and press Start. The table's entry fee is taken, you sit on the white side and move first, and a ped sits down in the black chair to play against you. There is no betting against the AI.
Against a player#
Pick an opponent
The list shows every player within 15 m of the table, nearest first, with their name, server id and distance. With ESX or QBCore the name is the character's; standalone, it is the FiveM name.
Set the bet
Drag the slider from No bet up to the server's maximum; the card underneath shows what the winner takes. The slider is hidden when betting is turned off. Press Send challenge.
Wait for the answer
The other player sees your name and the bet, with Accept and Decline. They have 30 seconds; after that the challenge expires and you are told so.
When it is accepted, both players pay the entry fee and the stake, and both sit down: whoever challenged plays white, whoever accepted plays black. A challenge is refused with a message when the other player is already playing or has an invitation waiting, when you already have a challenge out, when somebody else started a game at that table first, or when either player cannot cover the fee or the stake.
Playing a Match#
Both players fade in on their chairs and the camera drops over the board from their own side. The game's HUD and minimap are hidden, and a scoreboard sits at the top of the screen:
Where | What it shows |
|---|---|
Left — You | The material you have captured: a pawn is 1, a knight or bishop 3, a rook 5, a queen 9. The card takes your colour and glows on your turn. |
Centre | The turn clock and whose turn it is — YOUR TURN or OPPONENT. It turns amber and pulses in the last 30 seconds. |
Right — Opponent | The material your opponent has captured. Both cards pulse on a capture. |
To move, click and hold one of your pieces. It lifts off the board and follows the mouse, and every square lights up:
Colour | Means |
|---|---|
Green | A legal square. |
Blue | A capture. |
Red | Not allowed. |
Yellow | The square the piece came from. |
Let go over a green or blue square to play the move. Let go anywhere else, or right-click, and the piece goes back. The server checks every move; if it refuses one, the piece returns with an error sound. The mouse wheel zooms in and out. Push-to-talk, the chat and the pause menu keep working — everything else is locked while you play.
Pieces slide to their squares, knights hop, and captured pieces are set down in rows beside the board. A pawn that reaches the last rank becomes a queen, model and all. The colours of the grid are Config.Grid, the camera is Config.Camera.
The Rules#
The rules are enforced by the server, so a move that is not legal cannot be played whatever a client sends.
Rule | How it plays |
|---|---|
Castling | Both sides, when neither the king nor that rook has moved, the squares between them are empty, and the king is not in check and does not pass through an attacked square. Drag the king two squares; the rook follows. |
En passant | Available on the move right after a pawn advances two squares past yours. |
Promotion | Automatic, to a queen. |
Check and checkmate | Check! is announced to the player in check, and only moves that get out of it are legal. Checkmate ends the game. |
Stalemate | No legal move and not in check: a draw. |
Fifty-move rule | Fifty moves by each side with no capture and no pawn move: a draw, declared on its own. |
Insufficient material | King against king, or a king with a single knight or bishop left on the board: a draw, declared on its own. |
Turn clock | Each move has |
Repetition is not detected. Two players who keep repeating the same moves agree a draw with
/chessdrawinstead.
Ending a Match#
How it ends | Result |
|---|---|
Checkmate | The side that delivered it wins. |
Resigning |
|
Running out of time | The opponent wins. |
An agreed draw | Player vs player only. One player types |
Stalemate, fifty moves, insufficient material | A draw. |
Leaving the seat | Ending up more than 3 m from the chair, or dying, counts as resigning. |
Disconnecting | Against a player, the one who stayed wins. Against the AI, the game simply ends. |
Either way, both players stand up beside their chairs, the camera returns, and a banner — YOU WIN!, YOU LOSE, CHECKMATE or DRAW! — stays on screen for four seconds. The table is free again straight away.
Entry Fees and Bets#
Two different amounts can change hands at a table, and they work differently:
Entry fee | Bet | |
|---|---|---|
Set by | An admin, per table, in the creator. | The challenger, on the slider. |
Applies to | Both modes. | Player vs player only. |
Paid by | Every player, when the game starts. | Both players, the same stake, when the challenge is accepted. |
Paid in | The table's own choice: cash or bank. |
|
Goes to | Nobody — it leaves the economy. Never refunded. | The winner takes both stakes. A draw refunds each. |
Checkmate, resigning, running out of time, leaving the seat and disconnecting all pay the pot to the winner. Every kind of draw — and a table deleted mid-match — hands each stake back. The largest bet and the slider step are Config.Betting.max and Config.Betting.step, and the server rounds any stake it receives to them.
The AI#
The AI runs on the server and searches a few moves ahead, then waits a random 0.7 to 1.8 seconds before playing, so it feels like an opponent rather than an instant reply. Each difficulty is four numbers in Config.AI.levels:
Config.AI = {
thinkMinMs = 700, -- the pretend thinking time
thinkMaxMs = 1800,
levels = {
easy = { depth = 1, qdepth = 2, noise = 120, nodeCap = 4000 },
medium = { depth = 2, qdepth = 4, noise = 25, nodeCap = 15000 },
hard = { depth = 3, qdepth = 6, noise = 0, nodeCap = 60000 },
},
}Field | Means |
|---|---|
| How many moves ahead it looks. |
| How far it keeps following a chain of captures past that, so it does not walk into an obvious recapture. |
| Random blunders. A pawn is worth 100, so 120 makes Easy throw away a pawn's worth now and then; 0 plays its best move every time. |
| The most positions it may examine for one move — its budget. Higher is stronger and costs more server time. |
The ped across the table is picked at random from Config.AI.pedModels for each game, by the server, so everybody watching sees the same one.
Spectators#
Anybody within 45 m of a table (Config.SpectateDistance) watches the match: the pieces move, captures are set aside and the AI ped sits in its chair, for everyone at the same moment. A player who arrives halfway through sees the current position, not the starting one. Only the two players get the camera, the cursor and the scoreboard.
Calibrating a Custom Table#
The shipped table and chair are already calibrated. This is only needed when you replace them with your own models in Config.Models, and the board, the knights, the chairs or the seated players no longer line up. Four tools do it visually, in game:
Command | Calibrates | Writes |
|---|---|---|
| Where the board is on the table, its height and the size of a square. A checkerboard is drawn over it so you can see the fit. |
|
| Which way the white and black knights face, and centring them on their squares. |
|
| How far the chairs stand from the table, their rotation and height. |
|
| Where a seated player ends up, with two test peds sitting at the table. |
|
Turn the tools on
Set
Config.Debug = trueand restart the resource. The commands exist only while it is on, and they need the same permission as the creator and a table within 10 m.Work from the board outwards
Board first, then knights, then chairs, then the seated peds — each one builds on the last. You are frozen in place while a tool is open,
Gcycles through six camera angles andAltmakes every step five times finer. The keys of each tool are in Commands and Controls.Copy the values
Entercopies the block to your clipboard and prints it in F8;Backspacecloses the tool and prints it too. It comes out ready to paste:lua Config.Board = { offsetX = -0.0004, offsetY = -0.0114, zOffset = 0.1563, squareSize = 0.0460, gridLift = 0.0025, }Save and turn them off
Paste the values into
config/config.lua, setConfig.Debug = falseand restart. What you change in a tool lives only in your own game until it is written to the file.



