[RELEASE] Youtube BOOMBOX

for me is not working, i have that error:
Logger is not defined

#Edit - all works fine now, just the link was broken :smiley: sry and nice update

Well the menu and other things are normal but when I try to put a song nothing happens just an error appears in the console! ! http://prntscr.com/p5rgev

Donā€™t put the full link, just type the code afther =

Like this, Z6IOjNvTZ1s

yes I was just putting in the ID but I tried another song and it worked it seems like and only some big songs that donā€™t catch

Only Youtube Video who allow Embed player can be played like said in the original post. I will work on a better way to log error in ESX Notifications like ā€œSong not available, try another oneā€

1 Like

What can be triggered to trigger the plugin

1 Like

So how does this script work?

1 Like

I have tried it and it works perfect, I just want to know if I can increase the range in which it is heard, thanks!! :smiley:

1 Like

you can do this in config.lua

oh Iā€™m sorry, I looked at it and I didnā€™t see it, Iā€™m stupid XD ty :smiley:

LINE 3

Lol !

standalone plis s2

So how does this script work?

Not hard, just put the id afther =

im just only can play your music BLyz7_Ou5bY , i cant use any music in youtube only yours

1 Like

Youā€™re a genius! I suggest a radio like this, but for the car. Thank you for uploading your content.

GREAT WORK :heart_eyes:

1 Like

open the SQL file and delete ā€˜essentialmodeā€™ it should work after

1 Like

I donā€™t know if itā€™s the best way to do but for the sound issue when someone leave the BoomBox zone you can maybe set the volume to 0.0 when he leave the zone and get back to 40.0 for exemple when he is return in instead of stop the sound

I was lazy and i made this change quickly just for testing this hypothesis this is why the second SendNUIMessage is here but itā€™s seems to work when you come back close to the BoomBox the sound will normally resumes, it will maybe help to solve this issue in a cleaner way :

First :

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 = 'volume',
                        transactionData = 0.0
                    })
                end
            end
        end)		
    end
end)

Second :

        if closestDistance ~= -1 and closestDistance <= 3.0 then
            if lastEntity ~= closestEntity and not menuOpen then
                ESX.ShowHelpNotification(_U('hifi_help'))
                lastEntity = closestEntity
                currentAction = "music"
                currentData = closestEntity
                SendNUIMessage({
                    transactionType = 'volume',
                    transactionData = 40.0
                })				
            end
        else
            if lastEntity then
                lastEntity = nil
                currentAction = nil
                currentData = nil
            end
        end
3 Likes