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

Problems with shovel.lua

Goo Goo

Member
Joined
Apr 20, 2010
Messages
42
Reaction score
10
So basically I want to add some more holes to the shovel. (actually only one) So I can have a treasure island like deal just like Cipsoft Tibia. But since the shovel is scripted to work with summoning scarabs and scarab coins i needed to add another line of script I suppose ..

The line I added is between the lines...

Lua:
local holes = {468, 481, 483, 7932, 8579}
local sand = {231, 8568, 9059}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(isInArray(holes, itemEx.itemid)) then
		local newId = itemEx.itemid + 1
		if(itemEx.itemid == 8579) then
			newId = 8585
		end
 
		doTransformItem(itemEx.uid, newId)
		doDecayItem(itemEx.uid)
	elseif(isInArray(sand, itemEx.itemid)) then
		local rand = math.random(1, 100)
		if(itemEx.actionid  == 100 and rand <= 20) then
			doTransformItem(itemEx.uid, 489)
			doDecayItem(itemEx.uid)
		elseif(rand >= 1 and rand <= 5) then
			doCreateItem(2159, 1, toPosition)
		elseif(rand > 85) then
			doCreateMonster("Scarab", toPosition, false)
		end
 
 ------------------------------------------------------------
	elseif(isInArray(sand, itemEx.itemid)) then
		local rand = math.random(1, 100)
		if(itemEx.actionid  == 33333 and rand <= 20) then
			doTransformItem(itemEx.uid, 489)
			doDecayItem(itemEx.uid)
		elseif(rand >= 1 and rand <= 5) then
			doCreateItem(2159, 1, toPosition)
		elseif(rand > 85) then
			doCreateMonster("Scarab", toPosition, false)
		end
 -----------------------------------------------------------------
		doSendMagicEffect(toPosition, CONST_ME_POFF)
	end
 
	return true
end
And yes i just copied the first elseif .. thought it would be easier since I'm no good with scripts ..

Anyway I keep getting this error... even though it all looks good to me tried changing several things and it just won't work says the same thing over and over .. So if someone could tell me where i'm going wrong that would be great because I'm feed up at the moment..

PHP:
[19/12/2012 00:58:58] [Error - LuaScriptInterface::loadFile] data/actions/scripts/inq/sands.lua:7: 'end' expected (to close 'if' at line 6) near '<eof>' 
[19/12/2012 00:58:58] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/inq/sands.lua) 
[19/12/2012 00:58:58] data/actions/scripts/inq/sands.lua:7: 'end' expected (to close 'if' at line 6) near '<eof>'

I also tried this.. It would open a hole, take a treasure map .. but would never go back to sand .. and didn't require shovel.

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerItemCount(cid, 5706) >= 1 then
	doPlayerRemoveItem(cid, 5706, 1)
	doTransformItem(item.uid, 8567)
	local function Sand() 
				doTransformItem(item.uid, 8568)
	addEvent(sand, 30)
	else doPlayerSendCancel(cid, "Sorry, not possible.")
	end
	return true
end

And please if you don't have anything to say that helps.. just don't say anything.
 
Back
Top