Alexs Posted June 27, 2012 Share Posted June 27, 2012 Miren, hice este script: function musicambientalfunc ( modo ) local encendida = getElementData ( localPlayer, "musica.on" ) if (encendida) then if ( modo == 1 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == 2 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == 3 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == 4 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == 5 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == off ) and ( encendida == true ) then stopSound(musicambiental) setElementData ( localPlayer, "musica.on", false ) end end end addCommandHandler ( "ambiente", musicambientalfunc ) function dejarenoffalspawn ( ) setElementData ( localPlayer, "musica.on", false ) end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), dejarenoffalspawn ) No funciona, al escribir /ambiente 1 no suena nada, pero el debugscript no dice nada, que esta mal? Link to comment
Castillo Posted June 27, 2012 Share Posted June 27, 2012 function musicambientalfunc ( _, modo ) local encendida = getElementData ( localPlayer, "musica.on" ) if (encendida) then if ( modo == 1 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == 2 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == 3 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == 4 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == 5 ) and ( encendida == false ) then local musicambiental = playSound("Bruzko - El frio - [url=http://www.HHGroups.com.mp3]www.HHGroups.com.mp3[/url]") setElementData ( localPlayer, "musica.on", true ) elseif ( modo == off ) and ( encendida == true ) then stopSound(musicambiental) setElementData ( localPlayer, "musica.on", false ) end end end addCommandHandler ( "ambiente", musicambientalfunc ) function dejarenoffalspawn ( ) setElementData ( localPlayer, "musica.on", false ) end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), dejarenoffalspawn ) El primer argumento de addCommandHandler client side es el nombre del comando que usaste. Link to comment
Alexs Posted June 27, 2012 Author Share Posted June 27, 2012 Lo puse asi mismo, sin cambiar nada, me asegure 2 veces de todo, que la cancion se llame como el archivo y este igual en el mtea.xml, pero nada, el debugscript tampoco dice nada Link to comment
Castillo Posted June 27, 2012 Share Posted June 27, 2012 No se si podes usar espacios en los archivos. Link to comment
Alexs Posted June 27, 2012 Author Share Posted June 27, 2012 No, pero ya intente sacandoselos, me decia error HTTP si lo intentaba con los espacios. Link to comment
CheiN Posted June 27, 2012 Share Posted June 27, 2012 no entendí pero creo que en vez de poner http://www.hhgroups.com pones esto: http://www.hhgroups.com.mp3 Link to comment
Alexs Posted June 27, 2012 Author Share Posted June 27, 2012 Al descargar el archivo se llama "Artista-Cancion-Pagina", no es que la intente reproducir desde la web. Link to comment
CheiN Posted June 28, 2012 Share Posted June 28, 2012 ya intentaste playSound (music.mp3) Link to comment
iFoReX Posted June 28, 2012 Share Posted June 28, 2012 Mr.Domo a eso le falta el string, alexs y si le cambias el nombre a la cancion ? Link to comment
CheiN Posted June 28, 2012 Share Posted June 28, 2012 ya vi que wtf paso.... no cerraste los mil ends de todos los functions ifs elses thens debes cerras! Link to comment
Alexs Posted June 28, 2012 Author Share Posted June 28, 2012 Estan los "end" 1 por el if, uno por las functions y otro por el if y elseif. Link to comment
iFoReX Posted June 29, 2012 Share Posted June 29, 2012 Mr.Domo estan bien los ends no tienen nada que ver con el error del script Link to comment
CheiN Posted June 29, 2012 Share Posted June 29, 2012 .com.mp3 no es un formato de sonido para lua -.- solo mp3 playSound (nombredelarchivo.mp3) Link to comment
Alexs Posted June 29, 2012 Author Share Posted June 29, 2012 Jamas habia visto extensiones con 2 puntos, .mp3 es el archivo, .com es parte del nombre e.e y LUA acepta variados formatos... Link to comment
iFoReX Posted June 29, 2012 Share Posted June 29, 2012 Ademas Mr.Domo eso no funcionaria faltan los strings Link to comment
CheiN Posted June 29, 2012 Share Posted June 29, 2012 cambia el nombre a: playSound (music2.mp3) cambialo a music2.mp3 -.- intenta Link to comment
Alexs Posted June 29, 2012 Author Share Posted June 29, 2012 emmm.... crees que no lo intente, creo que es una obviedad que solo postearia un problema cuando ya intente arreglandolo y esa ayuda esta mal, te faltan los strings. Link to comment
iFoReX Posted June 29, 2012 Share Posted June 29, 2012 Porque pones esto Mr.Domo ( -.- ) ? Link to comment
Alexs Posted June 29, 2012 Author Share Posted June 29, 2012 Off Topic: A mi tambien me molesta On Topic: el ElementData esta bien usado, verdad? Link to comment
Recommended Posts