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

Script help please! Really important!

Skylinx

Game Programmer
Joined
Nov 26, 2008
Messages
399
Reaction score
15
Location
TORONTO, CANADA
[10/12/2008 19:30:31] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/firstitems.lua
[10/12/2008 19:30:31] data/creaturescripts/scripts/firstitems.lua:16: 'end' expected (to close 'if' at line 12) near 'else'

Why's it friggin saying that? I've tried putting what it says, and idk wtf is wrong!
Can someone please my firstitems.lua script to a correct format?
PHP:
local firstItems =
{
	2050,
	2382
}

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, 2650, 1)
		else
			doPlayerAddItem(cid, 2648, 1)
		else
			doPlayerAddItem(cid, 2458, 1)
		else
			doPlayerAddItem(cid, 2643, 1)
		else
			doPlayerAddItem(cid, 2398, 1)
		end
		end
		local bag = doPlayerAddItem(cid, 1987, 1)
                doAddContainerItem(bag, 2666, 3)
		doAddContainerItem(bag, 2190, 1)
		doAddContainerItem(bag, 2389, 50)
		doAddContainerItem(bag, 2182, 1)
		doAddContainerItem(bag, 2160, 1)
		doAddContainerItem(bag, 2367, 1)
		doAddContainerItem(bag, 2428, 1)

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

I made the script my self, but I dont understand what's wrong? o_o
 
I modified it a bit
BTW: im not sure if the bag thing will work...
Code:
local firstItems = {
[1] =  {2050,0,1},
[2] =  {2382,0,1},
[3] =  {2651,0,1},
[4] =  {2650,0,1},
[5] =  {2648,0,1},
[6] =  {2458,0,1},
[7] =  {2643,0,1},
[8] =  {2643,0,1},
[9] =  {2398,0,1},
[10] = {2190,1,1},
[11] = {2389,1,50},
[12] = {2182,1,1},
[13] = {2160,1,1},
[14] = {2367,1,1},
[15] = {2666,1,3},
[16] = {2428,1,1}
}

function onLogin(cid)
    if getPlayerStorageValue(cid, 30001) == -1 then
local bag = doPlayerAddItem(cid, 1987, 1)
for i = 1, #firstItems do
if firstItems[i][2] == 0 then
doPlayerAddItem(cid, firstItems[i][1], firstItems[i][3])
else
doAddContainerItem(bag, firstItems[i][1], firstItems[i][3])
end
end
setPlayerStorageValue(cid, 30001, 1)

end
     return TRUE
end

OH and on your script the error was 2 ends unexpected and idk why but you added many "else" they are not needed to add more code lines :P


EDIT:
Im gonna explain the items part a bit
[ID OF TABLE] = {ID OF ITEM,IS ON BAG = 1,Quanty to add}
Example if you want to add 100 ccs to the bag
[1] = {2160,1,100}
or if you want those ccs to be simply added
[1] = {2160,0,100}


EDIT2: I didn tested it so im not sure if it will work... but any error you have post it here please
 
Back
Top