• 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 a problem, please check

4Muki4

HOROHOROHORO
Joined
May 1, 2012
Messages
757
Reaction score
72
Dear Members,

i installed today J.Dre's frist items but comes an console error Here it is:
Code:
[16/08/2012 07:40:13] [Error - CreatureScript Interface] 
[16/08/2012 07:40:13] buffer
[16/08/2012 07:40:13] Description: 
[16/08/2012 07:40:13] [string "		commonItems = {..."]:5: '}' expected (to close '{' at line 1) near '{'

[16/08/2012 07:40:13] [Error - CreatureScript Interface] 
[16/08/2012 07:40:13] buffer
[16/08/2012 07:40:13] Description: 
[16/08/2012 07:40:13] [string "loadBuffer"]:3: bad argument #1 to 'ipairs' (table expected, got nil)
[16/08/2012 07:40:13] [Warning - Event::loadScript] Cannot load script (		domodlib('firstitems_config')
[16/08/2012 07:40:13]  
[16/08/2012 07:40:13] 		for _, items in ipairs(firstItems) do
[16/08/2012 07:40:13] 			for _, item in ipairs(commonItems) do
[16/08/2012 07:40:13] 				table.insert(items, item)
[16/08/2012 07:40:13] 			end
[16/08/2012 07:40:13] 		end
[16/08/2012 07:40:13]  
[16/08/2012 07:40:13] 		function onLogin(cid)
[16/08/2012 07:40:13] 			if(getPlayerAccess(cid) < 3 and (getPlayerLastLoginSaved(cid) < 1) and firstItems[getPlayerVocation(cid)]) then
[16/08/2012 07:40:13] 				for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
[16/08/2012 07:40:13] 					if isItemContainer(v.itemid) then
[16/08/2012 07:40:13] 						backpack = doPlayerAddItem(cid, v.itemid, 1, false)
[16/08/2012 07:40:13] 					elseif v.inContainer then
[16/08/2012 07:40:13] 						doAddContainerItem(backpack, v.itemid, v.count or 1)
[16/08/2012 07:40:13] 					elseif v.useSlot then
[16/08/2012 07:40:13] 						doPlayerAddItem(cid, v.itemid, v.count, false, v.slotType)
[16/08/2012 07:40:13] 					elseif v.useMessage then
[16/08/2012 07:40:13] 						local t, k = {
[16/08/2012 07:40:13] 							writer = "Server Staff", date = os.time(),
[16/08/2012 07:40:13] 							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!"
[16/08/2012 07:40:13] 						}, doPlayerAddItem(cid, v.itemid, v.count or 1, false)
[16/08/2012 07:40:13] 						doSetItemText(k, t.text, t.writer, t.date)
[16/08/2012 07:40:13] 					else
[16/08/2012 07:40:13] 						doPlayerAddItem(cid, v.itemid, v.count or 1)
[16/08/2012 07:40:13] 					end
[16/08/2012 07:40:13] 				end
[16/08/2012 07:40:13] 			end
[16/08/2012 07:40:13]  
[16/08/2012 07:40:13] 			return true
[16/08/2012 07:40:13] 		end
[16/08/2012 07:40:13] 	)

rep++ of course

- - - Updated - - -

