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

First items

Na Amigo

The crazy girl
Joined
Jun 5, 2017
Messages
254
Solutions
3
Reaction score
17
Location
Egypt
i want fix this script i want to put the runes at the bag it's not working i'm using The Forgotten Server 0.4 8.6
here is first items creaturescripts
Code:
<event type="login" name="FirstItems" event="script" value="first items.lua"/>
Code:
local SORCERER = 1
local DRUID = 2
local PALADIN = 3
local KNIGHT = 4
local items =
{
    [SORCERER] =
    {
         {item=1988, count=1}, -- backpack
        {item=2457, count=1}, --helmet
        {item=2173, count=1}, -- an amulet (for test purpose)
         {item=2121, count=1}, -- ring
         {item=2190, count=1}, -- staff
         {item=2361, count=1}, --frozen
         {item=2514, count=1}, ---shield
         {item=2463, count=1}, ---armor
         {item=2647, count=1}, ---legs
         {item=2195, count=1}, ---boots
         {item=2195, count=100} ---cc
     
         container = doPlayerAddItem(cid, 1988, 1) ----bag
         doAddContainerItem(container, 2273, 1) ----rune
          doAddContainerItem(container, 2280, 1) ----rune
           doAddContainerItem(container, 2263, 1) ----rune
            doAddContainerItem(container, 2278, 1) ----rune
             doAddContainerItem(container, 2269, 1) ----rune
              doAddContainerItem(container, 2293, 1) ----rune
               doAddContainerItem(container, 2305, 1) ----rune
                doAddContainerItem(container, 2303, 1) ----rune
                 doAddContainerItem(container, 2301, 1) ----rune
                  doAddContainerItem(container, 2304, 1) ----rune
                   doAddContainerItem(container, 2308, 1) ----rune
                    doAddContainerItem(container, 2389, 1) ----rune
                     doAddContainerItem(container, 2286, 1) ----rune
                      doAddContainerItem(container, 2285, 1) ----rune
                       doAddContainerItem(container, 2279, 1) ----rune
                        doAddContainerItem(container, 2277, 1) ----rune
                         doAddContainerItem(container, 2262, 1) ----rune
                          doAddContainerItem(container, 2261, 1) ----rune
               
         
    },
    [DRUID] =
    {
        {item=1988, count=1}, -- backpack
        {item=2457, count=1}, --helmet
        {item=2173, count=1}, -- an amulet (for test purpose)
         {item=2121, count=1}, -- ring
         {item=2183, count=1}, -- staff
         {item=2361, count=1}, --frozen
         {item=2514, count=1}, ---shield
         {item=2463, count=1}, ---armor
         {item=2647, count=1}, ---legs
         {item=2195, count=1}, ---boots
         {item=2195, count=100} ---cc
     
          container = doPlayerAddItem(cid, 1988, 1) ----bag
         doAddContainerItem(container, 2273, 1) ----rune
          doAddContainerItem(container, 2280, 1) ----rune
           doAddContainerItem(container, 2263, 1) ----rune
            doAddContainerItem(container, 2278, 1) ----rune
             doAddContainerItem(container, 2269, 1) ----rune
              doAddContainerItem(container, 2293, 1) ----rune
               doAddContainerItem(container, 2305, 1) ----rune
                doAddContainerItem(container, 2303, 1) ----rune
                 doAddContainerItem(container, 2301, 1) ----rune
                  doAddContainerItem(container, 2304, 1) ----rune
                   doAddContainerItem(container, 2308, 1) ----rune
                    doAddContainerItem(container, 2389, 1) ----rune
                     doAddContainerItem(container, 2286, 1) ----rune
                      doAddContainerItem(container, 2285, 1) ----rune
                       doAddContainerItem(container, 2279, 1) ----rune
                        doAddContainerItem(container, 2277, 1) ----rune
                         doAddContainerItem(container, 2262, 1) ----rune
                          doAddContainerItem(container, 2261, 1) ----rune
    },
    [PALADIN] =
    {
        {item=1988, count=1}, -- backpack
        {item=2457, count=1}, --helmet
        {item=2173, count=1}, -- an amulet (for test purpose)
         {item=2121, count=1}, -- ring
         {item=5803, count=1}, -- bolt
          {item=2455, count=1}, -- bolt
         {item=2361, count=1}, --frozen
         {item=2514, count=1}, ---shield
         {item=2463, count=1}, ---armor
         {item=2195, count=1}, ---boots
         {item=2647, count=1}, ---legs
         {item=2195, count=100} ---cc

          container = doPlayerAddItem(cid, 1988, 1) ----bag
         doAddContainerItem(container, 2273, 1) ----rune
          doAddContainerItem(container, 2280, 1) ----rune
           doAddContainerItem(container, 2263, 1) ----rune
            doAddContainerItem(container, 2278, 1) ----rune
             doAddContainerItem(container, 2269, 1) ----rune
              doAddContainerItem(container, 2293, 1) ----rune
               doAddContainerItem(container, 2305, 1) ----rune
                doAddContainerItem(container, 2303, 1) ----rune
                 doAddContainerItem(container, 2301, 1) ----rune
                  doAddContainerItem(container, 2304, 1) ----rune
                   doAddContainerItem(container, 2308, 1) ----rune
                    doAddContainerItem(container, 2389, 1) ----rune
                     doAddContainerItem(container, 2286, 1) ----rune
                      doAddContainerItem(container, 2285, 1) ----rune
                       doAddContainerItem(container, 2279, 1) ----rune
                        doAddContainerItem(container, 2277, 1) ----rune
                         doAddContainerItem(container, 2262, 1) ----rune
                          doAddContainerItem(container, 2261, 1) ----rune
    },
    [KNIGHT] =
    {
       {item=1988, count=1}, -- backpack
        {item=2457, count=1}, --helmet
        {item=2173, count=1}, -- an amulet (for test purpose)
         {item=2121, count=1}, -- ring
         {item=2451, count=1}, -- sword
         {item=2361, count=1}, --frozen
         {item=2514, count=1}, ---shield
         {item=2463, count=1}, ---armor
         {item=2195, count=1}, ---boots
         {item=2647, count=1}, ---legs
         {item=2195, count=100} ---cc
      
          container = doPlayerAddItem(cid, 1988, 1) ----bag
         doAddContainerItem(container, 2273, 1) ----rune
          doAddContainerItem(container, 2280, 1) ----rune
           doAddContainerItem(container, 2263, 1) ----rune
            doAddContainerItem(container, 2278, 1) ----rune
             doAddContainerItem(container, 2269, 1) ----rune
              doAddContainerItem(container, 2293, 1) ----rune
               doAddContainerItem(container, 2305, 1) ----rune
                doAddContainerItem(container, 2303, 1) ----rune
                 doAddContainerItem(container, 2301, 1) ----rune
                  doAddContainerItem(container, 2304, 1) ----rune
                   doAddContainerItem(container, 2308, 1) ----rune
                    doAddContainerItem(container, 2389, 1) ----rune
                     doAddContainerItem(container, 2286, 1) ----rune
                      doAddContainerItem(container, 2285, 1) ----rune
                       doAddContainerItem(container, 2279, 1) ----rune
                        doAddContainerItem(container, 2277, 1) ----rune
                         doAddContainerItem(container, 2262, 1) ----rune
                          doAddContainerItem(container, 2261, 1) ----rune
      
      
    }
}
function onLogin(cid)
    local vocation = items[getPlayerVocation(cid)]
    if(not vocation) then
        return true
    end
 
    local storage = getPlayerStorageValue(cid, 30001)
    if(storage > 0) then
        return true
    end
 
    for _, voc in ipairs(vocation) do
        doPlayerAddItem(cid, voc.item, voc.count)
    end
 
    setPlayerStorageValue(cid, 30001, 1)
     return true
