Kawaki69
Member
- Joined
- Mar 4, 2022
- Messages
- 72
- Reaction score
- 8
I have this error in the console using tfs 1.4
Lua:
local config = {
rate = 1.5,
time = 1, -- Hours of Exp Time
storage = 20011,
exhauststorage = 9583,
exhausttime = 43200 -- time in seconds
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if exhaustion.check(cid, config.exhauststorage) then
local time = exhaustion.get(cid, config.exhauststorage)
local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)
if time >= 7200 then
text = ""..hours.." hours, "..minutes.." minutes and "..seconds.." seconds"
elseif time >= 3600 then
text = ""..hours.." hour, "..minutes.." minutes and "..seconds.." seconds"
elseif time >= 60 then
text = ""..minutes.." minutes and "..seconds.." seconds"
else
text = ""..seconds.." seconds"
end
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You need to wait "..text.." before you can use this again.")
return true
end
if(getPlayerStorageValue(cid, config.storage) < 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hour.")
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600)
addEvent(endExpRate, config.time * 3600 * 1000, cid)
doRemoveItem(item.uid, 1)
exhaustion.set(cid, config.exhauststorage, config.exhausttime)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
end
return TRUE
end
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/okdoky/exp_potion.lua:onUse
data/actions/scripts/okdoky/exp_potion.lua:17: attempt to index global 'exhaustion' (a nil value)
stack traceback:
[C]: in function '__index'
data/actions/scripts/okdoky/exp_potion.lua:17: in function <data/actions/scripts/okdoky/exp_potion.lua:15>