iFoReX Posted November 24, 2012 Share Posted November 24, 2012 no da ni problema ni nada. lo Que queria que pasara era que al poner el cmd /play LINK nombre , era que se reproduciera el LINK, y en el outputchatbox apareciiera Reproduciendo : nombre :3 nose si me entienden aqui el script : cl-side addEvent("triggear",true) addEventHandler("triggear",root, function(cancion,nombre) setRadioChannel(0) song = playSound(cancion,true) outputChatBox("#48FF00##2E2E2EReproduciendo : #48FF00##2E2E2"..nombre,root,0,0,0,true) end ) function toggleSong() if not songOff then setSoundVolume(song,0) songOff = true removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) else setSoundVolume(song,1) songOff = false setRadioChannel(0) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) end end addCommandHandler("music",toggleSong) sv-side addCommandHandler("play",function(playerSource,commandName,cancion,nombre) for k,v in ipairs(players) do accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then triggerClientEvent("triggear",playerSource,cancion,nombre) end end end ) Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 Cual es el problema? P.D: Es "Admin" no "admin" con minuscula "a". Link to comment
iFoReX Posted November 24, 2012 Author Share Posted November 24, 2012 ahora me da este error : SONG_X\musica_s.lua:2: bad argument #1 to 'ipairs' (table expected, got nil) Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 for k,v in ipairs(players) do "players" no esta definido, pone esto: for k,v in ipairs ( getElementsByType ( "player" ) ) do Link to comment
iFoReX Posted November 24, 2012 Author Share Posted November 24, 2012 ya arregle todo ... y asi me quedo --------------------- ---Script Echo por ElMota----- --------------------- addEvent("triggear",true) addEventHandler("triggear",root, function(cancion,nombre) setRadioChannel(0) stopSound(song) setTimer(function() song = playSound(cancion,true) end,2000,1) outputChatBox(" #48FF00##2E2E2EReproduciendo : #48FF00##2E2E2E"..nombre,0,0,0,true) end ) function toggleSong() if not songOff then setSoundVolume(song,0) songOff = true removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) else setSoundVolume(song,1) songOff = false setRadioChannel(0) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) end end addCommandHandler("music",toggleSong) addCommandHandler("play",function(playerSource,commandName,cancion,nombre) for k,v in ipairs(getElementsByType"player") do accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then triggerClientEvent("triggear",playerSource,cancion,nombre) end end end ) tengo 1 problema, en mi server local funciona a la perfeccion, pero en el server hosteado se reproduce 2 veces a la vez la misma cancion :C Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 Cambia: triggerClientEvent("triggear",playerSource,cancion,nombre) Por: triggerClientEvent(v,"triggear",v,cancion,nombre) Link to comment
iFoReX Posted November 24, 2012 Author Share Posted November 24, 2012 ahora funciona, pero solo el player que pone el cmd la escucha, y no todo el srv como queria yo. Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 Vos pusiste para que solo los admines pudieran escucharla. Link to comment
iFoReX Posted November 24, 2012 Author Share Posted November 24, 2012 yo queria que solo los admines pudieran ejecutar el cmd, pero que todo el srv la escuchara Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 Me parecia ami, pero bueh. addCommandHandler ( "play", function ( playerSource, commandName, cancion, nombre ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( playerSource ) ), aclGetGroup ( "Admin" ) ) then triggerClientEvent ( root, "triggear", root, cancion, nombre ) end end ) Link to comment
Recommended Posts