• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Lever to leave Jail

psyman420

New Member
Joined
Jul 21, 2023
Messages
1
Reaction score
0
GitHub
PsyMan420
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()
Post automatically merged:

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()
Solved.

Changed
item:getId() == 61758 then
for
item:getId() == 2772 then
and changed
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations ".. creature ..", now you are free.")
for
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations now you are free.")
 
Last edited:
Back
Top