Jump to content

Mapmusic on/off


Reflex#

Recommended Posts

Posted
function muteMapMusic() 
    if not mapMusicMute then 
        mapMusicMute = true 
        checkForExternalSounds() 
        outputChatBox("#ff9d00[OFF]#FFFFFFMap music is now #FF0000disabled#FFFFFF, press M to enable it.",255,255,255,true) 
    else 
        mapMusicMute = false 
        outputChatBox("#ff9d00[ON]#FFFFFFMap music is now #00FF00enabled#FFFFFF, press M to disable it.",255,255,255,true) 
        for i,k in ipairs(pausedExternalSounds) do 
            if isElement(k) then 
                setSoundPaused(k,false) 
            end 
        end 
  
        checkForExternalSounds() 
    end 
end 
bindKey("m","down",muteMapMusic) 
  

WARNING:Bad argument @'bindKey'

Posted
Check in the meta.xml if the script is set to server side or client side.

P.S: It must be client side ( type = "client" ).

All work thx i forgot :)

But when map music disabled in chatbox dont write message,but when enable,all work

Posted
local mapMusicMute = false 
  
function muteMapMusic ( ) 
    if ( not mapMusicMute ) then 
        mapMusicMute = true 
        checkForExternalSounds ( ) 
        outputChatBox ( "#ff9d00[OFF]#FFFFFFMap music is now #FF0000disabled#FFFFFF, press M to enable it.", 255, 255, 255, true ) 
    else 
        mapMusicMute = false 
        outputChatBox ( "#ff9d00[ON]#FFFFFFMap music is now #00FF00enabled#FFFFFF, press M to disable it.", 255, 255, 255, true ) 
        for i, k in ipairs ( pausedExternalSounds ) do 
            if isElement ( k ) then 
                setSoundPaused ( k, false ) 
            end 
        end 
  
        checkForExternalSounds ( ) 
    end 
end 
bindKey ( "m","down",muteMapMusic ) 

Posted (edited)
local mapMusicMute = false 
  
function muteMapMusic ( ) 
    if ( not mapMusicMute ) then 
        mapMusicMute = true 
        checkForExternalSounds ( ) 
        outputChatBox ( "#ff9d00[OFF]#FFFFFFMap music is now #FF0000disabled#FFFFFF, press M to enable it.", 255, 255, 255, true ) 
    else 
        mapMusicMute = false 
        outputChatBox ( "#ff9d00[ON]#FFFFFFMap music is now #00FF00enabled#FFFFFF, press M to disable it.", 255, 255, 255, true ) 
        for i, k in ipairs ( pausedExternalSounds ) do 
            if isElement ( k ) then 
                setSoundPaused ( k, false ) 
            end 
        end 
  
        checkForExternalSounds ( ) 
    end 
end 
bindKey ( "m","down",muteMapMusic ) 

Dont work :(

debugscript:

ERROR: script.lua : 6 :attempt to call global 'checkForExternalSounds(a nil value)'

ERROR: script.lua :11:bad argument #1 to 'ipairs'(table expected,got nil)

Edited by Guest
Posted
You have the function:
checkForExternalSounds ( ) 

right? because if you use it without it, it'll just "enable" it.

right,when music enabled it write in chat,but when disabled,write nothing

Posted
Is this script even yours? or you stole it from some server?

My friend give it to me and say that this script dont work.I try to fix it..but as you see...not good

I think he do this.

idk

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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