Hola Alguien Me Puede Ayudar Con El Conteo De Horas De Mi Server No Se Que Esta Mal No Cuenta Las Horas En El Server Llevo 1 hora Esperando y No Se Ha Movido Ni Un Segundo ._. Gracias Si Me Pueden Ayudar (y).
addEventHandler("onResourceStart", resourceRoot,
function ()
exports.scoreboard:scoreboardAddColumn("tiempoJugando", root, 70, "Tiempo.", 2)
for i, v in ipairs(getElementsByType("player")) do
local theAccount = getPlayerAccount(v)
local theAccountData = getAccountData(theAccount, "tiempoJ")
if theAccountData == false then
theAccountData = "0H 0m"
end
setElementData(v, "tiempoJugando", theAccountData)
setTimer (triggerClientEvent, 5000, 1, v, "customEvent", v)
end
end)
addEventHandler("onResourceStop", resourceRoot,
function ()
exports.scoreboard:scoreboardRemoveColumn("tiempoJugando", root)
for ind, val in ipairs(getElementsByType("player")) do
local theAccount2 = getPlayerAccount(val)
local tiempo = getElementData(val, "tiempoJugando")
setAccountData(theAccount2, "tiempoJ", tiempo)
end
end)
function onPlayerStart ()
local theAccount3 = getPlayerAccount(source)
local theAccountData2 = getAccountData(theAccount3, "tiempoJ")
if theAccountData2 == false then
theAccountData2 = "0H 0m"
end
local relog = getElementData(source, "tiempoJugando")
if relog == false then
setElementData(source, "tiempoJugando", theAccountData2)
triggerClientEvent(source, "customEvent", source)
else
setElementData(source, "tiempoJugando", theAccountData2)
end
end
addEventHandler("onPlayerLogin", root, onPlayerStart)
function onStop ()
local theAccount4 = getPlayerAccount(source)
local tiempo2 = getElementData(source, "tiempoJugando")
setAccountData(theAccount4, "tiempoJ", tiempo2)
end
addEventHandler("onPlayerQuit", root, onStop)