ConAn Edujawa
Member
- Joined
- Feb 23, 2015
- Messages
- 457
- Reaction score
- 17
i get this error when use this script
data/lib/034-exhaustion.lua:28: field 'day' missing in date table
im use 0.4
my 034-exhaustion.lua
data/lib/034-exhaustion.lua:28: field 'day' missing in date table
Code:
local function counts(name,time,pos)
local cid = getCreatureByName(name)
if cid then
if isPlayer(cid) then
doSendMagicEffect(getThingPos(cid), 32)
addEvent(counts,1000, name, time - 1, pos)
else
doTeleportThing(cid, {32723,322216,10}, true)
exhaustion.set(cid, 105847, 50*60)
end
else
doSendMagicEffect(getCreaturePosition(cid), 2)
end
return true
end
function onStepIn(cid, item, position, fromPosition)
if exhaustion.check(cid, 105847) then
local time = exhaustion.get(cid, 105847)
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 >= 3600 then
text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")
elseif time >= 120 then
text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")
else
text = seconds.." "..(seconds > 1 and "seconds" or "second")
end
doPlayerSendTextMessage(cid, 22, "You can not use this items so often, you will be able to use it again in "..text.." seconds.")
return true
end
counts(getCreatureName(cid),5)
end
return true
end
im use 0.4
my 034-exhaustion.lua
Code:
exhaustion =
{
check = function (cid, storage)
if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
return false
end
return getPlayerStorageValue(cid, storage) >= os.time()
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()
if(left >= 0) then
return left
end
end
return false
end,
set = function (cid, storage, time)
setPlayerStorageValue(cid, storage, os.time() + 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
}