> For the complete documentation index, see [llms.txt](https://shift-studios.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shift-studios.gitbook.io/docs/new/editor-34.md). Agents can also search and read this documentation through its [MCP server](https://shift-studios.gitbook.io/docs/~gitbook/mcp).

# Advanced Lottery

Transform Your Server With Shift Studios — Powerful, Optimized, And Reliable Resources Built To Improve Every Experience.

<figure><img src="https://4062160621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fgqh3gjuJzDAWNXTD9sEE%2Fuploads%2FasPH5JBped4Ox5CMgTEo%2F604b5dbc-8704-4941-bc4e-19b528514dcc.png?alt=media&amp;token=be8c6be7-3560-4a40-903a-9363d310b033" alt=""><figcaption></figcaption></figure>

### Installation

{% stepper %}
{% step %}

### Advanced Lottery

Read Everything Below To Install
{% endstep %}

{% step %}

### Drag & Drop

Drag & Drop The Resource Into Your FiveM Server
{% endstep %}

{% step %}

### Ensure The Resource

Make Sure To Ensure shift-lottery In Your Server CFG.
{% endstep %}

{% step %}

### Install The Items & Images

```
Images Are Located Inside The Install Folder
```

{% code expandable="true" %}

```lua
['shift_lottery_card'] = {
    label = 'Shift Lottery Card',
    weight = 1,
    stack = false,
    close = true,
    consume = 0,
    description = 'Scratch the card, then return to a lottery stand to check your luck.',
    client = {
        export = 'shift-lottery.useLotteryCard'
    }
},
```

{% endcode %}
{% endstep %}

{% step %}

### Configure Resource

Make Sure To Configure The Resource To Your Liking

You Can Configure Your Discord Logs In server/config.discord.lua

{% code expandable="true" %}

```lua
-- ⚫ ███████╗██╗  ██╗██╗███████╗████████╗    ███████╗████████╗██╗   ██╗██████╗ ██╗ ██████╗ ███████╗ ⚫
-- ⬛ ██╔════╝██║  ██║██║██╔════╝╚══██╔══╝    ██╔════╝╚══██╔══╝██║   ██║██╔══██╗██║██╔═══██╗██╔════╝ ⬛
-- ⚫ ███████╗███████║██║█████╗     ██║       ███████╗   ██║   ██║   ██║██║  ██║██║██║   ██║███████╗ ⚫
-- ⬛ ╚════██║██╔══██║██║██╔══╝     ██║       ╚════██║   ██║   ██║   ██║██║  ██║██║██║   ██║╚════██║ ⬛
-- ⚫ ███████║██║  ██║██║██║        ██║       ███████║   ██║   ╚██████╔╝██████╔╝██║╚██████╔╝███████║ ⚫
-- ⬛ ╚══════╝╚═╝  ╚═╝╚═╝╚═╝        ╚═╝       ╚══════╝   ╚═╝    ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝ ⬛

Config = {}

Config.Debug = false

-- "auto" uses the first supported resource it detects.
Config.Framework = 'auto' -- auto | qbx | qb | esx | standalone | custom
Config.Inventory = 'auto' -- auto | ox | qb | ps | qs | lj | origen | standalone | custom
Config.Target = 'auto' -- auto | ox | qb | qtarget | none | custom
Config.Notification = 'auto' -- auto | custom | ox | qbx | qb | esx | okok | wasabi | mythic
Config.TextUI = 'auto' -- auto | custom | ox | qb | esx | none
Config.Progress = 'custom' -- custom | ox | qb | custom_bridge

Config.PaymentAccount = 'cash'
Config.PayoutAccount = 'cash'

Config.EnableTextUIFallback = true
Config.InteractControl = 38 -- E
Config.InteractText = '[E] Advanced Lottery'
Config.TextUIPosition = 'right-center'

Config.AllowInVehicle = false
Config.TargetDistance = 2.0
Config.TargetIcon = 'fa-solid fa-ticket'
Config.TargetLabel = 'Advanced Lottery'
Config.LotteryProps = {
    `v_ret_247_lotterysign`,
    `v_ret_247_lottery`
}

-- Static map props do not always exist in the server entity pool.
-- Enable this only if you add every stand coordinate below.
Config.StrictStandValidation = false
Config.ServerStandValidationDistance = 4.0
Config.StandLocations = {
    -- vec3(24.47, -1347.32, 29.50),
}

Config.UI = {
    brandName = 'Advanced Lottery',
    brandDescription = 'Purchase, Check, And Review Your Lottery Tickets.',
    defaultTheme = 'dark', -- dark | light
    resultsPerPage = 5,
    turnCardsPerPage = 3,
    powerBallTicketsPerPage = 4,
    megaMillionsTicketsPerPage = 4
}

-- ============================================================
-- Scratches
-- ============================================================
Config.ItemName = 'shift_lottery_card'
Config.ItemLabel = 'Lottery Scratch Card'
Config.CardPrice = 250
Config.MaxPurchaseQuantity = 10

Config.Scratch = {
    sections = 9,
    minNumber = 1,
    maxNumber = 99,
    clearPercent = 0.50,
    minimumDuration = 2000,
    completionText = 'Return To The Lottery Stand To Check Your Luck.'
}

Config.Check = {
    duration = 5000,
    label = 'Checking Lottery Card',
    canCancel = false,
    disableMovement = true,
    animation = {
        enabled = true,
        dict = 'missheistdockssetup1clipboard@base',
        clip = 'base',
        flag = 49
    },
    prop = {
        enabled = false,
        model = `prop_notepad_01`,
        bone = 60309,
        pos = vec3(0.03, 0.02, -0.02),
        rot = vec3(0.0, 0.0, 0.0)
    }
}

-- Scratch-card result is rolled only when the completed card is turned in.
Config.WinChance = 18.0
Config.Winnings = {
    { amount = 500, weight = 45.0 },
    { amount = 1000, weight = 30.0 },
    { amount = 2500, weight = 15.0 },
    { amount = 5000, weight = 7.0 },
    { amount = 10000, weight = 2.5 },
    { amount = 25000, weight = 0.5 }
}

Config.ResultsLimit = 50
Config.PersistResults = true
Config.ResultsFile = 'data/results.json'
Config.HidePlayerLastName = false

-- ============================================================
-- Power Ball
-- Defaults mirror the real Powerball game structure, but every
-- amount / schedule / multiplier can be adjusted for your economy.
-- ============================================================
Config.PowerBall = {
    enabled = true,
    dataFile = 'data/powerball.json',
    ticketPrefix = 'PB',

    basePrice = 2,
    powerPlayPrice = 1,
    doublePlayPrice = 1,

    whiteBallCount = 5,
    whiteBallMin = 1,
    whiteBallMax = 69,
    powerBallMin = 1,
    powerBallMax = 26,

    -- Monday, Wednesday, Saturday at 10:59 PM Eastern.
    drawDays = { 2, 4, 7 }, -- Lua wday: Sunday=1, Monday=2 ... Saturday=7
    drawHourEastern = 22,
    drawMinuteEastern = 59,
    salesCutoffMinutes = 90,
    drawCheckIntervalMs = 30000,

    startingJackpot = 20000000,
    cashValuePercent = 0.43,
    jackpotPayoutMode = 'cash_value', -- cash_value | advertised
    minimumRolloverIncrease = 10000000,
    salesToJackpotPercent = 0.25,
    drawHistoryLimit = 20,
    claimExpiryDays = 180,

    powerPlay = {
        enabled = true,
        tenXMaxJackpot = 150000000,
        matchFivePrize = 2000000,
        weightsWith10X = {
            { multiplier = 2, weight = 24 },
            { multiplier = 3, weight = 13 },
            { multiplier = 4, weight = 3 },
            { multiplier = 5, weight = 2 },
            { multiplier = 10, weight = 1 },
        },
        weightsWithout10X = {
            { multiplier = 2, weight = 24 },
            { multiplier = 3, weight = 13 },
            { multiplier = 4, weight = 3 },
            { multiplier = 5, weight = 2 },
        }
    },

    doublePlay = {
        enabled = true,
        topPrize = 10000000
    },

    -- Main Power Ball prize table.
    prizeTiers = {
        { white = 5, power = true,  prize = 'jackpot' },
        { white = 5, power = false, prize = 1000000 },
        { white = 4, power = true,  prize = 50000 },
        { white = 4, power = false, prize = 100 },
        { white = 3, power = true,  prize = 100 },
        { white = 3, power = false, prize = 7 },
        { white = 2, power = true,  prize = 7 },
        { white = 1, power = true,  prize = 4 },
        { white = 0, power = true,  prize = 4 },
    },

    -- Double Play uses the same ticket numbers in a separate draw.
    doublePlayPrizeTiers = {
        { white = 5, power = true,  prize = 10000000 },
        { white = 5, power = false, prize = 500000 },
        { white = 4, power = true,  prize = 50000 },
        { white = 4, power = false, prize = 500 },
        { white = 3, power = true,  prize = 500 },
        { white = 3, power = false, prize = 20 },
        { white = 2, power = true,  prize = 20 },
        { white = 1, power = true,  prize = 10 },
        { white = 0, power = true,  prize = 7 },
    },

    broadcastDrawComplete = true,
    adminDrawCommand = 'powerballdraw',
    adminAce = 'shiftlottery.admin'
}

-- ============================================================
-- Mega Millions (2025+ Format)
-- 5 / 70 + 1 / 24; $5 includes the per-play multiplier.
-- All prices, prize tiers and draw times can be customized.
-- ============================================================
Config.MegaMillions = {
    enabled = true,
    dataFile = 'data/mega_millions.json',
    ticketPrefix = 'MM',
    basePrice = 5,
    maxPlays = 5,
    drawOptions = { 1, 2, 5, 10, 26 },
    maxPurchaseTotal = 1000000,
    maxTicketHistoryPerPlayer = 250,

    whiteBallCount = 5,
    whiteBallMin = 1,
    whiteBallMax = 70,
    megaBallMin = 1,
    megaBallMax = 24,

    -- Tuesday / Friday at 11:00 PM US Eastern, DST-aware.
    -- Lua weekday: Sunday=1, Tuesday=3, Friday=6.
    drawDays = { 3, 6 },
    drawHourEastern = 23,
    drawMinuteEastern = 0,
    salesCutoffMinutes = 90,
    drawCheckIntervalMs = 30000,

    startingJackpot = 50000000,
    cashValuePercent = 0.43,
    jackpotPayoutMode = 'cash_value', -- cash_value | advertised
    minimumRolloverIncrease = 5000000,
    salesToJackpotPercent = 0.25,
    drawHistoryLimit = 20,
    claimExpiryDays = 180,

    -- Weighted frequencies total 32. Multiplier assigned to every play at purchase.
    multiplierWeights = {
        { multiplier = 2, weight = 15 },
        { multiplier = 3, weight = 10 },
        { multiplier = 4, weight = 4 },
        { multiplier = 5, weight = 2 },
        { multiplier = 10, weight = 1 }
    },

    -- BASE prizes; non-jackpot prizes are multiplied by the assigned multiplier.
    prizeTiers = {
        { white = 5, mega = true,  prize = 'jackpot' },
        { white = 5, mega = false, prize = 1000000 },
        { white = 4, mega = true,  prize = 10000 },
        { white = 4, mega = false, prize = 500 },
        { white = 3, mega = true,  prize = 200 },
        { white = 3, mega = false, prize = 10 },
        { white = 2, mega = true,  prize = 10 },
        { white = 1, mega = true,  prize = 7 },
        { white = 0, mega = true,  prize = 5 }
    },

    broadcastDrawComplete = true,
    adminDrawCommand = 'megamillionsdraw',
    adminAce = 'shiftlottery.admin'
}

Config.Security = {
    purchaseCooldown = 750,
    scratchRequestCooldown = 250,
    turnInCooldown = 1000,
    powerBallPurchaseCooldown = 750,
    powerBallClaimCooldown = 1000,
    megaMillionsPurchaseCooldown = 750,
    megaMillionsClaimCooldown = 1000,
    checkSessionGrace = 15000,
    maxEventDistance = 4.0,
    rejectInvalidMetadata = true
}

Config.Notifications = {
    title = 'Advanced Lottery',
    position = 'center-left',
    duration = 4500,
    purchaseSuccess = 'You Purchased %sx Lottery Scratch Card(s).',
    purchaseFailed = 'You Could Not Purchase Those Lottery Scratch Cards.',
    scratchComplete = 'Scratch Complete. Return To The Lottery Stand To Check Your Luck.',
    alreadyScratched = 'This Lottery Scratch Card Has Already Been Scratched.',
    noCards = 'You Do Not Have An Unscratched Lottery Scratch Card.',
    noScratchedCards = 'You Do Not Have A Completed Lottery Scratch Card To Turn In.',
    win = 'Winner! Your Lottery Scratch Card Paid $%s.',
    loss = 'No Luck This Time. Your Lottery Scratch Card Was Not A Winner.',
    inventoryError = 'Your Inventory Could Not Complete That Action.',
    standRequired = 'You Must Be At A Lottery Stand To Do That.',
    busy = 'Please Wait For The Current Lottery Action To Finish.',
    powerBallPurchased = 'Your Power Ball Ticket Was Entered Into The Next Drawing.',
    powerBallInvalidNumbers = 'Choose Five Unique White Balls And One Power Ball.',
    powerBallSalesClosed = 'Ticket Sales Are Closed For The Upcoming Drawing.',
    powerBallClaimed = 'Your Power Ball Ticket Paid $%s.',
    powerBallNoPrize = 'That Power Ball Ticket Does Not Have A Prize To Claim.',
    powerBallDrawComplete = 'The Power Ball Drawing Is Complete. Check Your Tickets At A Lottery Stand.',
    megaMillionsPurchased = 'Purchased %s Mega Millions Play(s) Across %s Draw(s).',
    megaMillionsInvalidNumbers = 'Choose Five Unique White Balls And One Mega Ball.',
    megaMillionsSalesClosed = 'Mega Millions Ticket Sales Are Closed For The Upcoming Drawing.',
    megaMillionsClaimed = 'Your Mega Millions Ticket Paid $%s.',
    megaMillionsNoPrize = 'This Mega Millions Ticket Has No Unclaimed Prize.',
    megaMillionsDrawComplete = 'The Mega Millions Drawing Is Complete. Check Your Tickets At A Lottery Stand.'
}

-- Anything not explicitly supported can be bridged here without editing core files.
Config.Custom = {
    -- SERVER: framework / money
    GetPlayerName = function(source)
        return GetPlayerName(source) or ('Player %s'):format(source)
    end,
    GetPlayerIdentifier = function(source)
        return nil
    end,
    GetMoney = function(source, account)
        return 0
    end,
    RemoveMoney = function(source, account, amount)
        return false
    end,
    AddMoney = function(source, account, amount)
        return false
    end,

    -- SERVER: inventory
    GetLotteryCards = function(source)
        return {}
    end,
    CanCarryLotteryCard = function(source, amount)
        return true
    end,
    AddLotteryCard = function(source, metadata)
        return false
    end,
    RemoveLotteryCard = function(source, slot, cardId)
        return false
    end,
    UpdateLotteryCard = function(source, slot, metadata)
        return false
    end,
    RegisterUsableItem = function(itemName, callback)
        return false
    end,

    -- CLIENT: target
    AddTargetModels = function(models, option)
        return false
    end,
    RemoveTargetModels = function(models, optionName, label)
    end,

    -- CLIENT: notification / text UI / progress
    Notify = function(message, ntype, duration)
        return false
    end,
    ShowTextUI = function(text)
        return false
    end,
    HideTextUI = function()
        return false
    end,
    Progress = function(data)
        return false
    end
}

```

{% endcode %}
{% endstep %}

{% step %}

### Restart / Start Your Server

Ensure Everything Is Working Well & Enjoy !!
{% endstep %}
{% endstepper %}
