[QB][Free] Casino Luckywheel! (qb-luckywheel)

Hi there fellas.

I grabbed the open source of This ESX Release and rewrote it to match QBCore framework.

All prizes must be configured by hand and some custom code need to be added into the qb-vehicleshop (look below for this code).

The car spawned inside the casino and defined in the luckywheel-script is the car qb-vehicleshop gives out when you win a car.

Download: Github


Add to: qb-vehicleshop\client.lua

RegisterNetEvent('qb-vehicleshop:client:winCar', function (carname)
	local vehicle = QBCore.Functions.GetClosestVehicle(vector3(935.01, 42.80, 72.43))
	local showCar = carname
	TriggerServerEvent('qb-vehicleshop:server:luckywheelWin', vehicle, showCar)

RegisterNetEvent('qb-vehicleshop:client:winLuckyWheelVehicle', function(vehicle, plate)
    QBCore.Functions.SpawnVehicle(carmodel, function(veh)
        TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
        exports['LegacyFuel']:SetFuel(veh, 100)
        SetVehicleNumberPlateText(veh, plate)
        SetEntityHeading(veh, Config.LuckyWheel.w)
        SetEntityAsMissionEntity(veh, true, true)
        TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(veh))
        TriggerServerEvent("qb-vehicletuning:server:SaveVehicleProps", QBCore.Functions.GetVehicleProperties(veh))
    end, Config.LuckyWheel, true)

Add to: qb-vehicleshop\server.lua

-- Win car at luckywheel
RegisterNetEvent('qb-vehicleshop:server:luckywheelWin', function(data, carname)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
	local PlayerData = Player.PlayerData
	local vehicle = data
	local showCar = carname
    local plate = GeneratePlate()
    MySQL.Async.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, state, garage) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
    TriggerClientEvent('qb-vehicleshop:client:winLuckyWheelVehicle', src, vehicle, plate)
    TriggerClientEvent('QBCore:Notify', src, 'Congratulations! Your vehicle can be claimed at the valet near the entrance.', 'success')

Add a new garage named ‘casinovalet’ or change ‘casinovalet’ to your garage of choice.

Best regards, Revoxxi.


Sounds sick! I’m gonna save this for later, great job @Revoxxi !

for esx dont have sir?

1 Like

Download link where? :smiling_face_with_tear:


you can use this

1 Like

My bad buddy, added the github-link :rofl:

1 Like

Can you help me fix this? I’m using QB core & the car spawned on top of the other one. AND the wheel is out of place.

1 Like

If you have two cars spawning, that means you got another script spawning one. With the out of place wheel, you need to edit the interior of the casino. That is something you need to do with your current casino MLO

1 Like

It’s a drag & drop casino MLO so I don’t know how to edit it. Any other options for what I can do to fix it ?

1 Like

You can change Wheel location in the client on line 5 and 6

local _wheelPos = vector3(948.42, 44.67, 70.86) --vector3(925.13, 54.47, 71.26)

local _baseWheelPos = vector3(948.42, 44.67, 70.6) --vector3(925.13, 54.47, 71.0) 

You might also need to move the Animation which is located at Line 128 Looks like this in the client

local _movePos = vector3(947.33, 43.82, 71.64)
1 Like
[script:qb-vehiclesho] SCRIPT ERROR: @qb-vehicleshop/server.lua:22: attempt to call a nil value (global 'GeneratePlate')

Keeps throwing this when i win a car.

1 Like

Great script! One issue, when the wheel is spun; the wheel then goes back to it’s original heading. and ignores the heading which I have set for it? So it is set correctly, when it is spun, the wheel faces another way?

Thanks in advance! (Preview to understand what I mean - Luckwheel issue recorded with Medal.tv)

did you figure out a solution for this i am having same issue?

Nah found a different one that works.

How do I change the heading direction for the wheel? I’m trying to get it lined up but there are only 3 coord positions for it.

I’m sure you’ve found it by now but in case you haven’t, it’s in the client file. Look for “SetEntityHeading(_wheel, -31.95)”. Your value won’t be -31.95 but that’s what I found worked for me.

1 Like

I have tried putting this on my QBcore based server and it says…

[ c-resources-core] Could not find dependency tprp_base for resource luckywheel.
[ citizen-server-impl] Couldn’t start resource luckywheel.

So I found a download for tprp_base and installed it to only then see this…

[ c-resources-core] Could not find dependency essentialmode for resource tprp_base.
[ c-resources-core] Could not start dependency tprp_base for resource luckywheel.
[ citizen-server-impl] Couldn’t start resource luckywheel.

I thought this was supposed to be made to work for QBcore and not ESX?

Just beware people will abuse this to get unlimited money. There is no cool down on the spins and you consistently win hundreds of thousands.

I can’t get it working so not a big deal since no one can use it LOL

Figured out why it wasn’t working. I was using the MLO and switched to the DLC version of the casino. Then check the coords for the wheel and it was no correct so I fixed it.

Now if I can find a way to adjust the prizes so there is more risk and make it not so easy to win hundreds of thousands of dollars and multiple cars.