I created a lever in Jail, where the player can use it and check if his time on Jail still running, if not, hes will be sent to thais temple. But it isnt working, any ideas?
Changed
LUA:
local JailLever = Action()
local Liberdade = Position(32369, 32241, 7)
function JailLever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getPosition() ~= Position({x = 32233, y = 32194, z = 7}) then
return false
end
if item:getId() == 61758 then
local tile = Tile(Position(32233, 32194, 7))
local creature = tile:getTopCreature()
-- Check Time
if creature then
if player:getStorageValue(22082) >= os.time() then
player:sendCancelMessage("Voce ainda nao pode sair da Jail!")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
else
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations ".. creature ..", now you are free.")
player:teleportTo(Liberdade)
end
end
end
end
JailLever:aid(61758)
JailLever:register()
Post automatically merged:
Solved.I created a lever in Jail, where the player can use it and check if his time on Jail still running, if not, hes will be sent to thais temple. But it isnt working, any ideas?
LUA:local JailLever = Action() local Liberdade = Position(32369, 32241, 7) function JailLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getPosition() ~= Position({x = 32233, y = 32194, z = 7}) then return false end if item:getId() == 61758 then local tile = Tile(Position(32233, 32194, 7)) local creature = tile:getTopCreature() -- Check Time if creature then if player:getStorageValue(22082) >= os.time() then player:sendCancelMessage("Voce ainda nao pode sair da Jail!") player:getPosition():sendMagicEffect(CONST_ME_POFF) return true else player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations ".. creature ..", now you are free.") player:teleportTo(Liberdade) end end end end JailLever:aid(61758) JailLever:register()
Changed
foritem:getId() == 61758 then
and changeditem:getId() == 2772 then
forplayer:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations ".. creature ..", now you are free.")
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations now you are free.")
Last edited: