Jump to content

Mapmusic on/off


Reflex#

Recommended Posts

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'

Link to comment
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

Link to comment
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 ) 

Link to comment
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
Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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