Jump to content

Set sound for all maps to 50 %


JoZeFSvK

Recommended Posts

Hey i wanna create when map start set map music to 50% or less this is my code but dont work who know where will problem ? thank you

addEventHandler("onClientMapStarting",getRootElement(), 
function radioFix() 
    if not songOn then 
        setSoundVolume(getRootElement(),0.3) 
        songOn = true 
        setElementData(getLocalPlayer(),"Radio.Channel",tonumber(getRadioChannel())) 
        setRadioChannel(0) 
        addEventHandler("onClientPlayerRadioSwitch",getRootElement(),radioFix) 
    end 
end) 
  

Link to comment
function radioFix ( ) 
    if ( not songOn ) then 
        for _, sound in ipairs ( getElementsByType ( "sound" ) ) do 
            setSoundVolume ( sound, 0.3 ) 
        end 
        songOn = true 
        setElementData ( localPlayer, "Radio.Channel", tonumber ( getRadioChannel ( ) ) ) 
        setRadioChannel ( 0 ) 
        addEventHandler ( "onClientPlayerRadioSwitch", getRootElement(), radioFix ) 
    end 
end 
addEventHandler ( "onClientMapStarting", root, radioFix ) 

Try it.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...