end
here is the error
Code:
[Error - LuaInterface::loadFile] data/creaturescripts/scripts/first items.lua:22: '}' expected (to close '{' at line 9) near 'container'
[13:8:31.567] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/first items.lua)
[13:8:31.572] data/creaturescripts/scripts/first items.lua:22: '}' expected (to close '{' at line 9) near 'container'
 
Last edited:
Solution
Code:
function onLogin(cid)
    if getPlayerGroupId(cid) == 1 and getPlayerStorageValue(cid, 50002) == -1 then
        if isSorcerer(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- yellow bag
            doAddContainerItem(bag, 2120, 1) -- Rope
       

            doPlayerAddItem(cid, 2490, 1) -- dark helmet


        setPlayerStorageValue(cid, 50002, 1)

        elseif isDruid(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- rope
            doAddContainerItem(bag, 2120, 1) -- yellow bag
       
            doPlayerAddItem(cid, 2175, 1) -- spellbook


            setPlayerStorageValue(cid, 50002, 1)...
Could you please try to read what does the error says?
Because i can.
that's appear at the console idk what is
Code:
[Error - LuaInterface::loadFile] data/creaturescripts/scripts/first items.lua:22: '}' expected (to close '{' at line 9) near 'container'
[13:38:34.619] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/first items.lua)
[13:38:34.624] data/creaturescripts/scripts/first items.lua:22: '}' expected (to close '{' at line 9) near 'container'
 
that's appear at the console idk what is
Code:
[Error - LuaInterface::loadFile] data/creaturescripts/scripts/first items.lua:22: '}' expected (to close '{' at line 9) near 'container'
[13:38:34.619] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/first items.lua)
[13:38:34.624] data/creaturescripts/scripts/first items.lua:22: '}' expected (to close '{' at line 9) near 'container'
I'm really trying to help you. So again, can you please read what the error are saying?
 
Not inside the table. You can add a specific tag in the table as container, adding more it3ms like the normal ones. And loop through it
 
Code:
function onLogin(cid)
    if getPlayerGroupId(cid) == 1 and getPlayerStorageValue(cid, 50002) == -1 then
        if isSorcerer(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- yellow bag
            doAddContainerItem(bag, 2120, 1) -- Rope
       

            doPlayerAddItem(cid, 2490, 1) -- dark helmet


        setPlayerStorageValue(cid, 50002, 1)

        elseif isDruid(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- rope
            doAddContainerItem(bag, 2120, 1) -- yellow bag
       
            doPlayerAddItem(cid, 2175, 1) -- spellbook


            setPlayerStorageValue(cid, 50002, 1)

        elseif isPaladin(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- rope
            doAddContainerItem(bag, 2120, 1) -- yellow bag
       
            doPlayerAddItem(cid, 2389, 1) -- spear


            setPlayerStorageValue(cid, 50002, 1)

        elseif isKnight(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- rope
            doAddContainerItem(bag, 8601, 1) -- steel axe
            doAddContainerItem(bag, 2120, 1) -- yellow bag
       

            doPlayerAddItem(cid, 2463, 1) -- p armor

            setPlayerStorageValue(cid, 50002, 1)
        end
    end
     return TRUE
end
 
Solution
Code:
function onLogin(cid)
    if getPlayerGroupId(cid) == 1 and getPlayerStorageValue(cid, 50002) == -1 then
        if isSorcerer(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- yellow bag
            doAddContainerItem(bag, 2120, 1) -- Rope
      

            doPlayerAddItem(cid, 2490, 1) -- dark helmet


        setPlayerStorageValue(cid, 50002, 1)

        elseif isDruid(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- rope
            doAddContainerItem(bag, 2120, 1) -- yellow bag
      
            doPlayerAddItem(cid, 2175, 1) -- spellbook


            setPlayerStorageValue(cid, 50002, 1)

        elseif isPaladin(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- rope
            doAddContainerItem(bag, 2120, 1) -- yellow bag
      
            doPlayerAddItem(cid, 2389, 1) -- spear


            setPlayerStorageValue(cid, 50002, 1)

        elseif isKnight(cid) then
            local bag = doPlayerAddItem(cid, 1988, 1)
            doAddContainerItem(bag, 2120, 1) -- rope
            doAddContainerItem(bag, 8601, 1) -- steel axe
            doAddContainerItem(bag, 2120, 1) -- yellow bag
      

            doPlayerAddItem(cid, 2463, 1) -- p armor

            setPlayerStorageValue(cid, 50002, 1)
        end
    end
     return TRUE
end
worked thank you man
 
Back
Top