> For the complete documentation index, see [llms.txt](https://wert-dev.gitbook.io/wert-dev-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wert-dev.gitbook.io/wert-dev-docs/products/esx/wert-lucky-wheel.md).

# Wert Lucky Wheel

## <mark style="background-color:orange;">INSTALLATION</mark>

1 - Upload the script folder to the location of your resources

2 - Check config file for your own settings

3 - **Installation successful, have a good funs**

## <mark style="background-color:purple;">OX LIB OPTION</mark>

There are many ox settings available in the files, if you want, you can configure them.

<figure><img src="/files/TnJaTOvFKDpwv7Mmadc7" alt=""><figcaption></figcaption></figure>

If you want to use ox\_lib, please check if this link is enabled on fxmanifest.check it out from inside lua. this must be turned on before you can use ox\_lib. After opening it, it will be enough to use the refresh and ensure commands.

<figure><img src="/files/RAoL6cJpEeozkPgAGywa" alt=""><figcaption></figcaption></figure>

## <mark style="background-color:blue;">OPEN FILES</mark>

```lua
Config = {}

Config.UseTarget = true
Config.TargetDistance = 1.5
Config.DebugPoly = false
Config.NoTargetDistance = 1.5
Config.NoTargetInteractionKey = 38 -- [E] | https://docs.fivem.net/docs/game-references/controls/
Config.OxLib = false
Config.CheckNameFromSql = false

Config.WheelCoolDown = 30 -- 30

Config.WheelSoundSettings = {
    max_distance = 20,
    min_volume = 0.1,
    max_volume = 0.8,
}

Config.WheelModel = 'vw_prop_vw_luckywheel_02a'
Config.BorderModel = -1901044377
Config.BlueMarkerModel = 554774312

Config.TargetIcon = 'fa-solid fa-arrows-spin'
Config.InteractionIcon = '<i class="fa-solid fa-arrows-spin"></i>'

Config.RollAnim = {
    lib = 'anim_casino_a@amb@casino@games@lucky7wheel@male',
    anim = 'enter_right_to_baseidle',
    anim_two = 'enter_to_armraisedidle',
    anim_three = 'armraisedidle_to_spinningidle_high',
}



Config.RewardMultiple = {
    ['1'] = 2,
    ['3'] = 4,
    ['5'] = 6,
    ['10'] = 11,
    ['20'] = 21,
}

Config.RewardChances = {
    ['1'] = 50,
    ['3'] = 20,
    ['5'] = 15,
    ['10'] = 10,
    ['20'] = 5,
}

Config.CreateNpcZOffset = 1.0

Config.WheelSpinNowNotif = true
Config.WheelSpinNowNotifCoordCheck = true
Config.LoseNotif = true
Config.WinNotif = true
Config.WinSound = true
Config.WinSoundVolume = 0.3


Config.Locations = {
    {
        whell_pos = vector4(201.47, -928.48, 29.69, 57.86),
        ped_model = `s_f_y_casino_01`,
        ped_pos = vector4(200.76, -930.12, 30.69, 234.83),
        move_pos = vector4(200.66, -929.87, 30.69, 55.89),
    },
}
```

```lua
local ESX = exports["es_extended"]:getSharedObject()

function CustomNotifVariation(text, style, time)
    if Config.OxLib then
        lib.notify({title = 'Notification', description = text, type = style})
    else
        ESX.ShowNotification(text, style or 'info', time or 3000)
    end
end

function CustomTargetFunction(data)
    exports["qb-target"]:AddTargetEntity(data.entity, {
        options = data.options,
        distance = data.distance
    })
end

function ShowTextUI(text, icon)
    if Config.OxLib then
        lib.showTextUI(text, {position = 'left-center', icon = icon})
    else
        -- Custom text ui here
        -- exports['qb-core']:DrawText(text, 'left')
        print('Please select text ui setting in editable_client.lua')
    end
end

function HideTextUI()
    if Config.OxLib then
        lib.hideTextUI()
    else
        -- Custom text ui here
        -- exports['qb-core']:DrawText(text, 'left')
        print('Please select text ui setting in editable_client.lua')
    end
end

RegisterNetEvent('wert-luckywheel:client:custom-notif', function(text, style, time)
    CustomNotifVariation(text, style, time)
end)
```

```lua
local ESX = exports["es_extended"]:getSharedObject()

local function getFirstLetterUppercase(str) return str:sub(1, 1):upper() end
local function getFirstTwoLetters(str) return str:sub(1, 2):upper() end

function CheckPlayerAddBetMoney(src, amount)
    local ply = ESX.GetPlayerFromId(src)
    if not ply then return false end
    local money = ply.getMoney()
    if (money - amount) >= 0 then return true else return false end
end

function RemovePlayerMoney(src, amount)
    local ply = ESX.GetPlayerFromId(src)
    if not ply then return end
    ply.removeMoney(amount)
end

function AddPlayerMoney(src, amount)
    local ply = ESX.GetPlayerFromId(src)
    if not ply then return end
    ply.addMoney(amount)
end

function GetPlayerNameLetters(src)
    local ply = ESX.GetPlayerFromId(src)
    if not ply then return 'PR' end
    local retval = ''
    if Config.CheckNameFromSql then
        local identifier = ply.getIdentifier()
        local row = MySQL.single.await('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', {identifier})
        if row and row.firstname and row.lastname then
            local one = getFirstLetterUppercase(row.firstname)
            local second = getFirstLetterUppercase(row.lastname)
            retval = one .. '' .. second
        else
            local str = ply.getName()
            retval = getFirstTwoLetters(str) 
        end
    else
        local str = ply.getName()
        retval = getFirstTwoLetters(str)
    end
    return retval
end

function GiveSpinReward(src, bet, multiple, percante)
    local ply = ESX.GetPlayerFromId(src)
    if not ply then return end
    local amount = bet * multiple
    ply.addMoney(tonumber(amount))
    if Config.WinNotif then
        local oldnotif = LANG.player_won_text
        local newnotif = string.format(oldnotif, amount, percante)
        TriggerClientEvent('wert-luckywheel:client:send-ui-notif', src, {
            header = LANG.player_won_header,
            text = newnotif,
            style = 'success'
        })
    end
    if Config.WinSound then TriggerClientEvent('wert-luckywheel:client:wheel-win-sound', src) end
end
```

```lua
LANG = {
    target_label = "Roll",
    notarget_label = "[E] Roll",
    rolled_header = 'WHEEL ACTIVE NOW!',
    rolled = "You have spun the wheel!",
    this_wheel_busy = "Wheel busy you need wait!",
    money_error_header = 'BET COULD NOT BE ADDED!',
    money_error_text = 'You are not have enough money!',
    player_won_header = 'WON!',
    player_won_text = 'You won $%s for make bet %s',
    player_lose_header = 'LOSE!',
    player_lose_text = "You didn't win, good luck next time!",
    ui = {
        -- UI Locales here
        header = 'WHEEL OF FORTUNE',
        information = 'Place your money in the betting sections. If the wheel lands on the numbers you have selected, you will win!',
        remaining_time = 'REMAINING TIME',
        remaining_time_desc = 'When the wheel turns all bets are finalized',
        second = 's',
        percante_1 = '1',
        percante_3 = '3',
        percante_5 = '5',
        percante_10 = '10',
        percante_20 = '20',
        percante_1_multiple = 'PAYS X2',
        percante_3_multiple = 'PAYS X4',
        percante_5_multiple = 'PAYS X6',
        percante_10_multiple = 'PAYS X11',
        percante_20_multiple = 'PAYS X21',
        bet_settings = 'BET SETTINGS',
        bet_description = 'After select the bet amount, you can set a bet with a left click. Use the right click to clean it.',
        money_format = '$',
        players = 'PLAYERS',
        players_info = '%s PLAYERS PLAYING',
        total_bet_info = 'TOTAL BET : %s$',
        history = 'ROUND HISTORY',
        last_rounds_not_found = 'LAST ROUNDS NOT FOUND',
    },
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://wert-dev.gitbook.io/wert-dev-docs/products/esx/wert-lucky-wheel.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.
