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

Starter item fell down into the floor! rep++ for help

Mr. Anas

New Member
Joined
Mar 18, 2012
Messages
35
Reaction score
0
Hello dear friends,
I got a bug in my server, when player start.. Items fell down into the floor! Please try to help me....
Regards to J.Dre for publishing his script: Heres it, but it still..:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="2.0" author="J.Dre" contact="[email protected]" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		commonItems = {
			
			{itemid=2789, count=10, inContainer = true}, -- 10 brown mushrooms
			{itemid=2152, count=10, inContainer = true}, -- 10 platinum coins
			{itemid=2200, count=100}, -- protection amulet
			{itemid=2643} -- leather boots
		}
		firstItems = {
			{ -- Sorcerer	
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2190}, -- wand of vortex
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=2468}, -- studded legs
				{itemid=2265, count=3, inContainer=true} -- mana potion
			},
			{ -- Druid
				{itemid=1988}, -- backpack
{itemid=2160}, count=10, -- 50 crystal coin
				{itemid=2175}, -- spellbook
				{itemid=2182}, -- snakebite rod
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=2468}, -- studded legs
				{itemid=2276, count=3, inContainer=true} -- mana potion
			},
			{ -- Paladin
				{itemid=1988}, -- backpack
				{itemid=2456, count=1, useSlot=true, slotType=CONST_SLOT_LEFT}, -- bow
				{itemid=2544, count=100, useSlot=true, slotType=CONST_SLOT_LAST}, -- 100 arrow's
				{itemid=2660}, -- ranger's cloak
				{itemid=2481}, -- soldier helmet
				{itemid=8923}, -- ranger legs
				{itemid=2276, count=1, inContainer=true}, -- health potion
				{itemid=2276, count=2, inContainer=true} -- mana potion
			},
			{ -- Knight
				{itemid=1988}, -- backpack
				{itemid=2509}, -- steel shield
				{itemid=8602}, -- jagged sword
				{itemid=8601, inContainer=true}, -- steel axe
				{itemid=2439, inContainer=true}, -- daramanian mace
				{itemid=2465}, -- brass armor
				{itemid=2481}, -- soldier helmet
				{itemid=2478}, -- brass legs
				{itemid=2276, count=3, inContainer=true} -- health potion
			}
		}
	]]></config>
	<event type="login" name="FirstItems" event="script"><![CDATA[
		domodlib('firstitems_config')
 
		for _, items in ipairs(firstItems) do
			for _, item in ipairs(commonItems) do
				table.insert(items, item)
			end
		end
 
		function onLogin(cid)
			if(getPlayerAccess(cid) < 3  and firstItems[getPlayerVocation(cid)]) then
				for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
					if isItemContainer(v.itemid) then
						backpack = doPlayerAddItem(cid, v.itemid, 1, false)
					elseif v.inContainer then
						doAddContainerItem(backpack, v.itemid, v.count or 1)
					elseif v.useSlot then
						doPlayerAddItem(cid, v.itemid, v.count, false, v.slotType)
					elseif v.useMessage then
						local t, k = {
							writer = "Server Staff", date = os.time(),
							text = "Welcome " .. getCreatureName(cid) .. ".\n\nOur community would like to welcome you to " .. getConfigValue('serverName') .. ". If you need help with anything, please refer to the help channel.\n\nEnjoy your time!"
						}, doPlayerAddItem(cid, v.itemid, v.count or 1, false)
						doSetItemText(k, t.text, t.writer, t.date)
					else
						doPlayerAddItem(cid, v.itemid, v.count or 1)
					end
				end
			end
 
			return true
		end
	]]></event>
</mod>
Sincerely,
.............
 
I use it in creaturescripts this my script and u edit it this work good

in creaturescripts\scripts

put this firstitems.lua

Code:
  local commonItems = {
  -- ITEMS ALL VOCS RECEIVE
  {itemid=2120, count=1}, -- rope
  {itemid=5710, count=1}, -- shovel
  {itemid=2420, count=1}, -- machete
  {itemid=2157, count=100}, -- gold nuggets
  {itemid=2175, count=1}, -- spellbook
  {itemid=2789, count=10}, -- brown mushrooms
  {itemid=2173, count=1}, -- Aol
  {itemid=2261, count=1}, -- destroy field rune
}

local firstItems = {
  { -- SORC ITEMS
    {itemid=2323, count=1}, -- hat of the mad
    {itemid=8871, count=1}, -- focus cape
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=8902, count=1}, -- spellbook of mind control
    {itemid=2187, count=1}, -- wand of inferno 

    {itemid=2268, count=1}, -- sd
    {itemid=2298, count=1}, -- gmp
	{itemid=2273, count=1}, -- uh
    {itemid=2293, count=1}, -- mw
  },
  { -- DRUID ITEMS
    {itemid=2323, count=1}, -- hat of the mad
    {itemid=8871, count=1}, -- focus cape
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=8902, count=1}, -- spellbook of mind control
    {itemid=2183, count=1}, -- hailstorm rod  

    {itemid=2268, count=1}, -- sd
    {itemid=2298, count=1}, -- gmp
    {itemid=2293, count=1}, -- mw
    {itemid=2269, count=1}, -- wg
	{itemid=2273, count=1}, -- uh
    {itemid=2278, count=1}, -- para
  },
  { -- PALADIN ITEMS
    {itemid=2493, count=1}, -- demon helmet
    {itemid=8891, count=1}, -- paladin armor
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=2514, count=1}, -- mastermind shield
    {itemid=7368, count=1}, -- assassin stars

    {itemid=2268, count=1}, -- sd
    {itemid=2298, count=1}, -- gmp
    {itemid=8472, count=1}, -- gsp
    {itemid=7589, count=1}, -- smp
	{itemid=2273, count=1}, -- uh
    {itemid=7588, count=1}, -- shp
    {itemid=2293, count=1}, -- mw
  },
  { -- KNIGHT ITEMS
    {itemid=2493, count=1}, -- demon helmet
    {itemid=2472, count=1}, -- magic plate armor
    {itemid=2470, count=1}, -- golden legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=2514, count=1}, -- mastermind shield
    {itemid=2400, count=1}, -- magic sword

    {itemid=2298, count=1}, -- gmp
    {itemid=7591, count=1}, -- ghp
    {itemid=8473, count=1}, -- uhp
    {itemid=2273, count=1}, -- uh
    {itemid=2293, count=1}, -- mw
  }
}

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, 67708)

    if hasReceivedFirstItems ~= 1 then
      --[[local backpack = ]]doPlayerAddItem(cid, 1988, 1)

      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 have recieved your first items!")
      end
      setPlayerStorageValue(cid, 67708, 1)
    end
  end
  return TRUE
end

and in creaturescripts.xml put this

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


don't forget delete FirstItems mod hope this help You

sorry for my bad English
 
Back
Top