I'm trying to make a function that if i'm exhausted the counter displayme a message saying how many seconds I have to wait for cast it again but doesen't work... some help please?
I'm using tfs 0.2.10 thanks!
I'm using tfs 0.2.10 thanks!
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 1.335, 0, 1.58, 0)
local exhaustion =
{
check = function (cid, storage)
if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION) == TRUE) then
return false
end
return getPlayerStorageValue(cid, storage) >= os.time(t)
end,
get = function (cid, storage)
if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION) == TRUE) then
return false
end
local exhaust = getPlayerStorageValue(cid, storage)
if(exhaust > 0) then
local left = exhaust - os.time(t)
if(left >= 0) then
return left
end
end
return false
end,
set = function (cid, storage, time)
setPlayerStorageValue(cid, storage, os.time(t) + time)
end,
make = function (cid, storage, time)
local exhaust = exhaustion.get(cid, storage)
if(not exhaust) then
exhaustion.set(cid, storage, time)
return true
end
return false
end
}
function onCastSpell(cid, var)
if exhaustion.get(cid,23000) == false then
doPlayerSendTextMessage(cid,22,"Cooldown["..exhaustion.get(cid,23000).."]")
end
end