• 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 how to make firstitems?

lordad

New Member
Joined
May 13, 2008
Messages
61
Reaction score
1
new players login without anyitem
how can i fix that ??
and can someone upload his own firstitems.lua and i can follow ?

10.37
 
Here is the one i use, it is easily editable:

Code:
local storage = 87777
function onLogin(cid)
   local config = {
     voc_items = {
       { -- SORC
         {2190}, -- wand of vortex
       },
       { -- DRUID
         {2182}, -- snakebite rod
       },
       { -- PALADIN
         {2410}, -- throwing knife
       },
       { -- KNIGHT
         {8602}, -- jagged sword
       }
     },
     all_items = {
       {2478}, -- brass legs
       {2643} -- leather boots
       {2465} -- brass armor
       {2509} -- steel shield
       {2480}, -- legion helmet
     },
     extra_items = {
       {2789, 15},
       {2120},
       {2554}
     },
     knight_weapons = {
       {2439}, -- daramanian mace
       {8601} -- steel axe
     }
   }
   if getPlayerGroupId(cid) < 3 then
     if getPlayerStorageValue(cid, storage) == -1 then
       local common = config.voc_items[getPlayerVocation(cid)]
       if common ~= nil then
         for _, v in ipairs(common) do
           doPlayerAddItem(cid, v[1], v[2] or 1)
         end
       end
       
       local all = config.all_items
       if all ~= nil then
         for _, v in ipairs(all) do
           doPlayerAddItem(cid, v[1], v[2] or 1)
         end
       end
       
       local extra = config.extra_items
       local bp = doPlayerAddItem(cid, 1988, 1)
       if extra ~= nil then
         for _, v in ipairs(extra) do
           doAddContainerItem(bp, v[1], v[2] or 1)
         end
       end
       
       local weapons = config.knight_weapons
       if weapons ~= nil then
         for _, w in ipairs(weapons) do
           if isKnight(cid) then
             doAddContainerItem(bp, w[1], w[2] or 1)
           end
         end
       end
       
       setPlayerStorageValue(cid, storage, 1)
     end
   end
   return true
end
 
this is applyable on 10.37 files ?

Code:
local firstItems = {2050, 2382}

function onLogin(cid)
    local player = Player(cid)
    if player:getLastLoginSaved() <= 0 then
        for i = 1, #firstItems do
            player:addItem(firstItems[i], 1)
        end
        player:addItem(player:getSex() == 0 and 2651 or 2650, 1)
        player:addItem(1987, 1)
        player:addItem(2674, 1)
    end
    return true
end
 
Last edited by a moderator:
Code:
local firstItems = {2050, 2382}

function onLogin(cid)
    local player = Player(cid)

    if player:getLastLoginSaved() == 0 then
        for i = 1, #firstItems do
            player:addItem(firstItems[i], 1)
        end
        player:addItem(player:getSex() == 0 and 2651 or 2650, 1)
        player:addItem(1987, 1):addItem(2674, 1)
    end

    return true
end
 
:D ?

i edited it but still no change players start with no items ! :/

also do i need to edit this ?

Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <!-- Elemental Spheres Quest -->
    <event type="kill" name="elementalspheresquestOverlords" script="elemental spheres quest/ElementalSpheresQuestKillOverlords.lua"/>

    <!-- Bigfoot Burden Quest -->
    <event type="kill" name="bigfootBurdenQuestVesperoth" script="bigfoot burden quest/bigfootBurdenQuestVesperoth.lua"/>
    <event type="kill" name="bigfootBurdenQuestWarzone" script="bigfoot burden quest/bigfootBurdenQuestWarzone.lua"/>
    <event type="kill" name="bigfootBurdenQuestWeeper" script="bigfoot burden quest/bigfootBurdenQuestWeeper.lua"/>
    <event type="kill" name="bigfootBurdenQuestWiggler" script="bigfoot burden quest/bigfootBurdenQuestWiggler.lua"/>

    <!-- Svargrond Arena Quest -->
    <event type="kill" name="SvargrondArenaKill" script="svargrond arena quest/arena_kill.lua"/>
   
    <!-- Boss Summoning -->
    <!--<event type="kill" name="bossSummoning" script="boss summoning/bossSummoning.lua"/>-->
   
    <!-- In Service Of Yalahar Quest -->
    <event type="kill" name="inServiceOfYalaharQuestsDiseased" script="in service of yalahar quest/inServiceOfYalaharQuestsDiseased.lua"/>
    <event type="kill" name="inServiceOfYalaharQuestsMorik" script="in service of yalahar quest/inServiceOfYalaharQuestsMorik.lua"/>
    <event type="kill" name="inServiceOfYalaharQuestsQuara" script="in service of yalahar quest/inServiceOfYalaharQuestsQuara.lua"/>
   
    <!-- Inquisition Quest -->
    <event type="kill" name="inquisitionQuestBosses" script="inquisition quest/inquisitionQuestBosses.lua"/>
    <event type="kill" name="inquisitionQuestUngreez" script="inquisition quest/inquisitionQuestUngreez.lua"/>
   
    <!-- Killing In The Name Of Quest -->
    <event type="kill" name="killingInTheNameOfQuestKills" script="killing in the name of quest/killingInTheNameOfQuestKills.lua"/>
   
    <!-- The Masters Voice Quest -->
    <event type="kill" name="masterVoiceQuest" script="their master's voice quest/masterVoiceQuest.lua"/>
   
    <!-- Storage Conversion -->
    <event type="login" name="StorageConversion" script="others/StorageConversion.lua"/>

    <!-- Others -->
    <event type="login" name="PlayerLogin" script="others/login.lua"/>
    <event type="death" name="PlayerDeath" script="others/playerdeath.lua"/>
    <event type="advance" name="AdvanceSave" script="others/advance_save.lua"/>

    <event type="extendedopcode" name="ExtendedOpcode" script="others/extendedopcode.lua"/>

</creaturescripts>
 
Last edited by a moderator:
Yes, you also have to add it there.
Code:
<event type="login" name="FirstItems" script="others/firstitems.lua"/>
 
Back
Top