Script:

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=2643} -- leather boots
  			{itemid=2305, count=1, inContainer = true}, -- fire bomb rune
  			{itemid=2261, count=1, inContainer = true}, -- destroy field rune
    			{itemid=2120, count=1, inContainer = true}, -- rope
   		        {itemid=5710, count=1, inContainer = true}, -- shovel
		}
		firstItems = {
			{ -- Sorcerer	
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2187}, -- wand of inferno
				{itemid=8819}, -- magician's robe
				{itemid=2457}, -- steel helemet
				{itemid=2463}, -- plate legs
				{itemid=2268, count=1, inContainer=true} -- sd
				{itemid=2293, count=1, inContainer=true} -- mw
				{itemid=7590, count=1, inContainer=true} -- gmp
				{itemid=2274, count=1, inContainer=true} -- ava
			},
			{ -- Druid
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2183}, -- hailstrom rod
				{itemid=8819}, -- magician's robe
				{itemid=2457}, -- steel helemet
				{itemid=2463}, -- plate legs
				{itemid=2268, count=1, inContainer=true} -- sd
				{itemid=2293, count=1, inContainer=true} -- mw
				{itemid=2269, count=1, inContainer=true} -- wg
				{itemid=7590, count=1, inContainer=true} -- gmp
				{itemid=2274, count=1, inContainer=true} -- ava
			},
			{ -- Paladin
				{itemid=1988}, -- backpack
				{itemid=2399}, -- star
				{itemid=2660}, -- ranger's cloak
				{itemid=2481}, -- soldier helmet
				{itemid=8923}, -- ranger legs
				{itemid=8472, count=1, inContainer=true}, -- Great spirit Potion
				{itemid=7589, count=1, inContainer=true} -- strong mana potion
				{itemid=2268, count=1, inContainer=true} -- sd
				{itemid=2293, count=1, inContainer=true} -- mw
				{itemid=7620, count=1, inContainer=true} -- mp
			},
			{ -- Knight
				{itemid=1988}, -- backpack
				{itemid=2509}, -- steel shield
				{itemid=2400}, -- magic sword
				{itemid=2465}, -- brass armor
				{itemid=2481}, -- soldier helmet
				{itemid=2478}, -- brass legs
				{itemid=8473, count=1, inContainer=true} -- uhp
				{itemid=2293, count=1, inContainer=true} -- mw
				{itemid=7620, count=1, inContainer=true} -- mp
			}
		}
	]]></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 (getPlayerLastLoginSaved(cid) < 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, 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>
 
Ok.

Test

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=2305, count=1, inContainer = true}, -- fire bomb rune
  			{itemid=2261, count=1, inContainer = true}, -- destroy field rune
    		{itemid=2120, count=1, inContainer = true}, -- rope
   		    {itemid=5710, count=1, inContainer = true}, -- shovel
			{itemid=2643} -- leather boots
		}
		firstItems = {
			{ -- Sorcerer	
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2187}, -- wand of inferno
				{itemid=8819}, -- magician's robe
				{itemid=2457}, -- steel helemet
				{itemid=2463}, -- plate legs
				{itemid=2268, count=1, inContainer=true}, -- sd
				{itemid=2293, count=1, inContainer=true}, -- mw
				{itemid=7590, count=1, inContainer=true}, -- gmp
				{itemid=2274, count=1, inContainer=true} -- ava
			},
			{ -- Druid
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2183}, -- hailstrom rod
				{itemid=8819}, -- magician's robe
				{itemid=2457}, -- steel helemet
				{itemid=2463}, -- plate legs
				{itemid=2268, count=1, inContainer=true}, -- sd
				{itemid=2293, count=1, inContainer=true}, -- mw
				{itemid=2269, count=1, inContainer=true}, -- wg
				{itemid=7590, count=1, inContainer=true}, -- gmp
				{itemid=2274, count=1, inContainer=true} -- ava
			},
			{ -- Paladin
				{itemid=1988}, -- backpack
				{itemid=2399}, -- star
				{itemid=2660}, -- ranger's cloak
				{itemid=2481}, -- soldier helmet
				{itemid=8923}, -- ranger legs
				{itemid=8472, count=1, inContainer=true}, -- Great spirit Potion
				{itemid=7589, count=1, inContainer=true}, -- strong mana potion
				{itemid=2268, count=1, inContainer=true}, -- sd
				{itemid=2293, count=1, inContainer=true}, -- mw
				{itemid=7620, count=1, inContainer=true} -- mp
			},
			{ -- Knight
				{itemid=1988}, -- backpack
				{itemid=2509}, -- steel shield
				{itemid=2400}, -- magic sword
				{itemid=2465}, -- brass armor
				{itemid=2481}, -- soldier helmet
				{itemid=2478}, -- brass legs
				{itemid=8473, count=1, inContainer=true}, -- uhp
				{itemid=2293, count=1, inContainer=true}, -- mw
				{itemid=7620, count=1, inContainer=true} -- mp
			}
		}
	]]></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 (getPlayerLastLoginSaved(cid) < 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, 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>
 
its working 50%, you get items BUT not bp and items what should be in backpack


[16/08/2012 14:50:39] [Error - CreatureScript Interface]
[16/08/2012 14:50:39] buffer:onLogin
[16/08/2012 14:50:39] Description:
[16/08/2012 14:50:39] (luaDoAddContainerItem) Container not found
 
Not sure, but, i made some changes.. It's weird why is receiving only Container not found. Dont have any more problem?

Check

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=2305, count=1, inContainer = true}, -- fire bomb rune
  			{itemid=2261, count=1, inContainer = true}, -- destroy field rune
			{itemid=2293, count=1, inContainer = true}, -- mw
    		{itemid=2120, count=1, inContainer = true}, -- rope
   		    {itemid=5710, count=1, inContainer = true}, -- shovel
			{itemid=2643} -- leather boots
		}
		firstItems = {
			{ -- Sorcerer	
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2187}, -- wand of inferno
				{itemid=8819}, -- magician's robe
				{itemid=2457}, -- steel helemet
				{itemid=2463}, -- plate legs
				{itemid=2268, count=1, inContainer=true}, -- sd
				{itemid=7590, count=1, inContainer=true}, -- gmp
				{itemid=2274, count=1, inContainer=true} -- ava
			},
			{ -- Druid
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2183}, -- hailstrom rod
				{itemid=8819}, -- magician's robe
				{itemid=2457}, -- steel helemet
				{itemid=2463}, -- plate legs
				{itemid=2268, count=1, inContainer=true}, -- sd
				{itemid=2269, count=1, inContainer=true}, -- wg
				{itemid=7590, count=1, inContainer=true}, -- gmp
				{itemid=2274, count=1, inContainer=true} -- ava
			},
			{ -- Paladin
				{itemid=1988}, -- backpack
				{itemid=2399}, -- star
				{itemid=2509}, -- steel shield
				{itemid=2660}, -- ranger's cloak
				{itemid=2481}, -- soldier helmet
				{itemid=8923}, -- ranger legs
				{itemid=8472, count=1, inContainer=true}, -- Great spirit Potion
				{itemid=7589, count=1, inContainer=true}, -- strong mana potion
				{itemid=2268, count=1, inContainer=true}, -- sd
				{itemid=7620, count=1, inContainer=true} -- mp
			},
			{ -- Knight
				{itemid=1988}, -- backpack
				{itemid=2509}, -- steel shield
				{itemid=2400}, -- magic sword
				{itemid=2465}, -- brass armor
				{itemid=2481}, -- soldier helmet
				{itemid=2478}, -- brass legs
				{itemid=8473, count=1, inContainer=true}, -- uhp
				{itemid=7620, count=1, inContainer=true} -- mp
			}
		}
	]]></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 (getPlayerLastLoginSaved(cid) < 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, 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>
 
use this:
Code:
<?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,
			items = {2050, 2382}
		}
	]]></config>
	<event type="login" name="FirstItems" event="script"> <![CDATA[
		domodlib('firstitems_config')
 
		function onLogin(cid)
	local config = {
		voc_items = {
			{ -- SORC
				{2190}, -- wand of vortex
				{2175}, -- spellbook
				{8820}, -- mage hat
				{8819} -- mage robe
			},
			{ -- DRUID
				{2182}, -- snakebite rod
				{2175}, -- spellbook
				{8820}, -- mage hat
				{8819} -- mage robe
			},
			{ -- PALADIN
				{2410, 50}, -- throwing knife
				{2530}, -- copper shield
				{2480}, -- legion helmet
				{2464} -- chain armor
			},
			{ -- KNIGHT
				{2409}, -- serpent sword
				{2530}, -- copper shield
				{2480}, -- legion helmet
				{2464} -- chain armor
			}
		},
		all_items = {
			{2468}, -- studded legs
			{2173},
			{2643} -- leather boots
		},
		extra_items = {
			{2789, 15},
			{2160, 2},
			{2120},
			{5710}
		},
		knight_weapons = {
			{2423}, -- clerical mace
			{2429} -- barbarian 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
	]]></event>
</mod>
 
try this script plz? and report back to me here
it's awsome and give weapons for vocations and plate set etc.
go to data / creaturescripts / scripts and paste the following on firstitems.lua
LUA:
function onLogin(cid)
	if getPlayerGroupId(cid) == 1 and getPlayerStorageValue(cid, 50000) == -1 then
		if isSorcerer(cid) then
			local bag = doPlayerAddItem(cid, 9774, 1)
	
			doAddContainerItem(bag, 2120, 1)
			doAddContainerItem(bag, 2554, 1)
			doAddContainerItem(bag, 2152, 20)
		
			doPlayerAddItem(cid, 2525, 1)
			doPlayerAddItem(cid, 2190, 1)
			doPlayerAddItem(cid, 2463, 1)
			doPlayerAddItem(cid, 2457, 1)
			doPlayerAddItem(cid, 2647, 1)
			doPlayerAddItem(cid, 2643, 1)

		setPlayerStorageValue(cid, 50000, 1)

		elseif isDruid(cid) then
			local bag = doPlayerAddItem(cid, 9774, 1)
			doAddContainerItem(bag, 2120, 1)
			doAddContainerItem(bag, 2554, 1)
			doAddContainerItem(bag, 2152, 20)
		
			doPlayerAddItem(cid, 2525, 1)
			doPlayerAddItem(cid, 2182, 1)
			doPlayerAddItem(cid, 2463, 1)
			doPlayerAddItem(cid, 2457, 1)
			doPlayerAddItem(cid, 2647, 1)
			doPlayerAddItem(cid, 2643, 1)

			setPlayerStorageValue(cid, 50000, 1)

		elseif isPaladin(cid) then
			local bag = doPlayerAddItem(cid, 9774, 1)
			doAddContainerItem(bag, 2120, 1)
			doAddContainerItem(bag, 2554, 1)
			doAddContainerItem(bag, 2152, 20)
		
			doPlayerAddItem(cid, 2389, 3)
			doPlayerAddItem(cid, 2525, 1)
			doPlayerAddItem(cid, 2457, 1)
			doPlayerAddItem(cid, 2643, 1)
			doPlayerAddItem(cid, 2647, 1)
                  doPlayerAddItem(cid, 2463, 1)
			setPlayerStorageValue(cid, 50000, 1)

		elseif isKnight(cid) then
			local bag = doPlayerAddItem(cid, 9774, 1)
			doAddContainerItem(bag, 2120, 1)
			doAddContainerItem(bag, 2554, 1)
			doAddContainerItem(bag, 2152, 20)
			doAddContainerItem(bag, 8601, 1)
		
	            doPlayerAddItem(cid, 2525, 1)
			doPlayerAddItem(cid, 2463, 1)
			doPlayerAddItem(cid, 2457, 1)
			doPlayerAddItem(cid, 2647, 1)
			doPlayerAddItem(cid, 2643, 1)

			setPlayerStorageValue(cid, 50000, 1)
		end
	end
 	return TRUE
end

then go to data / creaturescripts.xml and paste the following
XML:
	<event type="login" name="firstitems" event="script" value="firstitems.lua"/>

then go data / creaturescripts / scripts / login.lua and paste the following after line
After:
LUA:
	registerCreatureEvent(cid, "GuildMotd")
Paste
LUA:
	registerCreatureEvent(cid, "firstitems")
 
That's a MOD, and you're putting in creatureevents.
Put it in mods folder with xml format, and try again :P

Good Luck.
 
LUA:
<?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=6103, count=1, useMessage=true}, -- a book (or whatever) with a message
			{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=7620, count=3, inContainer=true} -- mana potion
			},
			{ -- Druid
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2182}, -- snakebite rod
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=2468}, -- studded legs
				{itemid=7620, 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=7618, count=1, inContainer=true}, -- health potion
				{itemid=7620, 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=7618, 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 (getPlayerLastLoginSaved(cid) < 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, 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>
 
Back
Top