Ir para conteúdo

Featured Replies

Postado

Em movements/scripts crie um arquivo:


tpmensal.lua

 

Spoiler

local newpos = {x = 1, y = 1, z = 1} -- posição que o teleport levará
local time = {30, "day"} -- tempo para entrar novamente

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getPlayerStorageValue(cid, 43445) >= os.time() then
doPlayerSendCancel(cid, "You can enter again at " .. os.date("%d %B %Y %X", getPlayerStorageValue(cid, 43445))..".")
doTeleportThing(cid, fromPosition) 
return true
end
setPlayerStorageValue(cid, 43445, mathtime(time) + os.time())
doTeleportThing(cid, newpos)
doSendMagicEffect(newpos, CONST_ME_TELEPORT)
return true
end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1)
end
end
return "Error: Bad declaration in mathtime function."
end

 

 

Em movements.xml: <movevent type="StepIn" actionid="ACTION_ID_DO_TELEPORT" event="script" value="tpmensal.lua"/>

Contato:

 

  • Respostas 6
  • Visualizações 223
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Em movements/scripts crie um arquivo: tpmensal.lua     Em movements.xml: <movevent type="StepIn" actionid="ACTION_ID_DO_TELEPORT" event="script" value="tpmensal.lua"/>

Postado
  • Autor
56 minutos atrás, Dwarfer disse:

Em movements/scripts crie um arquivo:


tpmensal.lua

 

  Ocultar conteúdo


local newpos = {x = 1, y = 1, z = 1} -- posição que o teleport levará
local time = {30, "day"} -- tempo para entrar novamente

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getPlayerStorageValue(cid, 43445) >= os.time() then
doPlayerSendCancel(cid, "You can enter again at " .. os.date("%d %B %Y %X", getPlayerStorageValue(cid, 43445))..".")
doTeleportThing(cid, fromPosition) 
return true
end
setPlayerStorageValue(cid, 43445, mathtime(time) + os.time())
doTeleportThing(cid, newpos)
doSendMagicEffect(newpos, CONST_ME_TELEPORT)
return true
end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1)
end
end
return "Error: Bad declaration in mathtime function."
end

 

 

Em movements.xml: <movevent type="StepIn" actionid="ACTION_ID_DO_TELEPORT" event="script" value="tpmensal.lua"/>


Funcionou perfeitamente, obrigado :grin:

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo