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

Problems with the "first items"

Xaiman

New Member
Joined
Feb 27, 2010
Messages
94
Reaction score
0
Randomly players have stopped getting the first items when they first login to my server.

i have looked all around the forums but nothing has helped. I have plugged in many scripts and none work.

Code:
local firstItems = {}
firstItems[0] =
{
2173,
2525,
3965,
2124,
2457,
2647,
2643
}
firstItems[1] =
{
2173,
2525,
2124,
8820,
2649,
2643,
8819
}
firstItems[2] =
{
2173,
2525,
2124,
8820,
2649,
2643,
8819
}
firstItems[3] =
{
2173,
2525,
2124,
2460,
2649,
2643,
2660,
}
firstItems[4] =
{
2173,
2525,
2124,
2460,
2478,
2643,
2465
}

function onLogin(cid)
if getPlayerStorageValue(cid, 30001) == -1 then
for i = 1, table.maxn(firstItems[getPlayerVocation(cid)]) do
doPlayerAddItem(cid, firstItems[getPlayerVocation(cid)][i], 1)
end
local bag = doPlayerAddItem(cid, 10521, 1)
doAddContainerItem(bag, 2160, 2)
doAddContainerItem(bag, 2554, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 7618, 1)
setPlayerStorageValue(cid, 30001, 1)
end
return true
end

Code:
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>

I have no clue whats wrong. I gave the sample chars items also but when i reloged on them, the items were gone x.x
 
Try This instead :

Code:
local commonItems = {
    -- ITEMS ALL VOC RECEIVE
    {itemid=2457, count=1}, -- steel helmet
    {itemid=2463, count=1}, -- plate armor
    {itemid=2647, count=1}, -- plate legs
    {itemid=2160, count=5}, -- 5 crystal coin
    {itemid=2120, count=1}, -- rope
    {itemid=5710, count=1} -- shovel
}
 
local firstItems = {
    { -- SORC ITEMS
        {itemid=2190, count=1}, -- wand of vortex
        {itemid=2175, count=1}, -- spell book
        {itemid=2173, count=1} -- aol
    },
    { -- DRUID ITEMS
        {itemid=2182, count=1}, -- snakebite rod
        {itemid=2175, count=1}, -- spellbook
        {itemid=2173, count=1} -- aol
    },
    { -- PALADIN ITEMS
        {itemid=2175, count=1}, -- spell book
        {itemid=2389, count=30}, -- 30 spears
        {itemid=2173, count=1} -- aol
    },
    { -- KNIGHT ITEMS
        {itemid=2383, count=1}, -- spike sword
        {itemid=2518, count=1}, -- beholder shield
        {itemid=2175, count=1}, -- spell book
        {itemid=2173, count=1} -- aol
    }
}
 
for _, items in ipairs(firstItems) do
    for _, item in ipairs(commonItems) do
        table.insert(items, item)
    end
end
 
function onLogin(cid)
    if getPlayerGroupId(cid) < 2 then
        local hasReceivedFirstItems = getPlayerStorageValue(cid, 90808)
 
        if hasReceivedFirstItems ~= TRUE then
            --[[local backpack = ]]doPlayerAddItem(cid, 1988, TRUE)
 
            local giveItems = firstItems[getPlayerVocation(cid)]
 
            if giveItems ~= nil then
                for _, v in ipairs(giveItems) do
                    --doAddContainerItem(backpack, v.itemid, v.count or 1)
                    doPlayerAddItem(cid, v.itemid, v.count or 1)
                end
 
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You received your first items depending on your vocation.")
            end
            setPlayerStorageValue(cid, 90808, TRUE)
        end
    end
    return TRUE
end

Code:
<event type="login" name="FirstItems" script="firstitems.lua"/>
 
Last edited:
Back
Top