dofile(getDataDir() .. "lib/exhaustion.lua")
exhaustion.check(cid, storage)
exhaustion.get(cid, storage)
exhaustion.set(cid, storage, time)
exhaustion.make(cid, storage, time)
if exhaustion.check(cid, 666) == FALSE then
doPlayerSendCancel(cid, "You're already exhausted.")
return FALSE
end
local storage = 666
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You're exhaust time on storage: ".. storage .." is ".. exhaustion.get(cid, storage) .."")
exhaustion.set(cid, 666, 7)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've got 7 second of extra exhaust :)")
(if exhaustion.make(cid, 666, 7)) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've got 7 second of extra exhaust :)")
else
doPlayerSendCancel(cid, "You are already exhausted.")
end
if exhaustion.check(cid, 666) == TRUE then
doPlayerSendCancel(cid, "You are exhausted.")
return FALSE
end
-- Item usage
timeBetweenActions = 200
timeBetweenExActions = 1000
<rune name="Sudden Death" id="2268" allowfaruse="1" charges="7" lvl="20" maglv="15" exhaustion="1000" needtarget="1" blocktype="solid" event="script" value="attack/sudden death.lua"/>
attackspeed="1000"
exhaustion =
{
check = function (cid, storage)
local exhaust = getPlayerStorageValue(cid, storage)
if (os.time(t) >= exhaust) then
return FALSE
else
return TRUE
end
end,
get = function (cid, storage)
local exhaust = getPlayerStorageValue(cid, storage)
local left = exhaust - os.time(t)
if (left >= 0) then
return left
else
return FALSE
end
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 (exhaust > 0) then
return FALSE
else
exhaustion.set(cid, storage, time)
return TRUE
end
end
}