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

Need help, correct code in lua script

tyngaste

New Member
Joined
Dec 2, 2008
Messages
223
Reaction score
0
Location
Sweden
hello i dont get any errors but it isnt working here is the lua script.


Code:
function onUse(cid, item, frompos, item2, topos)
	gate1pose = {x=32176, y=31868, z=15, stackpos=1} -- Where the first piece will be placed
	getgate1 = getThingfromPos(gate1pose)

	gate2pose = {x=32177, y=31868, z=15, stackpos=1} -- Where the first piece will be placed
	getgate2 = getThingfromPos(gate2pose)

	piece1pos = {x=32173, y=31871, z=15, stackpos=1} -- Where the first piece will be placed
	getpiece1 = getThingfromPos(piece1pos)
 
	piece2pos = {x=32180, y=31871, z=15, stackpos=1} -- Where the second piece will be placed
	getpiece2 = getThingfromPos(piece2pos)
 
			if item.uid == 1500 and item.itemid == 1945 and getpiece1.itemid == 2143 and getpiece2.itemid == 2144 then
				doRemoveItem(getpiece1.uid,1)
				doRemoveItem(getpiece2.uid,1)
				doRemoveItem(getgate2.uid,1)
				doRemoveItem(getgate1.uid,1)
 
				doTransformItem(item.uid,item.itemid+1)
			elseif item.uid == 1500 and item.itemid == 1946 then
				doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"There are no pearls or you putted them on the wrong desk.")
end
  return 1
  end

would be thankfull if anyone could fix it.
thanks in advance
 
Ah, right. Gimme a sec and I'll see if I can find anything. :thumbup:

EDIT:

Try this one, I made it a bit longer, just to search for errors.


Code:
function onUse(cid, item, fromPos, toPos, item2)

	local gate1pos = {x=32176, y=31868, z=15, stackpos=1} -- Where the first piece will be placed
	local getGate1 = getThingfromPos(gate1pos)

	local gate2pos = {x=32177, y=31868, z=15, stackpos=1} -- Where the first piece will be placed
	local getGate2 = getThingfromPos(gate2pos)

	local piece1pos = {x=32173, y=31871, z=15, stackpos=1} -- Where the first piece will be placed
	local getPiece1 = getThingfromPos(piece1pos)
 
	local piece2pos = {x=32180, y=31871, z=15, stackpos=1} -- Where the second piece will be placed
	local getPiece2 = getThingfromPos(piece2pos)
	
	if item.itemid == 1945 then
		if item.uid == 1500 then
			if getPiece1 == 2143 then
				if getPiece2 == 2144 then
					doRemoveItem(getPiece1.uid,1)
					doRemoveItem(getPiece2.uid,1)
					doRemoveItem(getGate1.uid,1)
					doRemoveItem(getGate2.uid,1)
					doTransformItem(item.uid,item.itemid + 1)
				else
					doPlayerSendCancel(cid,"There are no pearls or you've put them on the wrong desk1")
				end
			else
				doPlayerSendCancel(cid,"There are no pearls or you've put them on the wrong desk2")
			end
		else
			doPlayerSendCancel(cid,"There are no pearls or you've put them on the wrong desk3")
		end
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
	end
return TRUE
end
 
Last edited:
Ah, right. Gimme a sec and I'll see if I can find anything. :thumbup:

EDIT:

Try this one, I made it a bit longer, just to search for errors.


Code:
function onUse(cid, item, fromPos, toPos, item2)

	local gate1pos = {x=32176, y=31868, z=15, stackpos=1} -- Where the first piece will be placed
	local getGate1 = getThingfromPos(gate1pos)

	local gate2pos = {x=32177, y=31868, z=15, stackpos=1} -- Where the first piece will be placed
	local getGate2 = getThingfromPos(gate2pos)

	local piece1pos = {x=32173, y=31871, z=15, stackpos=1} -- Where the first piece will be placed
	local getPiece1 = getThingfromPos(piece1pos)
 
	local piece2pos = {x=32180, y=31871, z=15, stackpos=1} -- Where the second piece will be placed
	local getPiece2 = getThingfromPos(piece2pos)
	
	if item.itemid == 1945 then
		if item.uid == 1500 then
			if getPiece1 == 2143 then
				if getPiece2 == 2144 then
					doRemoveItem(getPiece1.uid,1)
					doRemoveItem(getPiece2.uid,1)
					doRemoveItem(getGate1.uid,1)
					doRemoveItem(getGate2.uid,1)
					doTransformItem(item.uid,item.itemid + 1)
				else
					doPlayerSendCancel(cid,"There are no pearls or you've put them on the wrong desk1")
				end
			else
				doPlayerSendCancel(cid,"There are no pearls or you've put them on the wrong desk2")
			end
		else
			doPlayerSendCancel(cid,"There are no pearls or you've put them on the wrong desk3")
		end
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
	end
return TRUE
end

k going to check 1 sec.
 
Back
Top