• 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 No clue what's wrong with this script.

Cornwallis

Member
Joined
Jan 3, 2010
Messages
480
Reaction score
16
Small, simple script. Shouldn't be too hard. I'm using 0.3.7 .

Code:
local config = {
	[{8932, 8931}] = "You have upgraded your Xilux Sword to an Upgraded Xilux Sword!",
	[{7901, 9778}] = "You have upgraded your Xilux Axe to an Upgraded Xilux Axe!"
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local position = toPosition.x == 0xFFFF and getThingPosition(cid) or toPosition
 
	for i, upgmsg in pairs(config) do
		if(itemEx.itemid == i[1]) then
			doTransformItem(itemEx.uid, i[2])
			doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
			doCreatureSay(cid, upgmsg, TALKTYPE_MONSTER, nil, nil, position)
			doRemoveItem(item.uid, 1)
		else
		if(itemEx.itemid == i[2]) then
			doSendMagicEffect(position, CONST_ME_POOF)
			doCreatureSay(cid, "You have either already upgraded this Xilux item or you are not using this upgrading tool on an Xilux item!", TALKTYPE_MONSTER, nil, nil, position)
		end
	end
	return true
end

Code:
upgrade.lua:20: unexpected symbol near 'then'
 
LUA:
local config = {
	[{8932, 8931}] = "You have upgraded your Xilux Sword to an Upgraded Xilux Sword!",
	[{7901, 9778}] = "You have upgraded your Xilux Axe to an Upgraded Xilux Axe!"
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local position = toPosition.x == 0xFFFF and getThingPosition(cid) or toPosition
 
	for i, upgmsg in pairs(config) do
		if(itemEx.itemid == i[1]) then
			doTransformItem(itemEx.uid, i[2])
			doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
			doCreatureSay(cid, upgmsg, TALKTYPE_MONSTER, nil, nil, position)
			doRemoveItem(item.uid, 1)
		elseif(itemEx.itemid == i[2]) then
			doSendMagicEffect(position, CONST_ME_POOF)
			doCreatureSay(cid, "You have either already upgraded this Xilux item or you are not using this upgrading tool on an Xilux item!", TALKTYPE_MONSTER, nil, nil, position)
		end
	end
	return true
end
 
Back
Top