• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

ERROR EVENT TIME

alkenizs

New Member
Joined
Mar 27, 2022
Messages
20
Reaction score
4
What can this error be happening in the function?

tfs1.3

Lua:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/lib/lever.lua:131: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        data/lib/lever.lua:131: in function <data/lib/lever.lua:122>

script

Lua:
                        local addItem
                        if owner then
    line 131            addItem = doPlayerAddItem(owner, rewardId, obj.items[rewardId].count or 1)
                            if addItem and obj.items[rewardId].period then
                                doItemSetDuration(addItem, obj.items[rewardId].period)
                            end
                            local rewardStr = (obj.items[rewardId].count or 1) .. 'x ' .. getItemInfo(rewardId).name
                            doPlayerSendTextMessage(owner, MESSAGE_INFO_DESCR, 'Parabéns, você encontrou ' .. rewardStr .. '.')
                            if not obj.discardLog then
    local file = io.open("data/logs/legend_drops_rolled.log")
    if not file then
        return
    end
    io.output(file)
    io.write(logFormat:format(os.date("%d/%m/%Y %H:%M"), words, param):trim() .. "\n")
    io.close(file)
end

can anyone help?
 

jakub742

Member
Joined
May 1, 2010
Messages
110
Solutions
2
Reaction score
8
Location
Slovakia
check the values of those parameters in doPlayerAddItem before calling if something is not null. rewardId is an index in table ?
If ure using tfs 1.3 use player:addItem(itemId[, count = 1[, canDropOnMap = true[, subType = 1[, slot = CONST_SLOT_WHEREEVER]]]])
rather than old compat method.
 
Top