• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 0.X exhaustion problem

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

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
}
 
Your 034-exhaustion.lua is alright.
What is this script supposed to do? all I can see that it has 1 spare end which you should remove.
Try
LUA:
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
and you can try this 034-exhaustion.lua
LUA:
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
}
 
Your 034-exhaustion.lua is alright.
What is this script supposed to do? all I can see that it has 1 spare end which you should remove.
Try
LUA:
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
and you can try this 034-exhaustion.lua
LUA:
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
}
same error :S
 
[3:33:46.140] [Error - MoveEvents Interface]
[3:33:46.141] data/movements/scripts/powertp.lua:eek:nStepIn
[3:33:46.141] Description:
[3:33:46.141] data/lib/exhaustion.lua:4: field 'day' missing in date table
[3:33:46.142] stack traceback:
[3:33:46.142] [C]: in function 'time'
[3:33:46.142] data/lib/exhaustion.lua:4: in function 'check'
[3:33:46.143] data/movements/scripts/powertp.lua:20: in function <data/movements/scripts/powertp.lua:23>
 
Last edited:
Try this one and also update your database (while server offline)
LUA:
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) == true 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
 
Try this one and also update your database (while server offline)
LUA:
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) == true 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
same error
how i can update my database
 
Back
Top