Narutimmy Posted June 19, 2012 Posted June 19, 2012 Hola, buenas tardes, bueno mi duda y solicitud es esta, como puedo aserle para colocar el Estado del AFK en el Scoreaborad? osea si el user usa /afk salga en el score que esta afk. Gracias
Alexs Posted June 19, 2012 Posted June 19, 2012 usa las funciones exportadas de scoreborad y el setElementData
Narutimmy Posted June 19, 2012 Author Posted June 19, 2012 usa las funciones exportadas de scoreborad y el setElementData Alexs bueno no le entendi bien pero no se podria usar con esto exports.dxscoreboard:addScoreboardColumn('Estado') eso aria la tabla no?
Alexs Posted June 19, 2012 Posted June 19, 2012 emmm si usas dxscoreboard si, pero aun necesitas setElementData, el Scripting es genial e ilimitado, pero no magico para saber el estado asi como asi, crea la columna pero no la rellena
Araa Posted June 20, 2012 Posted June 20, 2012 exports [ "scoreboard" ]:addScoreboardColumn ("Estado", 3 ) function actualizarEstado() for index, player in ipairs ( getElementsByType ( "player" ) ) do estado = getElementData (player, "afk") setElementData ( player, "Estado", tostring(estado)) end end setTimer ( actualizarEstado, 2500, 0 ) function goafk (player, command) data = getElementData (player, "afk") if not (data == "AFK") then setElementData (player, "afk", "AFK") else setElementData (player, "afk", "Normal") end end addCommandHandler ("goafk", goafk) Usa, /goafk para cambiar de modo AFK a normal y de Normal a AFK.
Narutimmy Posted June 20, 2012 Author Posted June 20, 2012 exports [ "scoreboard" ]:addScoreboardColumn ("Estado", 3 ) function actualizarEstado() for index, player in ipairs ( getElementsByType ( "player" ) ) do estado = getElementData (player, "afk") setElementData ( player, "Estado", tostring(estado)) end end setTimer ( actualizarEstado, 2500, 0 ) function goafk (player, command) data = getElementData (player, "afk") if not (data == "AFK") then setElementData (player, "afk", "AFK") else setElementData (player, "afk", "Normal") end end addCommandHandler ("goafk", goafk) Usa, /goafk para cambiar de modo AFK a normal y de Normal a AFK. *-* Gracias y amm 2 preguntas: 1.- Si Cambio addCommandHandler ("goafk", goafk) por addCommandHandler ("afk", afk) sigue funcionando o no? 2.- Va en el Server o Cliente?
Edikosh998 Posted June 20, 2012 Posted June 20, 2012 1) Acordate de cambiar el nombre de la function (ponele "afk") 2) Va en server side
Narutimmy Posted June 20, 2012 Author Posted June 20, 2012 Bueno lo puse asi exports [ "scoreboard" ]:addScoreboardColumn ("Estado", 3 ) function actualizarEstado() for index, player in ipairs ( getElementsByType ( "player" ) ) do estado = getElementData (player, "afk") setElementData ( player, "Estado", tostring(estado)) end end setTimer ( actualizarEstado, 2500, 0 ) function goafk (player, command) data = getElementData (player, "afk") if not (data == "AFK") then setElementData (player, "afk", "AFK") else setElementData (player, "afk", "Normal") end end addCommandHandler ("afk", goafk) en el Server.lua de el Scrip AFK que tenia, asi al escribir afk se pone en afk en el juego y ades se sincroniza con el del scoreboard, Gracias
explOdeR Posted June 20, 2012 Posted June 20, 2012 a ese script le falta por que lo mas probable es que salga false en el scoreboard..
Araa Posted June 20, 2012 Posted June 20, 2012 exports [ "scoreboard" ]:addScoreboardColumn ("Estado", 3 ) function actualizarEstado() for index, player in ipairs ( getElementsByType ( "player" ) ) do estado = getElementData (player, "afk") if (estado) then setElementData ( player, "Estado", tostring(estado)) else setElementData ( player, "Estado", "Normal") end end end setTimer ( actualizarEstado, 2500, 0 ) function goafk (player, command) data = getElementData (player, "afk") if not (data == "AFK") then setElementData (player, "afk", "AFK") else setElementData (player, "afk", "Normal") end end addCommandHandler ("afk", goafk) Si, le faltaba un check para ver si tenia o no ElementData. Ya lo arregle.
explOdeR Posted June 20, 2012 Posted June 20, 2012 si entonces quedaria asi.. exports [ "scoreboard" ]:addScoreboardColumn ("Estado", 3 ) function actualizarEstado() for index, player in ipairs ( getElementsByType ( "player" ) ) do estado = getElementData (player, "afk") if (estado) then setElementData ( player, "Estado", tostring(estado)) else setElementData ( player, "Estado", "Normal") end end end setTimer ( actualizarEstado, 2500, 0 ) function afk (player, command) data = getElementData (player, "afk") if not (data == "AFK") then setElementData (player, "afk", "AFK") else setElementData (player, "afk", "Normal") end end addCommandHandler ("afk", afk) puse la funcion como afk por que es mejor ''encuentro yo '' pero da exactamente lo mismo :3 pero eso es :3
Narutimmy Posted June 21, 2012 Author Posted June 21, 2012 exports [ "scoreboard" ]:addScoreboardColumn ("Estado", 3 ) function actualizarEstado() for index, player in ipairs ( getElementsByType ( "player" ) ) do estado = getElementData (player, "afk") if (estado) then setElementData ( player, "Estado", tostring(estado)) else setElementData ( player, "Estado", "Normal") end end end setTimer ( actualizarEstado, 2500, 0 ) function goafk (player, command) data = getElementData (player, "afk") if not (data == "AFK") then setElementData (player, "afk", "AFK") else setElementData (player, "afk", "Normal") end end addCommandHandler ("afk", goafk) Si, le faltaba un check para ver si tenia o no ElementData. Ya lo arregle. wow., encerio muchas gracias *-* otra peque Duda, hay manera para que estando AFK los Zombis no te agan Daño?
BorderLine Posted June 21, 2012 Posted June 21, 2012 la verdad eso se complica un poco mas, porq con un cancelEvent y con un onClientPlayerDamage no funciona ya que los zombies usan setElementHealth
Narutimmy Posted June 21, 2012 Author Posted June 21, 2012 la verdad eso se complica un poco mas, porq con un cancelEvent y con un onClientPlayerDamage no funcionaya que los zombies usan setElementHealth A bueno, muchas Gracias ^^
iFoReX Posted June 22, 2012 Posted June 22, 2012 narutimmy, podrias usar setTimer(setElementHealth, 100, 0, source, 100), con setElementFrozen( source, true ) o podrias usar setElementDimension( source, math.random(0,1000) ), o algo asi
BorderLine Posted June 22, 2012 Posted June 22, 2012 seria ideal que con respecto a lo que dice mota, y los jugadores no abusaran del afk para recobrar vida usar getElementHealth para y despues de eso usar el setTimer,
Recommended Posts