[RELEASE] [ESX] Diamond Casino Lucky Wheel

I was on 2060. I’m now on 2189 now but it worked fine on 2060

How did you get it to work?

2 Likes

took me some doing i had to change basically a little bit of everything to get it to work on my server. probably took me 15 hours to fix it and get it working smooth. i also made the podium spin in mine.

hello can u share link MLO diamond casino

Hi, It look amazing, could you share it with the community?

Hello,

I’m getting the following error with this resource, wondering if anyone else has experienced similar / how I might go about fixing it?

Could not make hard link for /home/zap714124/g347297/gta5-fivem-txadmin/PlumeESX_63D9C5.base/resources//[esx]/esx_tpnrp_luckywheel/stream//anim_casino_a@amb@casino@games@lucky7wheel@female.ycd <-> /home/zap714124/g347297/gta5-fivem-txadmin/PlumeESX_63D9C5.base/cache/files/esx_tpnrp_luckywheel/stream_cache/z57cea22ac183fe170b2dee0530ac2cb3df5a28ef.

what coords do you use?
whenever i spin it it goes sideways
EDIT: all the other coords are fine and working, its just when i spin it it goes sideways https://cdn.izmystic.gay/ursrodxg.jpg

I spent 2 hours trying to debug this sh#t ! Oh god thank you !

i can’t see lucky wheel. Game build is 2189.

have to change coords like this

ESX = nil
local _wheel = nil
local _lambo = nil
local _isShowCar = false
local _wheelPos = vector3(976.57, 50.3487, 73.9561)
local _baseWheelPos = vector3(1111.05, 229.81, -60.38)
local Keys = {
	["ESC"] = 322, ["BACKSPACE"] = 177, ["E"] = 38, ["ENTER"] = 18,	["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173
}
local _isRolling = false

Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(0)
	end
	while not ESX.IsPlayerLoaded() do 
        Citizen.Wait(500)
    end

    if ESX.IsPlayerLoaded() then
        local model = GetHashKey('vw_prop_vw_luckywheel_02a')
        
		local baseWheelModel = GetHashKey('vw_prop_vw_luckywheel_01a')
        local carmodel = GetHashKey('lp700r')

        Citizen.CreateThread(function()
            -- Base wheel
            RequestModel(baseWheelModel)
            while not HasModelLoaded(baseWheelModel) do
                Citizen.Wait(0)
            end

            _basewheel = CreateObject(baseWheelModel, _baseWheelPos.x, _baseWheelPos.y, _baseWheelPos.z, false, false, true)
            SetEntityHeading(_basewheel, 0.0)
            SetModelAsNoLongerNeeded(baseWheelModel)

            -- Wheel
            RequestModel(model)

            while not HasModelLoaded(model) do
                Citizen.Wait(0)
            end


            _wheel = CreateObject(model, 978.0117, 50.3487, 73.9561, false, false, true)
            SetEntityHeading(_wheel, -30.9754)
            SetModelAsNoLongerNeeded(model)
            
            -- Car
            RequestModel(carmodel)
            while not HasModelLoaded(carmodel) do
                Citizen.Wait(50)
            end

            local vehicle = CreateVehicle(carmodel, 963.79, 47.62, 75.57, 0.0, false, false)
            
            SetModelAsNoLongerNeeded(carmodel)
            

            -- RequestCollisionAtCoord(1100.39, 220.09, -48.75)

            -- while not HasCollisionLoadedAroundEntity(vehicle) do
            --     RequestCollisionAtCoord(1100.39, 220.09, -48.75)
            --     Citizen.Wait(0)
            -- end

            -- SetVehRadioStation(vehicle, 'OFF')
            FreezeEntityPosition(vehicle, true)
            local _curPos = GetEntityCoords(vehicle)
            SetEntityCoords(vehicle, _curPos.x, _curPos.y, _curPos.z + 1, false, false, true, true)
            _lambo = vehicle
            
        end)
    end
end)

Citizen.CreateThread(function() 
    while true do
        if _lambo ~= nil then
            local _heading = GetEntityHeading(_lambo)
            local _z = _heading - 0.3
            SetEntityHeading(_lambo, _z)
        end
        Citizen.Wait(5)
    end
end)

