Jump to content

[Ayuda]Afk en Scoreboard


Recommended Posts

Posted

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

Posted
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?

Posted

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

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

Posted
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?

Posted

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

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

Posted

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

Posted
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?

Posted
la verdad eso se complica un poco mas, porq con un cancelEvent y con un onClientPlayerDamage no funciona

ya que los zombies usan setElementHealth

A bueno, muchas Gracias ^^

Posted

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 :P

Posted

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,

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...