Hello there, hope you doing well , so i was wondering where's the problem in my script , ( my goal is to start radio and stop map music / stop radio map music start )
here's my codes *
Client side
--script By Zivrok--//
function startMusic()
setRadioChannel(1)
tfcsong = playSound("http://listen.181fm.com/181-energy98_128k.mp3",true)
end
function makeRadioStayOff()
setRadioChannel(1)
cancelEvent()
end
function toggleSong()
if not songOff then
setSoundVolume(tfcsong,0)
songOff = true
removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
else
setSoundVolume(tfcsong,1)
songOff = false
setRadioChannel(1)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
end
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff)
addCommandHandler("radio",toggleSong)
bindKey("j","down","radio")
------------------
Server side
function stopmapmusic ()
if tfcsong = true then
setSoundVolume(song,0)
else
setSoundVolume(song,1)
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),stopmapmusic)
i hope i'll find help soon , thank you