gta6/prompts
casino
Vaultintermediatecasino

Server Lottery Draw

ESX/QBCore/QBox server-wide ticket lottery with a rolling pot, a scheduled draw and automatic winner payout.

NON-TESTÉ — the reference Lua is syntax-validated, not run in a live FiveM server. Adapt and test on your own dev server before shipping.
Est. Lua
~95 loc
Claude
Claude Opus 4.x / Sonnet 4.x
Validation
syntax-validated
Updated
2026-06-25

Description

A working server-wide lottery: players buy tickets at a kiosk that feed a rolling prize pot, and on a fixed schedule the server draws one ticket and auto-pays the entire pot to the winner. It is the steady-demand economy money-sink a roleplay server runs to drain excess cash and give every player a recurring reason to spend.

Prompt Template

You are writing a FiveM resource for esextended (stable, exports getSharedObject).

πŸ”’ Eyes-only β€” locked prompt body

The full prompt template and its reference Lua are part of a one-time pack. Pick your depth β€” both are lifetime access, no subscription, ever.

Core$49one-time
  • 60 prompts + syntax-validated reference Lua
  • Lifetime access β€” pay once
Most Popular Β· Best Value
Vault$199one-time
  • All 510 prompts β€” the full library
  • Per-prompt profit/trend intelligence (CSV + playbook)
  • Lifetime free updates β€” new niches as the market moves
Get the Vault β€” $199

$49 for 60 Β· $199 for all 510 + intelligence β€” one-time, no subscription.

Expected Output

The reference Lua lives at content/expected-outputs/casino/08-server-lottery-draw.lua. It implements a kiosk buy event that debits cash and appends per-ticket entries, a single server-side draw loop…

πŸ”’ Eyes-only β€” locked prompt body

The full prompt template and its reference Lua are part of a one-time pack. Pick your depth β€” both are lifetime access, no subscription, ever.

Core$49one-time
  • 60 prompts + syntax-validated reference Lua
  • Lifetime access β€” pay once
Most Popular Β· Best Value
Vault$199one-time
  • All 510 prompts β€” the full library
  • Per-prompt profit/trend intelligence (CSV + playbook)
  • Lifetime free updates β€” new niches as the market moves
Get the Vault β€” $199

$49 for 60 Β· $199 for all 510 + intelligence β€” one-time, no subscription.

Known Failure Modes & Corrective Prompt

  • Client-held pot β€” Claude tracks pot and entries on the client; the draw can be forged. Keep pot, entries, the timer and payout server-side, broadcasting state to -1.
  • Per-client draw timer β€” a draw loop in a client CreateThread makes every player resolve their own winner; the schedule must be a single server loop.
  • One-sided net event β€” defining lottery:potUpdate/drawResult on only one side breaks the HUD; both sides need RegisterNetEvent + AddEventHandler.

Corrective re-prompt: The lottery currently tracks the pot and runs the draw on the client. Move pot, the entries list, the draw timestamp and the payout entirely into server.lua, run one CreateThread that fires the draw on os.time(), and have the client only render lottery:potUpdate / lottery:drawResult.

Framework Integration

  • ESX: ESX.GetPlayerFromId(src) for buyers and ESX.GetPlayerFromIdentifier(winnerId) to resolve the winner; addMoney/removeMoney for cash.
  • QBCore: QBCore.Functions.GetPlayer(src) and QBCore.Functions.GetPlayerByCitizenId(id) for the winner; Player.Functions.AddMoney('bank', pot).
  • QBox: exports.qbx_core:GetPlayer(src) / GetPlayerByCitizenId(id) with the qbx money exports for the pot payout.

Profit Potential

$150–$2000/mo on Tebex (expected ~$500). [INFERRED] priced inside the $50-389 FiveM script band against a stable economy-sink niche; corpus median seller $11.85K/mo (signal-scraper tebex_snapshot n=100).

Trend Signal

β†’ stable β€” inferred: Domain: economy money-sink with steady server demand.

Sales Angle

Position as the always-on economy money-sink that keeps the server's cash supply in check β€” a scheduled, server-authoritative lottery with an auto-paying pot. Recommended Tebex price $89.

Difficulty & Ship Time

intermediate Β· ships in 1 day.