This is the script i
I only changed some things to it
function startMusic()
setRadioChannel(0)
song = playSound("song2.ogg",true)
outputChatBox("Toggle the music on/off with 'm'", 255, 0, 255 )
outputChatBox("Change Song with 'n'", 255, 0, 255 )
end
function makeRadioStayOff()
setRadioChannel(0)
cancelEvent()
end
function toggleSong()
if not songOff then
setSoundVolume(song,0)
songOff = true
removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
else
setSoundVolume(song,1)
songOff = false
setRadioChannel(1)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
end
function selectSong()
stopSound(song)
song2 = playSound("song.ogg",true)
outputChatBox("Changed Song", 255, 0, 255 )
end
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff)
addCommandHandler("music",toggleSong)
addCommandHandler("sel",selectSong)
bindKey("m","down","music")
bindKey("n","down","sel")
If the player presses "n" The song should be changed but nothing happens