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

firstitems.lua ; What the hell is wrong with it?

Skylinx

Game Programmer
Joined
Nov 26, 2008
Messages
399
Reaction score
14
Location
TORONTO, CANADA
This is my firstitems.lua, It's giving me this error.
No matter what I change in the script, it always gives me this end expected near else error, it's pissing me off I put end there so many times, still :
Code:
[09/01/2009 12:58:45] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/firstitems.lua
[09/01/2009 12:58:45] data/creaturescripts/scripts/firstitems.lua:17: 'end' expected (to close 'if' at line 8) near 'else'

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

Can someone please fix it for me?
Don't just say "It tells you where the problem is"
I don't what the hell to do, please help me T_T
 
Code:
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
        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

You cant have that many "else"s againt one if.
 
Back
Top