Jump to content

why the music doesnt play for all ?


iFoReX

Recommended Posts

the music doesnt play for all only for me. and 0 errors debugscript

code :

cl-side

addEvent("reproducir",true) 
addEventHandler("reproducir",root,function() 
if getKeyState("lctrl") then 
if not isElement(r1) then 
r1 = playSound("http://ecrd.com/files/2/tgyb1wnqsjfu2w/J%20King%20&%20Maximan%20Ft%20%C3%91engo%20Flow,%20Arcangel,%20De%20La%20Ghetto,%20Randy,%20Alexis,%20Jamsha%20Y%20Chyno%20Nyno%20-%20Siente%20(Official%20Remix)%20(ECRD.Com).mp3") 
if r1 then 
outputChatBox("La Musica esta empezando por"..getPlayerName(getLocalPlayer()),255,255,255,true) 
elseif isElement(r1) then 
outputChatBox("La Musica ya esta sonando",getLocalPlayer(),255,255,255,true) 
end 
end 
end 
end 
) 
  
bindKey("n","down",function() 
if getKeyState("lctrl") then 
if isElement(r1) then 
destroyElement(r1) 
outputChatBox("La Musica esta parando por"..getPlayerName(getLocalPlayer()),255,255,255,true) 
elseif not isElement(r1) then 
outputChatBox("La Musica ya esta sonando !",getLocalPlayer(),255,255,255,true) 
end 
end 
end 
) 
  
  

sv-side

addEventHandler("onResourceStart",resourceRoot,function() 
for index, thePlayer in ipairs ( getElementsByType ( "player" ) ) do 
bindKey(thePlayer,"m","down",server) 
end 
end 
) 
  
function server() 
triggerClientEvent("reproducir",getRootElement()) 
end 
  

Link to comment

outputChatBox client side has no visibleTo argument.

-- client side:

addEvent ( "reproducir", true ) 
addEventHandler ( "reproducir", root, 
    function ( ) 
        if getKeyState ( "lctrl" ) then 
            if ( not isElement ( r1 ) ) then 
                r1 = playSound ( "http://ecrd.com/files/2/tgyb1wnqsjfu2w/J%20King%20&%20Maximan%20Ft%20%C3%91engo%20Flow,%20Arcangel,%20De%20La%20Ghetto,%20Randy,%20Alexis,%20Jamsha%20Y%20Chyno%20Nyno%20-%20Siente%20(Official%20Remix)%20(ECRD.Com).mp3" ) 
                if ( r1 ) then 
                    outputChatBox ( "La Musica esta empezando por ".. getPlayerName ( source ), 255, 255, 255, true ) 
                else 
                    outputChatBox ( "La Musica ya esta sonando", 255, 255, 255, true ) 
                end 
            end 
        end 
    end 
) 
  
addEvent ( "detener", true ) 
addEventHandler ( "detener", root, 
    function ( ) 
        if getKeyState ( "lctrl" ) then 
            if isElement ( r1 ) then 
                destroyElement ( r1 ) 
                outputChatBox ( "La Musica esta parando por ".. getPlayerName ( source ), 255, 255, 255, true ) 
            else 
                outputChatBox ( "La Musica no esta sonando !", 255, 255, 255, true ) 
            end 
        end 
    end 
) 

-- server side:

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for index, thePlayer in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( thePlayer, "m", "down", startMusic ) 
            bindKey ( thePlayer, "n", "down", stopMusic ) 
        end 
    end 
) 
  
function startMusic ( thePlayer ) 
    triggerClientEvent ( "reproducir", root, thePlayer ) 
end 
  
function stopMusic ( thePlayer ) 
    triggerClientEvent ( "detener", root, thePlayer ) 
end 

Try that.

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