wladca
Member
How to add exhaust to this script for ex. ?
this is my lib file :
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddItem(cid, 2173, 1)
doPlayerSendTextMessage(cid, 19, "You've bought amulet of loss for 10000 gold coins.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
else
doPlayerSendCancel(cid, "Sorry, you need 10000 gold coins to buy amulet of loss.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return true
end
this is my lib file :
exhaustion =
{
check = function (cid, storage)
if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
return false
end
return getPlayerStorageValue(cid, storage) >= os.time(t)
end,
get = function (cid, storage)
if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) 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
}