• 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 Problem firstitems.lua

Skibka

New Member
Joined
Jul 3, 2016
Messages
50
Solutions
1
Reaction score
1
[2:44:02.217] [Error - CreatureScript Interface]
[2:44:02.217] data/creaturescripts/scripts/firstitems.lua:eek:nLogin
[2:44:02.217] Description:
[2:44:02.217] data/creaturescripts/scripts/firstitems.lua:55: bad argument #1 to 'maxn' (table expected, got nil)
[2:44:02.217] stack traceback:
[2:44:02.217] [C]: in function 'maxn'
[2:44:02.217] data/creaturescripts/scripts/firstitems.lua:55: in function <data/creaturescripts/scripts/firstitems.lua:53>

here's my firstitems.lua script : http://pastebin.com/m9F8mFgb
 
Code:
local firstItems = {
    [1] = {2173, 2525, 2428, 2124, 2460, 2478, 2643},
    [2] = {2173, 2525, 2428, 2124, 2460, 2478, 2643},
    [3] = {2173, 2525, 2428, 2124, 2460, 2478, 2643},
    [4] = {2173, 2525, 2428, 2124, 2460, 2478, 2643}
}

local bagItems = {
    {id = 2160, amt = 1},
    {id = 2554, amt = 1},
    {id = 2120, amt = 1}, 
    {id = 7618, amt = 1},
    {id = 2383, amt = 1}
}

function onLogin(cid)
    if getPlayerStorageValue(cid, 30001) == -1 then
        local t = firstItems[getPlayerVocation(cid)]
        local bag = doPlayerAddItem(cid, 10518, 1)
        for i = 1, #t do
            doPlayerAddItem(cid, t[i])
        end
        for i = 1, #bagItems do
            doAddContainerItem(bag, bagItems[i].id, bagItems[i].amt)
        end
        doPlayerAddItem(cid, 2465, 1)
        setPlayerStorageValue(cid, 30001, 1)
    end
    return true
end
 
Back
Top