Need help with Youtube BOOMBOX

So here I have problem with this script when I go away from radio it stops music and I need to paste url again (as it is written in code). Now I want when you go away that sound is setted to 0.0 so music isnt stoppend and when you are back to radio it resume to play lest say at volume of 40.0. I tired do this alone but unsuccessfully.
Here is code

RegisterNetEvent('esx_hifi:play_music')
AddEventHandler('esx_hifi:play_music', function(id, object)
    if distance(object) < Config.distance then
        SendNUIMessage({
            transactionType = 'playSound',
            transactionData = id
        })

        Citizen.CreateThread(function()
            while true do
                Citizen.Wait(100)
                if distance(object) > Config.distance then
                    SendNUIMessage({
						transactionType = 'stopSound'
                    })
                    break
                end
            end
        end)
    end
end)

Tried with this and this works, sets music to 0 and I dont know how to set to resume playing on 40.0 volume

Citizen.CreateThread(function()
            while true do
                Citizen.Wait(100)
                if distance(object) > Config.distance then
                    SendNUIMessage({
                        transactionType = 'volume',
                        transactionData = 0.0
                    })
                end
            end
        end)		
    end
end)

Link of oroginal script: [RELEASE] Youtube BOOMBOX

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.