# Configuration

#### General

```lua
Config.DevMode = true
```

When `true`, enables debug console output and fires the daily draw **immediately** on resource start instead of waiting for the scheduled time. Also enables the test ticket command. **Set to `false` on a live server.**

***

```lua
Config.Locale = 'en'
```

The language used for all NUI text and in-game messages. Available values: `'en'` (English), `'pl'` (Polish). To add your own language, create a new file in the `locales/` folder using `en.lua` as a template and set this to your locale key.

***

#### Lottery Mechanics

```lua
Config.RemoveNumber = false
```

When `true`, **all existing tickets are deleted from the database** every time the resource restarts. Useful during development to keep the pool clean. Set to `false` on a live server so players keep their tickets across restarts.

***

```lua
Config.UseDoubleDigits = true
```

Controls the number pool used when generating ticket numbers.

| Value   | Number Range | Max Combinations |
| ------- | ------------ | ---------------- |
| `true`  | 1 – 39       | 9,139            |
| `false` | 1 – 9        | 84               |

Using `true` is recommended for live servers — a smaller pool means players win far more frequently, which may not be desirable.

***

```lua
Config.TicketJackpotValue = 100
```

The amount in dollars added to the jackpot **each time a player purchases a ticket**. This is how the jackpot grows between draws. If 50 tickets are sold, the jackpot grows by `50 × 100 = $5,000` above the starting value.

***

```lua
Config.StartingJackpot = 5000
```

The jackpot value the lottery **resets to after a winner is drawn**, and the seed value used on a fresh install. Set to `0` if you want the jackpot to build entirely from ticket sales each round.

***

```lua
Config.MaxTicketsPerPerson = 15
```

The maximum number of tickets a single player can hold at one time. Enforced server-side with a database check before every purchase — players cannot bypass this through the client.

***

#### Draw Schedule

***

```lua
Config.DrawInterval = 1
```

How often the draw runs, in **hours**. This controls two different scheduling modes:

| Value            | Behaviour                                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------- |
| `24`             | Runs once daily at the exact time set by `DrawHour` and `DrawMinute`                        |
| Any other number | Repeats every N hours, aligned to midnight (e.g. `6` = draws at 00:00, 06:00, 12:00, 18:00) |

***

```lua
Config.DrawHour   = 15
Config.DrawMinute = 0
```

**Only used when `DrawInterval = 24`.** The time of day the daily draw fires, in 24-hour format. The example above fires at **3:00 PM**. These values are ignored for any other interval.

***

#### Economy

```lua
Config.TicketPrice = 100
```

The amount in dollars **charged to the player's bank account** when purchasing a ticket. Set to `0` to make tickets free. The charge is deducted from the player's bank balance — if they cannot afford it, the purchase is blocked and their money is not touched.

***

```lua
Config.AccountType = 'bank'
```

The money account used when paying out prizes automatically (`PrizeDelivery = 'auto'`). Set to `'bank'` to deposit winnings into the player's bank account, or `'cash'` to pay as on-hand cash.

> **Note:** When `PrizeDelivery = 'pickup'`, the player chooses between bank and cash at the collection point — this setting does not apply.

***

```lua
Config.RolloverTicketValue = true
```

When `true`, after a winner is declared the script counts all tickets sold during the finished round and adds `ticketCount × TicketJackpotValue` on top of `StartingJackpot` as the opening prize pool for the next round. This means busier rounds naturally seed a larger starting jackpot for the following draw.

**Example:** 30 tickets sold at `TicketJackpotValue = 100` → $3,000 bonus. If `StartingJackpot = 5000`, the next round opens at **$8,000** instead of the flat $5,000.

Set to `false` to always reset to the flat `StartingJackpot` value regardless of how many tickets were sold.

***

```lua
Config.RolloverOnNoWinner = true
```

Only applies when `Config.RolloverTicketValue = true`. Controls whether the `ticketCount × TicketJackpotValue` bonus is also applied to rounds where **no winner is found**.

