• 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!

Lua got bug on this script

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
Hello i got error on this script can someone please check it and maybe fix ;)

Script:
Code:
local t = {
    39002, {
    [20] = {2160, 5, "Congratulations, you have achieved one of four goals! You have been awarded with 5 crystal coints!", 1},
    [50] = {2160, 20, "Congratulations, you have achieved two of four goals! You have been awarded with 20 crystal coints!", 2},
    [80] = {2160, 35, "Congratulations, you have achieved three of four goals! You have been awarded with 35 crystal coints!", 3},
    [100] = {2160, 100, "Congratulations, you have achieved three of four goals! You have been awarded with 100 crystal coints!", 4},
    [150] = {2157, 2, "Congratulations, you have achieved three of four goals! You have been awarded with 2 Gold Nuggets!", 5},
    [180] = {12601, 10, "Congratulations, you have achieved three of four goals! You have been awarded with 10 Time Traveler Feathers!", 6},
    [200] = {6527, 100, "Congratulations, you have achieved three of four goals! You have been awarded with 100 Game Tokens!", 7},
    [250] = {7529, 1, "Congratulations, you have achieved three of four goals! You have been awarded with 3 hours experience boost paper!", 8},
    [300] = {2366, 1, "Congratulations, you have achieved all four goals! You have been awarded with 1 Stamina Feather!", 9}
    }
}
function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == SKILL__LEVEL then
        for level, v in pairs(t[2]) do
            if oldlevel < level and getPlayerLevel(cid) >= level and getPlayerStorageValue(cid, t[1]) < v[9] then
                doPlayerAddItem(cid, v[1], v[2])
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, v[3])
                setPlayerStorageValue(cid, t[1], v[9])
            end
        end
    end
    doPlayerSave(cid, true)
    return true
end





Code:
[10:45:45.816] [Error - CreatureScript Interface]
[10:45:45.816] data/creaturescripts/scripts/reward45.lua:onAdvance
[10:45:45.816] Description:
[10:45:45.816] data/creaturescripts/scripts/reward45.lua:17: attempt to compare number with nil
[10:45:45.816] stack traceback:
[10:45:45.816]  data/creaturescripts/scripts/reward45.lua:17: in function <data/creaturescripts/scripts/reward45.lua:14>
 
Change v[9] to v[4].
The numbers stand for the position in the table, so v[1] is the itemid, v[2] the count, v[3] the textmessage and v[4] the storagevalue. It only has 4 values in the table so v[9] is nil.
 
Back
Top