• 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!

Lua [TFS 1.1] Exhaustion.set problem + countdown in Actions

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,838
Solutions
18
Reaction score
616
Location
Poland
Hello there Otlanders,
Im so dumb on TFS 1.1 (i scripted few years ago on 0.3.6pl1) so i decided to write it on this forum. :p
Anyone could help me with the Exhaustion.Set error problem, please?

I have this error:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/homestone.lua:onUse
data/actions/scripts/homestone.lua:30: attempt to compare number with boolean
stack traceback:
        [C]: in function '__le'
        data/actions/scripts/homestone.lua:30: in function 'check'
        data/actions/scripts/homestone.lua:28: in function <data/actions/scripts
/homestone.lua:12>


Here is my script:
Code:
local config = {
waittime = 10, -- time in seconds to use homestone again.
storage = 2301, -- storage for `waittime`
level = 50, -- after this level you ! CAN`T ! use homestone.
cooldown = 5 -- how many seconds character must wait after use stone until get teleported.
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)

local homeid = (getPlayerTown(player))
local pos = player:getPosition()
if (player:getLevel() >= config.level) then
            player:sendCancelMessage('Only players under ' .. config.level .. ' can use homestone!')
            pos:sendMagicEffect(3)
else
if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
            player:say('I cant do that in fight!', TALKTYPE_MONSTER_SAY)
            player:sendCancelMessage('You cannot use homestone while you during a fight!')
            pos:sendMagicEffect(3)
else
   

        if(exhaustion.check(cid, config.storage)) then -- re-use
            player:sendCancelMessage('You need to wait ' .. waittime .. ' before you can use homestone again.')
            pos:sendMagicEffect(3)
        else

    local destination = player:getTown():getTemplePosition()
    item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "This stone can teleport player (under " .. config.level .. " level) to his home. \n Current home: "..getTownName(homeid)..".")
    pos:sendMagicEffect(40)
    player:teleportTo(destination)
    destination:sendMagicEffect(40)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have succesfully teleported to ' .. getTownName(homeid) .. '.')
    exhaustion.set(cid, config.storage, config.waittime) -- add re-use exhaust

        end -- end re-use

end -- end pzlock
end -- end levelcap

    return true -- koniec skryptu
end -- end function

And i have a question about countdown.
It's possible to add there an event what makes player wait (set player no move) config.cooldown seconds until he get tped and for each second its displaying animation (40) ?


I will be very grateful if anyone could help me with this error and add this thing. :(

Thanks in advance,
Fresh.
 
Last edited:
If you solved a problem, you can write the solution. This could help people with the same problem who use search.
 
Back
Top