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

[Help] firstitems.lua

watamataba

New Member
Joined
Nov 22, 2008
Messages
1
Reaction score
0
Hi people, i need some help cuz im new scripting, and i've lost 3 hours trying to fix this.
What i want with this lua its when players log in for first time, if he is a knight, he'll have sword, axe and mace on his bp. If he is a paladin, he wont have weapons, he will have some spears, etc etc.

Cuz i cant do that, i tried to modify the script so when they log in they got everything, but i messed it up.

Code:
local firstItems =
{
	2516,
	2383
}

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end		
		if getPlayerSex(cid) == 0 then
			doPlayerAddItem(cid, 2651, 1)
		else
			doPlayerAddItem(cid, 2457, 1)
			doPlayerAddItem(cid, 2463, 1)
			doPlayerAddItem(cid, 2647, 1)
			doPlayerAddItem(cid, 2643, 1)
		end
		local bag = doPlayerAddItem(cid, 7342, 1)
		doAddContainerItem(bag, 2120, 1)
		doAddContainerItem(bag, 2554, 1)
		doAddContainerItem(bag, 2389, 5)
		doAddContainerItem(bag, 2429, 1)
		doAddContainerItem(bag, 2423, 1)
		doAddContainerItem(bag, 2183, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end
 	return TRUE
end

I got this error

Code:
[25/11/2008  17:41:05] Lua Script Error: [CreatureScript Interface] 
[25/11/2008  17:41:05] data/creaturescripts/scripts/firstitems.lua:onLogin

[25/11/2008  17:41:05] luaDoAddContainerItem(). Could not add item


So, if you guys can help me with the script wich gives different equipment depending on his vocations ill really appreciate it.

Thank you very much and sorry for my bad english
 
Last edited:
Back
Top