iFoReX Posted July 9, 2012 Share Posted July 9, 2012 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
Castillo Posted July 9, 2012 Share Posted July 9, 2012 Do they have "lctrl" key pressed? Link to comment
iFoReX Posted July 9, 2012 Author Share Posted July 9, 2012 Solid, I want if I press lctrl+m play sound for all doesnt for me. Link to comment
Castillo Posted July 9, 2012 Share Posted July 9, 2012 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now