• 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 First items help 8.62 tfs

Exectric

New Member
Joined
Jun 6, 2007
Messages
25
Reaction score
0
Warning: Event [checkscript] can not load script. /script/firstitems.lua
data/creaturescripts/scripts/firstitems.lua:1: '=' Expected

local firstItems = {
-- ITEMS ALL VOCS RECEIVE
{itemid=2480}, -- legion helmet
{itemid=2464}, -- chain armor
{itemid=2468}, -- studded legs
{itemid=2643}, -- leather boots
{itemid=2120}, -- rope
{itemid=5710} -- shovel
}

local firstItems = {
{ -- SORC ITEMS
{itemid=2190}, -- wand of vortex
{itemid=2175} -- spellbook
},
{ -- DRUID ITEMS
{itemid=2182}, -- snakebite rod
{itemid=2175} -- spellbook
},
{ -- PALADIN ITEMS
{itemid=2456}, -- bow
{itemid=2544, count=100} -- 100 arrows
},
{ -- KNIGHT ITEMS
{itemid=2412}, -- katana
{itemid=2530} -- copper shield
}
}

for _, items in ipairs(firstItems) do
for _, item in ipairs(commonItems) do
table.insert(items, item)
end
end

local storage = 35353
function onLogin(cid)
if getPlayerGroupId(cid) < 2 and getPlayerStorageValue(cid, storage) < 1 then
--[[local backpack = ]]doPlayerAddItem(cid, 2365, 1)
local giveItems = firstItems[getPlayerVocation(cid)]
if giveItems 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, storage, 1)
end
return TRUE
end
 
On creaturescripts u can use this --> firstitems.lua

PHP:
local firstItems_storage = 30001

local commonItems = {
	{itemid=2554, inContainer = TRUE}, -- shovel
	{itemid=2120, inContainer = TRUE}, -- rope
	{itemid=2160, count=2, inContainer = TRUE}, -- 2 crystal coins
	{itemid=2643} -- leather boots
}
local firstItems = {
	{ -- Sorcerer 
		{itemid=1988, container = TRUE}, -- backpack
		{itemid=2175}, -- spellbook
		{itemid=2190}, -- wand of vortex
		{itemid=8819}, -- magician's robe
		{itemid=8820}, -- mage hat
		{itemid=2468} -- studded legs
	},
	{ -- Druid
		{itemid=1988, container = TRUE}, -- backpack
		{itemid=2175}, -- spellbook
		{itemid=2182}, -- snakebite rod
		{itemid=8819}, -- magician's robe
		{itemid=8820}, -- mage hat
		{itemid=2468} -- studded legs
	},
	{ -- Paladin
		{itemid=1988, container = TRUE}, -- backpack
		{itemid=2456}, -- bow
		{itemid=2544, count = 100}, -- 100 arrows
		{itemid=2660}, -- ranger's cloak
		{itemid=2480}, -- legion helmet
		{itemid=8923} -- ranger legs
	},
	{ -- Knight
		{itemid=1988, container = TRUE}, -- backpack
		{itemid=2439, inContainer = TRUE}, -- daramanian mace
		{itemid=8601, inContainer = TRUE}, -- steel axe
		{itemid=2509}, -- steel shield
		{itemid=8602}, -- jagged sword
		{itemid=2465}, -- brass armor
		{itemid=2481}, -- soldier helmet
		{itemid=2478} -- brass legs
	}
}

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 and getPlayerStorageValue(cid, firstItems_storage) <= 0 then
		local currvoc = getPlayerVocation(cid)
		local vocation = 5 > currvoc and currvoc or currvoc - 4
		local giveItems = firstItems[vocation]
	if giveItems then
		for _, v in ipairs(giveItems) do
	if v.container == TRUE then
		backpack = doPlayerAddItem(cid, v.itemid, 1)
	elseif v.inContainer == TRUE then
		doAddContainerItem(backpack, v.itemid, v.count or 1)
	else
		doPlayerAddItem(cid, v.itemid, v.count or 1)
		end
	end
end
setPlayerStorageValue(cid, firstItems_storage, 1)
end
return TRUE
end
 
Actually script did not load up, It gives same error :S

Okey, than delete the firstitems.lua [creaturescript] I will give u MOD script


