LOTTERY SYSTEM
LOTTERY SYSTEM is a FiveM script by Risk Scripts, compatible with ESX, QBCore and QBox, available for 12.99 EUR as a one-time purchase. It idles at 0.00ms, ships with free lifetime updates and is supported 24/7 through the Risk Scripts Discord.
LOTTERY SYSTEM - features, frameworks and installation
# Risk Lottery — Lottery & Scratch Card System for FiveM
**Scratch cards your players rub free with the mouse. A draw the whole server watches.**
Risk Lottery is a FiveM lottery script for ESX, QBCore and QBox, also known as a lotto, jackpot or scratch card script. Players buy scratch cards and number tickets at a kiosk, scratch for instant prizes and wait for the scheduled draw. It works with `ox_inventory`, `qb-inventory`, `qs-inventory`, `codem-inventory` and `origen_inventory`, and it only ever uses in-game money and items.
---
## Why this one
Most scripts in this category give you a menu, a random number and a chat message. This one is built as an event your players plan their evening around.
- **The draw is a show.** Every number drops into its ball one by one on a banner at the top of the screen, for everybody online at the same moment.
- **Real scratching.** Players rub the silver foil off with the mouse. No progress bar, no "reveal" button.
- **Two products, one resource.** Instant scratch cards for the quick thrill, a scheduled lotto for the big jackpot, sold at the same kiosk.
- **You control the economy.** Every price, prize, reward chance and the jackpot frequency is one number in the config, checked on every start.
- **Nothing to script.** Kiosk NPCs, map blips, items, database tables and seven languages ship ready.
---
## The Live Draw
The feature your players will talk about. At the time you set, the draw starts for the whole server.
| Moment | What players see |
| --- | --- |
| **10 and 5 minutes before** | A ticket-style banner: "Lottery draw in 10 min" with the current jackpot |
| **Draw time** | The balls drop in one by one, a number reel spins inside each ball and locks |
| **Last ball** | Spins the longest, on purpose |
| **Result** | All winning numbers stay on screen for 7 seconds together with the jackpot |
The banner sits at the top of the screen and takes no mouse or keyboard focus, so nobody is pulled out of a chase or a conversation. Set `Broadcast = false` and only players with a ticket see it.
Draw times are a simple schedule: `daily` at 20:00, or a list of weekdays, or several draws per day. A draw the server missed while it was offline is made on the next start, so no ticket is ever lost.
---
## Scratch Cards
Three tiers ship ready, each one an inventory item with its own card art and item image.
| Card | Price | Top prize |
| --- | --- | --- |
| **Lucky Clover** | $500 | $25,000 |
| **Gold Rush** | $2,500 | $125,000 |
| **Diamond** | $10,000 | $500,000 |
Every card has six fields. Three matching symbols win. Players buy at the kiosk and scratch right there with **Buy & scratch now**, or carry the cards around and use them from the inventory anywhere on the map. That makes them a perfect gift, quest reward or shop item.
Prizes can be money (cash or bank) or any item. Each prize has a `Weight`, the blanks have a `LoseWeight`, and that is the whole math. With the default tables about one card in three wins and roughly 70% of the card price flows back to the players, so the cards quietly take money out of your economy.
> The server decides the card the moment it is opened and pays at once. The client only receives six finished symbols to scratch. There is nothing to manipulate.
---
## The Number Lottery
The classic lotto. By default players pick 5 numbers out of 30, in order, or press **Quick pick**.
- **Any format.** 1 to 10 numbers per ticket, a pool of up to 99. A 6 out of 49 is two config values.
- **The order counts.** The first drawn number has to be the first number on the ticket. Small prizes for 3 or 4 numbers at the right place are a list you extend as you like.
- **A growing jackpot.** It starts at a seed amount, a share of every sold ticket goes in (70% by default), and it rolls over until somebody wins.
- **You decide how often it falls.** `WinChance` is the chance per draw that one sold ticket hits the jackpot. It does not depend on how many players you have, so a 30 slot server gets the same excitement as a 300 slot one.
- **Fair limits.** A maximum of tickets per player and draw, and sales close 10 seconds before the draw.
- **Claim at the kiosk.** Winners collect at the kiosk, also days later and after a restart. The history shows every ticket with its matches and prize.
Tickets live in the database, not in the inventory. They cannot be dropped, duped or lost.
---
## The Kiosk
One clean panel with two tabs, Scratch cards and Lottery, in your server color.
- NPC or ground marker, with map blip, at as many places as you like
- Opens with `ox_target`, `qb-target` or the `E` key
- Live cash and bank balance, jackpot and countdown to the next draw
- Optional soft blur of the game behind the open panel
- One line changes the main color, `logo.png` puts your logo in
---
## Built for Your Other Scripts
Five server exports ship with an `EXPORTS.md`.
```lua
-- Reward a player with a scratch card from your job, quest or battle pass script
exports['risk-lottery']:GiveScratchTicket(source, 'gold', 1)
-- Gift a lotto ticket for the next draw (random numbers)
exports['risk-lottery']:GiveLotteryTicket(source, nil)
-- Show the jackpot in your phone app, HUD or loading screen
local jackpot = exports['risk-lottery']:GetJackpot()
```
`OpenKiosk` opens the panel from your own phone app or NPC, `GetNextDraw` returns the time of the next draw. The scratch cards are normal items, so they can also be sold in `ox_inventory` shops, `qb-shops` or any NPC shop.
---
## Compatibility
| | Supported |
| --- | --- |
| **Framework** | ESX · QBCore · QBox — auto-detected at runtime |
| **Inventory** | ox_inventory · qb-inventory · qs-inventory · codem-inventory · origen_inventory · framework native |
| **Target** | ox_target · qb-target · built-in `E` prompt |
| **Database** | oxmysql · mysql-async · ghmattimysql — tables created automatically |
| **Notify** | GTA notify, `risk-hudv3` or your own with one function |
| **Languages** | English · German · Spanish · French · Italian · Dutch · Portuguese |
---
## What You Get
- ✅ Scheduled number draws with a server-wide animated banner
- ✅ Announcements before every draw with the current jackpot
- ✅ Growing jackpot with seed, ticket share and rollover
- ✅ Adjustable jackpot chance per draw
- ✅ Number picker with quick pick, 1 to 10 numbers, pool up to 99
- ✅ Prize claim and ticket history at the kiosk
- ✅ 3 scratch card tiers as usable inventory items
- ✅ Free mouse scratching on a real foil layer
- ✅ Money and item prizes with weighted reward chances
- ✅ Kiosk NPCs or markers with blips, unlimited locations
- ✅ Admin commands to draw now and to set the jackpot
- ✅ Optional Discord webhook for draws and jackpot wins
- ✅ 5 server exports with documentation
- ✅ Config check on every start with clear console warnings
- ✅ Item files and images for every supported inventory
- ✅ 7 languages, every text translatable
- ✅ Exploit-safe, server-authoritative, 0.00ms idle
- ✅ Responsive from 720p to 4K and ultrawide
---
## Installation
1. Drop `risk-lottery` into your resources folder
2. Add the three scratch card items from `_items/` to your inventory and copy the item images
3. Add `ensure risk-lottery` to your `server.cfg`, after your framework and inventory
4. Set your kiosk positions, prices and draw times in `config/config.lua` and restart
Database tables are created automatically on the first start. No SQL import needed for the script itself.
**Requirements:** `oxmysql`, `mysql-async` or `ghmattimysql` · ESX, QBCore or QBox
---
## FAQ
**What is Risk Lottery?**
Risk Lottery is a FiveM lottery script for ESX, QBCore and QBox that combines three scratch card tiers with a number draw at scheduled times, a growing jackpot and an animated draw banner for the whole server.
**Does it work with my inventory?**
Yes. `ox_inventory`, `qb-inventory`, `qs-inventory` (Quasar), `codem-inventory`, `origen_inventory` and the framework native inventory are detected automatically. Item files for each one are included.
**Does it cost performance?**
No. The script runs at 0.00ms while idle. The server sleeps until the next announcement or draw, and the interface runs no animation while it is closed.
**What happens if a winner is offline during the draw?**
Nothing is lost. Every prize is saved in the database and waits at the kiosk until the player collects it, also after a server restart.
**Can players buy tickets with their own numbers?**
Yes. They pick their numbers on the grid in the order they want, or press Quick pick for random numbers. Two players can play the same numbers and share the jackpot.
**Can I change the draw time and the number format?**
Yes. The schedule takes `daily` or a list of weekdays with a time, and several draws are possible. Numbers per ticket, pool size, ticket price and limits are single config values.
**Can scratch cards give items instead of money?**
Yes. Every prize is either money on cash or bank or an item with an amount, and you set the reward chance of each prize with a weight.
**Can players spend anything other than in-game money?**
No. Cards and tickets are bought with in-game cash or bank money only, prizes are in-game money or items, and there is no way to cash anything out.
**Can I translate it or add my own language?**
Yes. Seven languages ship complete. Copy one file in `locales/`, translate it and set `Config.Locale`.
| Resource | LOTTERY SYSTEM |
|---|---|
| Frameworks | ESX, QBCore and QBox |
| Price | 12.99 EUR, one-time |
| Licensing | Open source and Escrow editions available |
| Idle performance | 0.00ms |
| Updates | Free lifetime updates |
| Support | 24/7 via the Risk Scripts Discord |
| Documentation | Risk Scripts GitBook |
- Does LOTTERY SYSTEM work with ESX, QBCore and QBox?
- LOTTERY SYSTEM is compatible with ESX, QBCore and QBox. The framework is detected at runtime, so the same download works on every supported server without a separate build.
- Is LOTTERY SYSTEM open source or Escrow?
- Risk Scripts offers LOTTERY SYSTEM as an open-source edition and as an Escrow edition. In both cases the config files, locale files and the HTML/CSS stay editable.
- How much does LOTTERY SYSTEM cost?
- LOTTERY SYSTEM costs 12.99 EUR as a one-time purchase. It is also included in the Risk Scripts VIP package, a one-time payment that covers the Escrow edition of every current and future release.
- Does LOTTERY SYSTEM affect server performance?
- LOTTERY SYSTEM idles at 0.00ms and is profiled under real server load, so it runs alongside a full resource stack without measurable frame cost.
- What support and updates are included with LOTTERY SYSTEM?
- Every Risk Scripts purchase includes free lifetime updates and 24/7 support through the Risk Scripts Discord, answered directly by the developers who wrote the code.