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'

Scripting in lua

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" ).

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Scripting in lua

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Scripting in lua

Posted

You have the function:

checkForExternalSounds ( ) 

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Scripting in lua

Posted

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Scripting in lua

Posted

That's the oldest story ever: "A friend gave it to me, it wasn't me!".

We don't help people with stolen scripts.

Topic locked.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

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