| Value   | Behaviour                                                                                                                                                                               |
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `true`  | Bonus is added every draw — both when a winner is found and when the jackpot rolls over with no winner. The prize pool keeps growing from both the natural rollover and ticket activity |
| `false` | Bonus only applies after a winner draw, when the jackpot resets to `StartingJackpot`. No-winner rounds roll over the existing jackpot as-is without the ticket bonus                    |

***

#### Admin Panel

```lua
Config.AdminMenuByCommand = true
```

When `true`, the admin panel is opened by typing the command defined in `AdminCommand` in chat. The player must have the `lottery.admin` ace permission.

***

```lua
Config.AdminCommand = 'lottoadmin'
```

The chat command that opens the admin panel. Only active when `AdminMenuByCommand = true`. Change this to any command name you prefer.

***

```lua
Config.TestLotteryTicketCommand = 'testLotteryTicket'
```

A debug command that instantly purchases a ticket without going through a shop marker or item. **Only works when `DevMode = true`.** This is for development only — remove or ignore in production.

***

#### Notifications

```lua
Config.Notification = 'auto'
```

The notification system used for in-game alerts such as insufficient funds, prize collected, and maximum ticket limit.

| Value          | Description                                                                              |
| -------------- | ---------------------------------------------------------------------------------------- |
| `'auto'`       | Automatically detects the first running resource from: `qb-core`, `esx_notify`, `ox_lib` |
| `'qb-core'`    | Forces QBCore notifications                                                              |
| `'esx_notify'` | Forces ESX notifications                                                                 |
| `'ox_lib'`     | Forces ox\_lib notifications                                                             |
| `'custom'`     | Calls your own handler defined in `SendNotification()` in the notifications file         |

***

```lua
Config.DrawingNotification = 'ui'
```

How draw results are announced to all players when a draw completes.

| Value      | Description                                          |
| ---------- | ---------------------------------------------------- |
| `'ui'`     | The top-right NUI broadcast card only                |
| `'chat'`   | Styled HTML chat message only                        |
| `'both'`   | NUI card + chat message simultaneously               |
| `'custom'` | Implement your own handler in the net event handlers |

***

#### Ticket Interaction

```lua
Config.TicketLotteryType = 'point'
```

How players purchase a lottery ticket.

| Value      | Description                                                                                            |
| ---------- | ------------------------------------------------------------------------------------------------------ |
| `'point'`  | Player walks up to a shop marker and presses E (or interacts via target)                               |
| `'item'`   | Player uses a `lotteryticket` item from their inventory                                                |
| `'custom'` | Implement your own purchase trigger — the script fires `s0u_lottery:client:useTicket` when you call it |

If you are using a custom `Config.TicketLotteryType` this is the client event name to trigger if you want to open the price delivery menu

```lua
TriggerEvent('s0u_lottery:client:buyLotteryTicket')
```

> When using `'item'` mode, you must also register the item in your inventory system. See Inventory Setup.

***

#### Prize Delivery

```lua
Config.PrizeDelivery = 'pickup'
```

How jackpot winnings are delivered to the winner after a draw.

| Value      | Description                                                                                                                                               |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `'auto'`   | Prize transferred immediately if online, or automatically on next login if offline. Account type determined by `Config.AccountType`                       |
| `'pickup'` | Prize saved to the database. Player must visit a Prize Pickup Point and choose bank transfer or cash. Supports multiple uncollected prizes simultaneously |

If you are using a custom `Config.TicketLotteryType` this is the client event name to trigger if you want to open the price delivery menu

```lua
TriggerEvent('s0u_lottery:client:openPricePanel')
```

> **Recommended:** `'pickup'` provides a more immersive RP experience and lets players choose their preferred collection method.

***

#### Markers & Targets

```lua
Config.MarkerType = 'marker'
```

Controls how shop and pickup point interaction zones are displayed and triggered.

