> For the complete documentation index, see [llms.txt](https://energy-fivem.gitbook.io/energy-mlos/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://energy-fivem.gitbook.io/energy-mlos/scripts/energy-games.md).

# Energy Games

<figure><img src="https://3165241027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9c0Pe86hIb7L19e6P9Dk%2Fuploads%2FxlR4b7tyvivmU7BUM8AZ%2Farcade-games-thumbnail-2k.jpg?alt=media&amp;token=a45dccd4-12ef-44e3-98bb-063cdc0dd5ca" alt=""><figcaption></figcaption></figure>

**Energy Games** is a pack of 17 minigames for FiveM. Every table, machine and lane is placed **in-game** by an admin with `/eg_criador` and saved in the database. Players walk up, press the key and play: alone, against a friend, against the computer or for money.

## Games

| Game                                             | What it is                                                      |
| ------------------------------------------------ | --------------------------------------------------------------- |
| Pool                                             | 8-ball and 9-ball, our own table in 12 colors or the GTA tables |
| Darts                                            | 501 on the dartboard, double out per board                      |
| Air Hockey                                       | Arcade table, 1v1                                               |
| Poker                                            | Three Card Poker, up to 4 players against the dealer            |
| Penalty Kick                                     | Official goal with a 5-hole tarp, 1v1                           |
| Axe Throwing, Cornhole, Ring Toss, Can Knockdown | The toss family, 1v1                                            |
| Arm Wrestling                                    | High table, 1v1 or against the computer                         |
| Tug of War                                       | 2 vs 2 field                                                    |
| Ping Pong                                        | Official table, 1v1                                             |
| Strength Hammer and Punching Bag                 | Arcade strength machines, 1v1 or practice                       |
| Arcade Basketball                                | Basketball machine, 1v1 or practice                             |
| Whack-a-Mole                                     | Arcade machine, 1v1 or practice                                 |
| Light Reflex                                     | Arcade reaction machine, 1v1 or practice                        |
| Foosball                                         | 4 colors, 1v1                                                   |
| Mini Golf                                        | Course of up to 9 holes, up to 4 players                        |
| Bowling                                          | Full lanes with screens, up to 6 players                        |
| Claw Machine                                     | The arcade claw; the plush prize goes to the inventory          |

## Highlights

* 🛠️ **In-game creator** (`/eg_criador`): place, move, edit and delete tables and machines with a ghost preview; per-table options (colors, rules, bet limits, prizes).
* 💰 **Bets with escrow**: the money is held by the server during the match and paid to the winner; refunds if a match breaks.
* 🌍 **16 languages**: pt-br, en, es, fr, de, it, nl, pl, cs, hu, ro, ru, tr, th, zh-cn, ar.
* 🧩 **Multi-framework**, auto-detected: Qbox, QBCore, ESX, ox\_core, ND\_Core, vRP / vRPex / Creative and standalone.
* ⌨️ **Rebindable keys**: every key is a FiveM key mapping (Settings > Key Bindings > FiveM).
* ⚡ **Optimized**: games far from the player sleep; nothing runs per frame unless you are playing or close to a game.

## Installation

1. Requirements: **OneSync** and **oxmysql** (the creator saves the places in the database).
2. Put `energy_games_arena` (the map), `energy_games_assets` and `energy_games` in your resources folder.
3. In `server.cfg`, the map and the assets first:

```
ensure oxmysql
ensure energy_games_arena
ensure energy_games_assets
ensure energy_games
```

4. Give your admins the ACE permission (any framework):

```
add_ace group.admin energy_games.admin allow
```

5. Join the server. With the `energy_games_arena` map running, every game of the arena is placed by itself on the first start; admins can still move, edit or delete any of them, or add more games anywhere, with `/eg_criador`.

{% hint style="warning" %}
After an update that adds or renames files, run `refresh` in the server console before `restart energy_games_assets` and `restart energy_games`.
{% endhint %}

## Arena location

The `energy_games_arena` map is a corner building in **Rockford Hills**, with games on the ground floor and in the basement.

* **Entrance:** `vector3(-1297.1, -319.1, 35.7)`

Make sure no other map of your server uses this building.

## Configuration

Everything the server owner can change is in `energy_games/config/config.lua` (open, not encrypted):

| Option                               | What it does                                                                                                         |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
| `Config.Language`                    | Language of every screen and message (`'en'`, `'pt-br'`, `'es'`...)                                                  |
| `Config.Currency`                    | Money symbol shown on the screens (`'$'`, `'R$'`, `'€'`...)                                                          |
| `Config.Framework`                   | `'auto'` or force one: `qbox`, `qbcore`, `esx`, `ox`, `nd`, `vrp`, `creative`, `standalone`                          |
| `Config.AdminPermission`             | Who can use `/eg_criador` (see below)                                                                                |
| `Config.Money.Source`                | `'wallet'` (cash only) or `'wallet+bank'`                                                                            |
| `Config.UiName`                      | Name of your arena on the screens, the machines, the pool table and the key bindings (see below)                     |
| `Config.UiScale` / `Config.UiAccent` | Size and highlight color of the screens                                                                              |
| `Config.Creator`                     | Command name, limits and the keys used while placing                                                                 |
| `Config.Games.<game>`                | `Enabled` and the default keys of each game. Bets, rules, times and points are set in-game: `/eg_criador` > Settings |
| `Config.Debug`                       | Console logs and test commands; keep `false` in production                                                           |

### Arena name

```lua
Config.UiName = 'ENERGY GAMES'
```

The name of your arena, up to 32 characters. It is shown on top of every menu, on the machine and bowling lane screens, on the logo printed on the pool table cloth and in Settings > Key Bindings > FiveM. The last word gets the highlight color (`Config.UiAccent`). With the default name the pool table keeps its printed logo; with any other name the logo is drawn with your name. Leave it empty to use the default.

### Admin permission

ACE works on every framework. Each framework also checks its own groups or permissions (a text or a list):

```lua
Config.AdminPermission = {
    ace = 'energy_games.admin',
    vrp = 'admin.permissao',            -- vRP / vRPex / Creative permission
    esx = { 'admin', 'superadmin' },    -- ESX groups
    qbcore = { 'admin', 'god' },        -- QBCore permissions
    qbox = { 'admin' },                 -- Qbox permissions
}
```

## Creator

* `/eg_criador` opens the creator (admins only).
* Pick a game, a model and its options, then place the ghost in the world. The keys are shown on screen while placing and can be changed in `Config.Creator.Keys`.
* Placed games appear for every player right away and stay after a restart. GTA map tables can be edited or turned off too.

## Claw machine: plush items

The claw machine gives one of 6 plushes as an **inventory item**: `eg_plush_01` … `eg_plush_06` (Humpy, Muffy, Saki, Poopy, Smokey, Grindy).

| Server                 | Items                   | What you do                                           |
| ---------------------- | ----------------------- | ----------------------------------------------------- |
| QBCore (qb-inventory)  | automatic               | copy the images                                       |
| ESX                    | automatic (items table) | restart once after the 1st match; copy the images     |
| ox\_inventory          | manual                  | paste `install/ox_inventory/items.lua` and the images |
| qs-inventory           | manual                  | paste `install/qs-inventory/items.lua` and the images |
| vRP / vRPex / Creative | automatic or manual     | see `install/vrp/items.lua`                           |
| Standalone             | not needed              | prizes stay in the energy\_games collection           |

All blocks and images are in `energy_games/install/` (see `install/README.txt`). A full inventory never loses the prize: it is delivered the next time the player gets close to a claw machine. Other scripts can listen to the server event `energy_games:claw:prize` `(src, item, label)`.

## FAQ

<details>

<summary>/eg_criador says I have no permission</summary>

Add the ACE line above to `server.cfg`, or put your group in `Config.AdminPermission` for your framework.

</details>

<details>

<summary>Props are invisible or the creator shows no models</summary>

Make sure `energy_games_assets` starts **before** `energy_games`, then run `refresh` and restart both.

</details>

<details>

<summary>The arena games were not placed by themselves</summary>

The arena is placed only when the `energy_games_arena` map is running. Start it before `energy_games` and restart `energy_games`.

</details>

<details>

<summary>Bets do not charge money</summary>

Check the console line `[energy_games] framework: ...`. On `standalone` there is no money, so games are free.

</details>

{% hint style="info" %}
Need help? Join our Discord: [discord.gg/f5WX6fqcKw](https://discord.gg/f5WX6fqcKw). The resource is licensed per customer: do not share or resell it.
{% endhint %}
