Installation and configuration
Install the resource
- Place
red40_lottoin your resources directory. - Add
ensure red40_lottotoserver.cfg, or ensure the enclosing resource folder. - Add the two inventory items below.
- Grant the administrator ACE permission.
- Start the resource and confirm that it creates its schema and reports ready.
- Open the
/lotto_adminpanel to initialize thumbnails for games.
ensure red40_lotto
add_ace group.admin red40_lotto.admin allowInventory items
Add the stackable instant-game voucher to ox_inventory/data/items.lua:
['scratchercard'] = {
label = 'Scratch Ticket',
weight = 5,
stack = true,
close = true,
consume = 0,
server = { export = 'red40_lotto.scratchcard' },
}Add the non-stackable draw ticket separately:
['lottoticket'] = {
label = 'Lottery Ticket',
weight = 5,
stack = false,
close = true,
consume = 0,
server = { export = 'red40_lotto.drawticket' },
}Instant vouchers stack by their game metadata. Finite vouchers also include the set ID. A revealed machine-redeemable winner receives a unique authoritative serial and does not stack with unplayed vouchers. Draw tickets are always unique and can hold up to 10 number lines; larger purchases are split into multiple items.
If you rename either item in config/server.lua, update the inventory definitions to match.
Database initialization
Database tables are created automatically upon startup
Server configuration
The most commonly adjusted values are in config/server.lua:
| Setting | Default | Effect |
|---|---|---|
item | scratchercard | Inventory item used for instant tickets and vouchers. |
drawItem | lottoticket | Inventory item used for scheduled-draw entries. |
moneyType | cash | Framework money account charged and paid. |
adminAce | red40_lotto.admin | ACE required by commands and admin callbacks. |
maxPurchaseQuantity | 99 | Maximum instant-ticket quantity in one purchase. |
maxRunSize | 10000 | Maximum finite run size and generic preview quantity. |
maxGames | 100 | Combined active instant and draw game limit. |
maxPrice | 1000000 | Maximum ticket or line price. |
maxPrize | 10000000 | Maximum instant-game prize tier. |
Draw-specific safeguards include 99 lines per purchase, pool numbers up to 99, up to 10 picks per pool, a $2,000,000,000 jackpot cap, intervals from 1 minute to 525,600 minutes, and claim windows from 1 to 365 days.
Client presentation settings live in config/client.lua, including machine render distance, the 5-degree laser rotation step, the 0.05 height step, scratch circle size.
config/shared.lua controls the resource, scheduled-draw module, state version, and locale. Changing the state version is not a supported way to migrate a database.
Ticket thumbnails
The management UI renders a 256×256 PNG when a generic game is saved or a finite run is generated. The server tries Fivemanage first and falls back to uploads/thumbnails in this resource. The stored URL becomes imageurl metadata on purchased items.
Locally hosted thumbnail images will not be visible until the resource is restarted.
Set the optional FiveManage token in server.cfg:
set red40_lotto:fivemanageApiToken "YOUR_MEDIA_API_TOKEN"The token stays server-side. Without it—or if the upload fails—the local fallback is automatic. Existing items retain their original image URL, so superseded images are intentionally not removed. Draw tickets use the resource-hosted uploads/draw-ticket.png image.
Generic games missing a media mapping are backfilled when an authorized administrator first opens the panel. Odds-only changes retain the existing thumbnail; visual changes generate a replacement.