| Value         | Description                                                                   |
| ------------- | ----------------------------------------------------------------------------- |
| `'marker'`    | Standard GTA V 3D marker drawn on the ground with a proximity key prompt      |
| `'ox_target'` | Uses `ox_target` — no marker, players look at the zone to interact            |
| `'qb-target'` | Uses `qb-target` for interaction                                              |
| `'auto'`      | Detects the first running target resource. Falls back to marker if none found |
| `'custom'`    | Implement your own interaction in `AddCustomInteraction()`                    |

***

```lua
Config.MarkerSettings = {
    ['prizePickupPoint'] = { ... },
    ['lotteryShops']     = { ... },
}
```

Fine-grained appearance settings for each marker type. Two separate entries — one for prize pickup points and one for lottery shops — so they can have different colours, sizes, and interaction distances.

| Field                       | Type      | Description                                                                                                                                                     |
| --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sprite`                    | `number`  | GTA V marker type ID. `27` = spinning cylinder. See the [FiveM marker docs](https://docs.fivem.net/docs/game-references/markers/) for all types                 |
| `sizeX` / `sizeY` / `sizeZ` | `number`  | Marker dimensions in metres                                                                                                                                     |
| `red` / `green` / `blue`    | `number`  | Marker colour, each channel 0–255                                                                                                                               |
| `alpha`                     | `number`  | Marker transparency — `0` = invisible, `255` = fully opaque                                                                                                     |
| `rotation`                  | `boolean` | When `true`, the marker slowly rotates                                                                                                                          |
| `interactionDist`           | `number`  | Distance in metres at which the key prompt appears and the key is detected                                                                                      |
| `interactionKey`            | `number`  | FiveM control index for the interaction key. `38` = E. See the [FiveM controls reference](https://docs.fivem.net/docs/game-references/controls/) for other keys |

***

```lua
Config.TargetSettings = {
    size     = vec3(2, 2, 2),
    rotation = 45.0,
    debug    = false,
    distance = 3.0,
}
```

Used only when `MarkerType` is `'ox_target'` or `'qb-target'`.

| Field      | Type      | Description                                                                                                   |
| ---------- | --------- | ------------------------------------------------------------------------------------------------------------- |
| `size`     | `vec3`    | Dimensions of the target box zone in metres                                                                   |
| `rotation` | `number`  | Rotation of the target zone in degrees                                                                        |
| `debug`    | `boolean` | When `true`, draws the target box in-game so you can visually verify its position. **Turn off in production** |
| `distance` | `number`  | Maximum distance in metres at which the target option appears                                                 |

***

#### Discord Webhooks

```lua
Config.DiscordWebhook = 'https://discord.com/api/webhooks/...'
```

Webhook URL for **public draw announcements** — fires when a winner is found and when the jackpot rolls over. Post this to a channel your players can see for maximum engagement.

***

```lua
Config.AntiCheatWebhook = 'https://discord.com/api/webhooks/...'
```

Webhook URL for **security alerts** — fires when a player submits a forged or expired purchase token, which may indicate an attempt to bypass server-side validation. Post this to a private admin-only channel. If left empty, falls back to `DiscordWebhook`.

***

#### Shop & Pickup Locations

```lua
Config.LotteryShops = {
    {
        name = 'Downtown Lottery',
        x    = -46.83,
        y    = -1756.02,
        z    = 28.47,
    },
    -- add as many as you like
}
```

World positions where players can **purchase tickets** (used when `TicketLotteryType = 'point'` or with target interaction). The `name` field appears in the admin panel's **Shop** column on each ticket row and as the shop name on the ticket itself.

***

```lua
Config.PrizePickupPoints = {
    {
        name = 'SA Lottery Office — Downtown',
        x    = -212.74,
        y    = -728.34,
        z    = 32.57,
    },
    -- add as many as you like
}
```

World positions where players **collect winnings** (used when `PrizeDelivery = 'pickup'`). Players interact with this point to open the Prize Collection panel, where they can view all pending prizes and choose bank or cash for each. Consider placing these at an official-looking location — a government building or bank — to reinforce the lore.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://s0u-scripts.gitbook.io/s0u-scripts-docs/lottery-script/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
