[RELEASE] [ESX] Diamond Casino Lucky Wheel

any help?


2 Likes

how do i get it to win car every spin ?

add trigger like this, in the server.lua

                    elseif _priceIndex == 3 or _priceIndex == 7 or _priceIndex == 15 or _priceIndex == 20 then
                        -- print("Win money")
                        local _money = 0
                        if _priceIndex == 3 then
						TriggerClientEvent("esx_tpnrp_luckywheel:winCar", _source)
                            _money = 20000
                        elseif _priceIndex == 7 then
						TriggerClientEvent("esx_tpnrp_luckywheel:winCar", _source)
                            _money = 30000
                        elseif _priceIndex == 15 then
						TriggerClientEvent("esx_tpnrp_luckywheel:winCar", _source)
                            _money = 40000
                        elseif _priceIndex == 20 then
						TriggerClientEvent("esx_tpnrp_luckywheel:winCar", _source)
                            _money = 50000
                        elseif _priceIndex == 5 then
						TriggerClientEvent("esx_tpnrp_luckywheel:winCar", _source)
                            _money = 10000
                        elseif _priceIndex == 14 then
						TriggerClientEvent("esx_tpnrp_luckywheel:winCar", _source)
                            _money = 10000
                        end

its, working … but don’t put owner car… when i try put in my garage say “this is not your car” D: can help me?

this is my code of VehicleShop

--- LUCKYWHEEL
RegisterNetEvent("esx_tpnrp_luckywheel:winCar")
AddEventHandler("esx_tpnrp_luckywheel:winCar", function() 
    
    ESX.Game.SpawnVehicle("lp700r", { x = 933.29,y = -2.82, z = 78.76 }, 144.6, function (vehicle)
		local playerPed = PlayerPedId()
		TaskWarpPedIntoVehicle(playerPed, vehicle, -1)

        local newPlate     = GeneratePlate()
        local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
        vehicleProps.plate = newPlate
        SetVehicleNumberPlateText(vehicle, newPlate)

        TriggerServerEvent('esx_vehicleshop:setVehicleOwned', vehicleProps)

        ESX.ShowNotification("HAI VINTO UN'AUTO , COMPLIMENTI !!!")
    
	end)

    FreezeEntityPosition(playerPed, false)
    SetEntityVisible(playerPed, true)

end)
1 Like

try changing your garage script?

my garage it’s working fine… only car reward (winCar) of luckywheel don’t working… when i win the car , can’t see car on DB.

this not send car on DB owned_vehicles

you find fix?

i changed everything that sayed ’ esx_tpnrp_luckywheel ’ and renamed it to ’ supreme_luckywheel ’ and that fixed it
so change all the trigger events

supreme_luckywheel? but your script for luckywheel is named supreme_luckywheel?

Nothing, change Car spawn but don’t go in OWNED_VEHICLES of DB

2 Likes

Is there any way to sync the rewards with the wheel itself?

I cant get this to spin at all, any fix for this ?

Hi guys,
I saw the author updated his client.lua like 3 days ago.
Now I can see properly the wheel BUT the coords doen’st match neither with the MLO Enterable DLC and neither with the “program-casino” MLO that he used the first time.

So here’s my question which MLO are you using this time ?

And congrats for you work and your fixes !!!

EDIT : using “NoClip” i was able to tp to the coords but once again the coords doesn’t match

1 Like

I was also unable to find out what MLO he is using. Using some of the comments I was able to get the location close but not exact.
The functionality of this resource is very cool but the idea seems to be half-baked.

Until there is a proper release I would stay away from it.

Same problem here… any fixes?

1 Like

Here’s my solution for adding vehicles to the database. Just be aware that I have it modified to choose a random vehicle from a list so if you want to hardcode the car they win you will need to stick to the old format. I’m sure someone can optimize this further, this is just how I got it working.

esxp_tpnrp_luckywheel > client > client.lua

