local sondID
function startMusic()
setRadioChannel(0)
song = playSound("music"..songID..".mp3",true)
outputChatBox("#ffffff* #C0FF3ETurn on/off Music Using #FFFFFF\"M\"",255,255,255,true)
end
function makeRadioStayOff()
setRadioChannel(0)
cancelEvent()
end
function toggleSong(player, command, songID)
if not songID and type(songID) == "number" then
if not songOff then
setSoundVolume(song,0)
sondID = nil
songOff = true
removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
else
setSoundVolume(song,1)
songOff = false
sondID = songID
setRadioChannel(0)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
end
else
outputChatBox("#ffffff* #C0FF3ECommand syntax: /musicmusic [songID]",255,255,255,true)
end
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff)
addCommandHandler("musicmusic",toggleSong)
addEventHandler("onClientResourceStop",getResourceRootElement(getThisResource()),startMusic)
Try this, but you can't use the bind key anymore