RegisterNetEvent("esx_tpnrp_luckywheel:doRoll")
AddEventHandler("esx_tpnrp_luckywheel:doRoll", function(_priceIndex) 
    _isRolling = true
    SetEntityHeading(_wheel, -30.0)
    SetEntityRotation(_wheel, 976.55, 50.24, 74.68, 1, true)
    Citizen.CreateThread(function()
        local speedIntCnt = 1
        local rollspeed = 1.0
        -- local _priceIndex = math.random(1, 20)
        local _winAngle = (_priceIndex - 1) * 18
        local _rollAngle = _winAngle + (360 * 8)
        local _midLength = (_rollAngle / 2)
        local intCnt = 0
        while speedIntCnt > 0 do
            local retval = GetEntityRotation(_wheel, 1)
            if _rollAngle > _midLength then
                speedIntCnt = speedIntCnt + 1
            else
                speedIntCnt = speedIntCnt - 1
                if speedIntCnt < 0 then
                    speedIntCnt = 0
                    
                end
            end
            intCnt = intCnt + 1
            rollspeed = speedIntCnt / 50
            local _y = retval.y - rollspeed
            _rollAngle = _rollAngle - rollspeed
            -- if _rollAngle < 5.0 then
            --     if _y > _winAngle then
            --         _y = _winAngle
            --     end
            -- end
            SetEntityRotation(_wheel, 0.0, _y, 0.0, 1, true)
            Citizen.Wait(0)
        end
    end)
end)

RegisterNetEvent("esx_tpnrp_luckywheel:rollFinished")
AddEventHandler("esx_tpnrp_luckywheel:rollFinished", function() 
    _isRolling = false
end)


function doRoll()
    if not _isRolling then
        _isRolling = true
        local playerPed = PlayerPedId()
        local _lib = 'anim_casino_a@amb@casino@games@lucky7wheel@female'
        if IsPedMale(playerPed) then
            _lib = 'anim_casino_a@amb@casino@games@lucky7wheel@male'
        end
        local lib, anim = _lib, 'enter_right_to_baseidle'
        ESX.Streaming.RequestAnimDict(lib, function()
            local _movePos = vector3(976.25, 50.78, 74.68)
            TaskGoStraightToCoord(playerPed,  _movePos.x,  _movePos.y,  _movePos.z,  1.0,  -1,  312.2,  0.0)
            local _isMoved = false
            while not _isMoved do
                local coords = GetEntityCoords(PlayerPedId())
                if coords.x >= (_movePos.x - 0.01) and coords.x <= (_movePos.x + 0.01) and coords.y >= (_movePos.y - 0.01) and coords.y <= (_movePos.y + 0.01) then
                    _isMoved = true
                end
                Citizen.Wait(0)
            end
            TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false)
            while IsEntityPlayingAnim(playerPed, lib, anim, 3) do
                    Citizen.Wait(0)
                    DisableAllControlActions(0)
            end
            TaskPlayAnim(playerPed, lib, 'enter_to_armraisedidle', 8.0, -8.0, -1, 0, 0, false, false, false)
            while IsEntityPlayingAnim(playerPed, lib, 'enter_to_armraisedidle', 3) do
                Citizen.Wait(0)
                DisableAllControlActions(0)
            end
            TriggerServerEvent("esx_tpnrp_luckywheel:getLucky")
            TaskPlayAnim(playerPed, lib, 'armraisedidle_to_spinningidle_high', 8.0, -8.0, -1, 0, 0, false, false, false)
        end)
    end
end

-- Menu Controls
Citizen.CreateThread(function()
	while true do
        Citizen.Wait(1)
        local coords = GetEntityCoords(PlayerPedId())

        if(GetDistanceBetweenCoords(coords, _wheelPos.x, _wheelPos.y, _wheelPos.z, true) < 1.5) and not _isRolling then
            ESX.ShowHelpNotification("~w~~h~Premi ~r~~h~E ~w~~h~per giocare alla ~b~~h~RUOTA DELLA FORTUNA ~r~~h~COSTO:~g~~h~ 100,000$")
            if IsControlJustReleased(0, Keys['E']) then
                doRoll()
            end
        end		
	end
end)

Same here

dam! good share

1 Like

any help?


1 Like

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