Vai precisar dos codigos das sources =/
eu fiz aqui e ta dando <a nil value>.... /// a nova "forceLogout"
no resto ta certo eu acho.
function onUse(cid, item, fromPosition, itemEx, toPosition, forceLogout)
local item = 18490 --id do item q vai clica
setPlayerStorageValue(cid, 7123, os.time())
doforceLogout(pid)
return true
end
-----------------------------
function getTime(s)
local h = math.floor(s/3600)
local m = math.floor((s - h * 3600) / 60)
return h, m, (s - h * 3600) - m * 60
end
function onLogin(cid)
local secs_off = os.time() - getPlayerStorageValue(cid, 7123)
local skilltime = getPlayerStorageValue(cid, 7125) --- Tempo de treinamento disponivel
local skillrate = 1 --- Taxa com quem o skill passará
if(secs_off > skilltime) then local secs_off = skilltime end --- Limita o treino
if (secs_off > 0) then
local tim = {getTime(secs_off)}
local h, m, s = (tim[1] > 0) and tim[1] .. " hora" or "", (tim[2] > 0) and tim[2] .." minuto " or "", (tim[3] > 0) andtim[3] .. " segundo " or ""
local h, m, s = (tim[1] > 1) and tim[1] .. " horas" or h, (tim[2] > 1) and tim[2] .." minutos " or m, (tim[3] > 1) andtim[3] .. " segundos " or s
local timz = h
if (m ~= "") then
if (h ~= "" and s ~= "") then
timz = timz .. ", ".. m .. "e "
elseif(s ~= "") then
timz = timz .. m .."e "
else
timz = timz .. m
end
end
elseif (m <= 10) then --- Só apos 10 minutos depois de deslogado começa a treinar
doPlayerSendTextMessage(cid, 19, "O treinameto só ativa depois de 10 minutos.")
elseif (h >= 1) then --- Limita o treino a 1 hora
doPlayerSendTextMessage(cid, 19, "Durante sua ausência você treinou por 1 hora.")
doPlayerAddSkillTry(cid,1,skillrate*1200)
doPlayerAddSkillTry(cid,5,skillrate*1200)
elseif (h < 1 and m >= 10) then --- Adiciona o tanto de skill referente ao tempo de treino
doPlayerSendTextMessage(cid, 19, "Durante sua ausência você treinou por ".. timz .. s .. ".")
doPlayerAddSkillTry(cid,1,skillrate*(tim-600)/2) --- raciocinio: skillrate * (tempo de treino - 10 minutos) / por padrão o HITs são a cada 2 segundos
doPlayerAddSkillTry(cid,5,skillrate*(tim-600)/2)
end
setPlayerStorageValue(cid, 7123, -1)
setPlayerStorageValue(cid, 7125, getPlayerStorageValue(cid, 7125) - (secs_off)) --- remove o tempo de treinamento
setPlayerStorageValue(cid, 7124, os.time())
end
return true
-----------------------------------------------------
vo tentando aqui qm sabe kkk
vlws








info
Grupo: Artesão
Registrado: 03/12/11
Posts: 137
Reputação: +5
Char no Tibia: Surionz
@TitanicoxD, pode sim, só que presciso testar antes. qual server 9.60 vc usa?? pode mandar link por mensagem??