Put this script in ur MODS folder, and than when ur server started use --> /reload mods and to be sure its reloaded use --> /reload actions

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="Apsivaflines" contact="antica.sytes.net" enabled="yes">
	<config name="firstitems_config"><![CDATA[
	]]></config>
	<event type="login" name="FirstItems" event="script"><![CDATA[
		domodlib('firstitems_config')

		function onLogin(cid)
	if getPlayerGroupId(cid) == 1 and getPlayerStorageValue(cid, 50000) == -1 then
		if isSorcerer(cid) then
			local bag = doPlayerAddItem(cid, 1988, 1)
			doAddContainerItem(bag, 2120, 1) -- rope
			doAddContainerItem(bag, 2554, 1) -- shovel
			doPlayerAddItem(cid, 2152, 50) -- platinum coin
         	        doPlayerAddItem(cid, 2190, 1) -- Wand of vortex		
			doPlayerAddItem(cid, 2525, 1) -- dwarven shield								
		doPlayerAddItem(cid, 2643, 1) -- leather boots			
                        doPlayerAddItem(cid, 2480, 1) -- legion helmet
                        doPlayerAddItem(cid, 8819, 1) -- magicians robe
						doPlayerAddItem(cid, 2789, 20) -- brown mushrooms		
	                doPlayerAddItem(cid, 2478, 1) -- brass legs			
			doPlayerAddPremiumDays(cid, 350) -- automaticly 350 premmium days for servers who dont got free premmium function in config.lua Example: Chronic Elements

		setPlayerStorageValue(cid, 50000, 1)

		elseif isDruid(cid) then
			local bag = doPlayerAddItem(cid, 1988, 1)
			doAddContainerItem(bag, 2120, 1) -- rope
			doAddContainerItem(bag, 2554, 1) -- shovel
			doPlayerAddItem(cid, 2152, 50) -- platinum coin
         	        doPlayerAddItem(cid, 2182, 1) -- snakebite	
			doPlayerAddItem(cid, 2525, 1) -- dwarven shield								
		doPlayerAddItem(cid, 2643, 1) -- leather boots			
                        doPlayerAddItem(cid, 2480, 1) -- legion helmet
                        doPlayerAddItem(cid, 8819, 1) -- magicians robe
						doPlayerAddItem(cid, 2789, 20) -- brown mushrooms		
	                doPlayerAddItem(cid, 2478, 1) -- brass legs					
doPlayerAddPremiumDays(cid, 350) -- automaticly 350 premmium days for servers who dont got free premmium function in config.lua Example: Chronic Elements

			setPlayerStorageValue(cid, 50000, 1)

		elseif isPaladin(cid) then
			local bag = doPlayerAddItem(cid, 1988, 1)
			doAddContainerItem(bag, 2120, 1) -- rope
			doAddContainerItem(bag, 2554, 1) -- shovel
			doPlayerAddItem(cid, 2152, 50) -- crystal  coin			
		   doPlayerAddItem(cid, 2660, 1) -- Ranger's cloack	
			doPlayerAddItem(cid, 2389, 3) -- spear
                        doPlayerAddItem(cid, 2480, 1) -- legion helmet
		doPlayerAddItem(cid, 8923, 1) -- ranger legs
			doPlayerAddItem(cid, 2643, 1) -- leather boots
			doPlayerAddItem(cid, 2525, 1) -- dwarven shield			
			doPlayerAddItem(cid, 2789, 20) -- brown mushrooms
		doPlayerAddPremiumDays(cid, 350) -- automaticly 350 premmium days for servers who dont got free premmium function in config.lua Example: Chronic Elements

			setPlayerStorageValue(cid, 50000, 1)

		elseif isKnight(cid) then
			local bag = doPlayerAddItem(cid, 1988, 1)
			doAddContainerItem(bag, 2120, 1) -- rope
			doAddContainerItem(bag, 2554, 1) -- shovel
			doPlayerAddItem(cid, 2152, 50) -- crystal  coin	
         	        doPlayerAddItem(cid, 2483, 1) -- Scale armor	      
	  doPlayerAddItem(cid, 2394, 1) -- morning star			
                        doAddContainerItem(bag, 8601, 1) -- Steel ace
			doPlayerAddItem(cid, 2525, 1) -- dwarven shield					
                        doPlayerAddItem(cid, 8602, 1) -- serpent sword
			doPlayerAddItem(cid, 2643, 1) -- leather boots			
                        doPlayerAddItem(cid, 2480, 1) -- steel helmet
			doPlayerAddItem(cid, 2789, 20) -- brown mushrooms		
	                doPlayerAddItem(cid, 2478, 1) -- plate legs	
		doPlayerAddItem(cid, 2643, 1) -- leather boots				
doPlayerAddPremiumDays(cid, 350) -- automaticly 350 premmium days for servers who dont got free premmium function in config.lua Example: Chronic Elements

			setPlayerStorageValue(cid, 50000, 1)
		end
	end
 	return TRUE
end
	]]></event>
</mod>
 
Back
Top