RegisterNetEvent("esx_tpnrp_luckywheel:winCar")
AddEventHandler("esx_tpnrp_luckywheel:winCar", function() 
    
    ESX.Game.SpawnVehicle(carmodel, { x = 933.29,y = -2.82, z = 78.76 }, 144.6, function (vehicle)
        local playerPed = PlayerPedId()
        TaskWarpPedIntoVehicle(playerPed, vehicle, -1)

        local newPlate     = exports['esx_vehicleshop']:GeneratePlate()
        local vehicle = GetVehiclePedIsIn(playerPed, false)
        local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
        vehicleProps.plate = newPlate
        SetVehicleNumberPlateText(vehicle, newPlate)
        
        TriggerServerEvent('esx_vehicleshop:setVehicleOwned', vehicleProps)
    end)

    FreezeEntityPosition(playerPed, false)
    SetEntityVisible(playerPed, true)
end)

function spawnveh()
    Zones = {
        VehicleSpawnPoint = {
            Pos   = {x = 953.7, y = 70.08, z = 75.23},
            Heading = 182.73
        }
    }

    -- local prizeCar = ''
    local randomCar = math.random(1, 71)

    if randomCar == 1 then
        prizeCar = 'xls2'
    elseif randomCar == 2 then
        prizeCar = 'baller5'
    elseif randomCar == 3 then
        prizeCar = 'dukes2'
    elseif randomCar == 4 then
        prizeCar = 'impaler2'
    elseif randomCar == 5 then
        prizeCar = 'impaler3'
    elseif randomCar == 6 then
        prizeCar = 'impaler4'
    elseif randomCar == 7 then
        prizeCar = 'imperator'
    elseif randomCar == 8 then
        prizeCar = 'imperator2'
    elseif randomCar == 9 then
        prizeCar = 'imperator3'
    elseif randomCar == 10 then
        prizeCar = 'slamvan5'
    elseif randomCar == 11 then
        prizeCar = 'slamvan6'
    elseif randomCar == 12 then
        prizeCar = 'blista3'
    elseif randomCar == 13 then
        prizeCar = 'comet4'
    elseif randomCar == 14 then
        prizeCar = 'coquette4'
    elseif randomCar == 15 then
        prizeCar = 'kuruma2'
    elseif randomCar == 16 then
        prizeCar = 'paragon2'
    elseif randomCar == 17 then
        prizeCar = 'schafter5'
    elseif randomCar == 18 then
        prizeCar = 'specter2'
    elseif randomCar == 19 then
        prizeCar = 'zr380'
    elseif randomCar == 20 then
        prizeCar = 'zr3802'
    elseif randomCar == 21 then
        prizeCar = 'zr3803'
    elseif randomCar == 22 then
        prizeCar = 'nero2'
    elseif randomCar == 23 then
        prizeCar = 'vigilante'
    elseif randomCar == 24 then
        prizeCar = 'voltic2'
    elseif randomCar == 25 then
        prizeCar = 'deathbike'
    elseif randomCar == 26 then
        prizeCar = 'deathbike2'
    elseif randomCar == 27 then
        prizeCar = 'deathbike3'
    elseif randomCar == 28 then
        prizeCar = 'diablous2'
    elseif randomCar == 29 then
        prizeCar = 'hakuchou2'
    elseif randomCar == 30 then
        prizeCar = 'oppressor2'
    elseif randomCar == 31 then
        prizeCar = 'rrocket'
    elseif randomCar == 32 then
        prizeCar = 'sanctus'
    elseif randomCar == 33 then
        prizeCar = 'shotaro'
    elseif randomCar == 34 then
        prizeCar = 'blazer'
    elseif randomCar == 35 then
        prizeCar = 'blazer3'
    elseif randomCar == 36 then
        prizeCar = 'blazer4'
    elseif randomCar == 37 then
        prizeCar = 'blazer5'
    elseif randomCar == 38 then
        prizeCar = 'dune2'
    elseif randomCar == 39 then
        prizeCar = 'dune3'
    elseif randomCar == 40 then
        prizeCar = 'dune4'
    elseif randomCar == 41 then
        prizeCar = 'dune5'
    elseif randomCar == 42 then
        prizeCar = 'insurgent'
    elseif randomCar == 43 then
        prizeCar = 'insurgent2'
    elseif randomCar == 44 then
        prizeCar = 'insurgent3'
    elseif randomCar == 45 then
        prizeCar = 'menacer'
    elseif randomCar == 46 then
        prizeCar = 'technical'
    elseif randomCar == 47 then
        prizeCar = 'technical2'
    elseif randomCar == 48 then
        prizeCar = 'trophytruck'
    elseif randomCar == 49 then
        prizeCar = 'trophytruck2'
    elseif randomCar == 50 then
        prizeCar = 'zhaba'
    elseif randomCar == 51 then
        prizeCar = 'rumpo3'
    elseif randomCar == 52 then
        prizeCar = 'apc'
    elseif randomCar == 54 then
        prizeCar = 'barrage'
    elseif randomCar == 55 then
        prizeCar = 'halftruck'
    elseif randomCar == 56 then
        prizeCar = 'rhino'
    elseif randomCar == 57 then
        prizeCar = 'scarab'
    elseif randomCar == 58 then
        prizeCar = 'scarab2'
    elseif randomCar == 59 then
        prizeCar = 'scarab3'
    elseif randomCar == 60 then
        prizeCar = 'thruster'
    elseif randomCar == 61 then
        prizeCar = 'hauler'
    elseif randomCar == 62 then
        prizeCar = 'hauler2'
    elseif randomCar == 63 then
        prizeCar = 'packer'
    elseif randomCar == 64 then
        prizeCar = 'phantom'
    elseif randomCar == 65 then
        prizeCar = 'phantom2'
    elseif randomCar == 66 then
        prizeCar = 'phantom3'
    elseif randomCar == 67 then
        prizeCar = 'formula'
    elseif randomCar == 68 then
        prizeCar = 'formula2'
    elseif randomCar == 69 then
        prizeCar = 'openwheel1'
    elseif randomCar == 70 then
        prizeCar = 'openwheel2'
    end

    carmodel = GetHashKey(prizeCar)
    -- carmodel = GetHashKey('lp700r')
    RequestModel(carmodel)
    while not HasModelLoaded(carmodel) do
        Citizen.Wait(0)
    end

    ESX.Game.SpawnLocalVehicle(carmodel,  Zones.VehicleSpawnPoint.Pos, Zones.VehicleSpawnPoint.Heading, function(vehicle)
    -- ESX.Game.SpawnLocalVehicle('lp700r',  Zones.VehicleSpawnPoint.Pos, Zones.VehicleSpawnPoint.Heading, function(vehicle)
        Citizen.Wait(10)
        SetEntityAsMissionEntity(vehicle, true, true)
        SetVehicleHasBeenOwnedByPlayer(vehicle, true)
        SetVehicleOnGroundProperly(vehicle)
        Citizen.Wait(10)
        FreezeEntityPosition(vehicle, true)
        SetEntityInvincible(vehicle, true)
        SetVehicleDoorsLocked(vehicle, 2)
        _lambo = vehicle
        table.insert(casinoprops, _lambo)
    end)
end

esx_vehicleshop > server > main.lua (for some reason this event was missing from the entire file, if that’s the case just add it at the bottom)

RegisterServerEvent('esx_vehicleshop:setVehicleOwned')
AddEventHandler('esx_vehicleshop:setVehicleOwned', function (vehicleProps)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)

	MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (@owner, @plate, @vehicle)',
	{
		['@owner']   = xPlayer.identifier,
		['@plate']   = vehicleProps.plate,
		['@vehicle'] = json.encode(vehicleProps)
	}, function (rowsChanged)
	end)
end)
3 Likes

car spawns underground i fixed that too easy

can you share the fix? also what framework ?

It wasn’t that hard to reposition the Wheel, do it yourself lazy derp.
This script is basically Ready-To-Use, just need some Translation and adjustment.

Using Vanilla IPL


Position for using Vanilla IPL
x = 1111.0593, y = 229.8342, z = -50.3800
Heading 0.0

Changed from “Pay for Spin” to “Spin per day”

And random update Prize pool using cron.

Casino with Blackjack and roulette fixed

Tips : Learn some basic coding knowledge before running your own server as most question above are hilarious ( for me at least )