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

[MOD] First Items

bilmattan

evo-Online - Owner
Joined
Aug 5, 2008
Messages
1,316
Reaction score
11
Location
Sweden
Hello! I've been trying to do a first item that depends on what vocation but I can't get it to work.

Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		config = {
			storage = 30001,
			itemsdruid = {2182, 2382},
			itemssorc = {2190, 2382},
			itemspaly = {2389, 2382},
			itemsknight = {2395, 2382}
		}
	]]></config>
	<event type="login" name="FirstItems" event="buffer"><![CDATA[
		domodlib('firstitems_config')
		if(getPlayerStorageValue(cid, config.storage) > 0) then
			return
		end
		
		if(getPlayerVocation(cid) == 1) then
		for _, id in ipairs(config.itemsdruid) do
			doPlayerAddItem(cid, id, 1)
		end
		
		doAddContainerItem(doPlayerAddItem(cid, 2000, 1))
		setPlayerStorageValue(cid, config.storage, 1)
		end
		
		if(getPlayerVocation(cid) == 2) then
		for _, id in ipairs(config.itemssorc) do
			doPlayerAddItem(cid, id, 1)
		end
		
		doAddContainerItem(doPlayerAddItem(cid, 2000, 1))
		setPlayerStorageValue(cid, config.storage, 1)
		if(getPlayerVocation(cid) == 3) then
		for _, id in ipairs(config.itemspaly) do
			doPlayerAddItem(cid, id, 1)
		end
		
		doAddContainerItem(doPlayerAddItem(cid, 2000, 1))
		setPlayerStorageValue(cid, config.storage, 1)
		end
		
		if(getPlayerVocation(cid) == 4) then
		for _, id in ipairs(config.itemsknight) do
			doPlayerAddItem(cid, id, 1)
		end
		
		doAddContainerItem(doPlayerAddItem(cid, 2000, 1))
		setPlayerStorageValue(cid, config.storage, 1)
		end
	]]></event>
</mod>
 
well i got this from SWOT :d

Lua:
local commonItems = {
  -- ITEMS ALL VOCS RECEIVE
  {itemid=2120, count=1}, -- rope
  {itemid=5710, count=1}, -- shovel
  {itemid=2420, count=1}, -- machete
  {itemid=2789, count=100}, -- brown mushrooms
  {itemid=2305, count=1}, -- fire bomb rune
  {itemid=2261, count=1}, -- destroy field rune
  {itemid=2160, count=100}, -- Cc
}

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=2273, count=1}, -- uh
    {itemid=7590, count=1}, -- gmp
    {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=2273, count=1}, -- uh
    {itemid=7590, count=1}, -- gmp
    {itemid=2293, count=1}, -- mw
    {itemid=2269, count=1}, -- wg
    {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=2273, count=1}, -- uh
    {itemid=8472, count=1}, -- gsp
    {itemid=7589, count=1}, -- smp
    {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=7620, count=1}, -- mp
    {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) < 4 then
    local hasReceivedFirstItems = getPlayerStorageValue(cid, 1245687)

    if hasReceivedFirstItems ~= 1 then

      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! GoGoGoGoGoGo war!!!!")
      end
      setPlayerStorageValue(cid, 67708, 0)
    end
  end
  return TRUE
end
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		config = {
			storage = 30001,
			itemsdruid = {2182, 2382},
			itemssorc = {2190, 2382},
			itemspaly = {2389, 2382},
			itemsknight = {2395, 2382}
		}
	]]></config>
	<event type="login" name="FirstItems" event="buffer"><![CDATA[
		domodlib('firstitems_config')

		function onLogin(cid)
			if getPlayerStorageValue(cid, config.storage) > 0 then
				return true
			end
		
			for _, id in ipairs(isSorcerer(cid) and config.itemssorc or isDruid(cid) and config.itemsdruid or isPaladin(cid) and config.itemspaly or isKnight(cid) and config.itemsknight) do
				doPlayerAddItem(cid, id, 1)
			end
		
			doPlayerAddItem(cid, 2000, 1)
			setPlayerStorageValue(cid, config.storage, 1)

			return true
		end
	]]></event>
</mod>
or
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		STORAGE = 30001
		commonItems = {
			{itemid=2160, count=3, inContainer = true}, -- 2 platinum coins
			{itemid=2643} -- leather boots
		}
		firstItems = {
			{ -- Sorcerer	
				{itemid=1988}, -- backpack
				{itemid=2521}, -- dark shield
				{itemid=2190}, -- wand of vortex
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=7730}  -- blue legs
			},
			{ -- Druid
				{itemid=1988}, -- backpack
				{itemid=2521}, -- dark shield
				{itemid=2182}, -- snakebite rod
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=7730}  -- blue legs
			},
			{ -- Paladin
				{itemid=1988}, -- backpack
				{itemid=2521}, -- dark shield
				{itemid=2389, count=3}, -- 3 spears
				{itemid=2463}, -- plate armor
				{itemid=2457}, -- steel helmet
				{itemid=2647}  -- plate legs
			},
			{ -- Knight
				{itemid=1988}, -- backpack
				{itemid=2521}, -- dark shield
				{itemid=2394}, -- morning star
				{itemid=2463}, -- plate armor
				{itemid=2457}, -- steel helmet
				{itemid=2647}  -- plate legs
			}
		}
	]]></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 getPlayerGroupId(cid) < 4 and getPlayerStorageValue(cid, STORAGE) < 1 and firstItems[getPlayerVocation(cid)] then
				for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
					if isItemContainer(v.itemid) then
						backpack = doPlayerAddItem(cid, v.itemid, 1)
					elseif v.inContainer then
						doAddContainerItem(backpack, v.itemid, v.count or 1)
					else
						doPlayerAddItem(cid, v.itemid, v.count or 1)
					end
				end
				setPlayerStorageValue(cid, STORAGE, 1)
			end
			return true
		end
	]]></event>
</mod>
 
well i got this from SWOT :d

Lua:
local commonItems = {
  -- ITEMS ALL VOCS RECEIVE
  {itemid=2120, count=1}, -- rope
  {itemid=5710, count=1}, -- shovel
  {itemid=2420, count=1}, -- machete
  {itemid=2789, count=100}, -- brown mushrooms
  {itemid=2305, count=1}, -- fire bomb rune
  {itemid=2261, count=1}, -- destroy field rune
  {itemid=2160, count=100}, -- Cc
}

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=2273, count=1}, -- uh
    {itemid=7590, count=1}, -- gmp
    {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=2273, count=1}, -- uh
    {itemid=7590, count=1}, -- gmp
    {itemid=2293, count=1}, -- mw
    {itemid=2269, count=1}, -- wg
    {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=2273, count=1}, -- uh
    {itemid=8472, count=1}, -- gsp
    {itemid=7589, count=1}, -- smp
    {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=7620, count=1}, -- mp
    {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) < 4 then
    local hasReceivedFirstItems = getPlayerStorageValue(cid, 1245687)

    if hasReceivedFirstItems ~= 1 then

      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! GoGoGoGoGoGo war!!!!")
      end
      setPlayerStorageValue(cid, 67708, 0)
    end
  end
  return TRUE
end

Wasn't too much help but thanks for trying :) rep+


Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		config = {
			storage = 30001,
			itemsdruid = {2182, 2382},
			itemssorc = {2190, 2382},
			itemspaly = {2389, 2382},
			itemsknight = {2395, 2382}
		}
	]]></config>
	<event type="login" name="FirstItems" event="buffer"><![CDATA[
		domodlib('firstitems_config')

		function onLogin(cid)
			if getPlayerStorageValue(cid, config.storage) > 0 then
				return true
			end
		
			for _, id in ipairs(isSorcerer(cid) and config.itemssorc or isDruid(cid) and config.itemsdruid or isPaladin(cid) and config.itemspaly or isKnight(cid) and config.itemsknight) do
				doPlayerAddItem(cid, id, 1)
			end
		
			doPlayerAddItem(cid, 2000, 1)
			setPlayerStorageValue(cid, config.storage, 1)

			return true
		end
	]]></event>
</mod>
or
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		STORAGE = 30001
		commonItems = {
			{itemid=2160, count=3, inContainer = true}, -- 2 platinum coins
			{itemid=2643} -- leather boots
		}
		firstItems = {
			{ -- Sorcerer	
				{itemid=1988}, -- backpack
				{itemid=2521}, -- dark shield
				{itemid=2190}, -- wand of vortex
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=7730}  -- blue legs
			},
			{ -- Druid
				{itemid=1988}, -- backpack
				{itemid=2521}, -- dark shield
				{itemid=2182}, -- snakebite rod
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=7730}  -- blue legs
			},
			{ -- Paladin
				{itemid=1988}, -- backpack
				{itemid=2521}, -- dark shield
				{itemid=2389, count=3}, -- 3 spears
				{itemid=2463}, -- plate armor
				{itemid=2457}, -- steel helmet
				{itemid=2647}  -- plate legs
			},
			{ -- Knight
				{itemid=1988}, -- backpack
				{itemid=2521}, -- dark shield
				{itemid=2394}, -- morning star
				{itemid=2463}, -- plate armor
				{itemid=2457}, -- steel helmet
				{itemid=2647}  -- plate legs
			}
		}
	]]></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 getPlayerGroupId(cid) < 4 and getPlayerStorageValue(cid, STORAGE) < 1 and firstItems[getPlayerVocation(cid)] then
				for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
					if isItemContainer(v.itemid) then
						backpack = doPlayerAddItem(cid, v.itemid, 1)
					elseif v.inContainer then
						doAddContainerItem(backpack, v.itemid, v.count or 1)
					else
						doPlayerAddItem(cid, v.itemid, v.count or 1)
					end
				end
				setPlayerStorageValue(cid, STORAGE, 1)
			end
			return true
		end
	]]></event>
</mod>

Using the second one and I have to say "THANKS YOU" <'3 REP+
 
Back
Top