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

Elaney

Member
Joined
Jan 1, 2009
Messages
1,561
Reaction score
12
Location
Sweden
Code:
function onUse(cid, item, frompos, item2, topos)

	local switchUniqueID = 13001
	local switchID = 1945
	local switch2ID = 1946
	local bridge = {x=727, y=544, z=7, stackpos=0}
	local bridgs = {x=727, y=545, z=7, stackpos=0}
	local poxs = {x=728, y=541, z=7, stackpos=1}
	local player1POS = {x = 725, y = 542, z = 7}
	local sqmID = 13001
	
	local wallchk = getThingfromPos(bridge)
	local walle = getThingfromPos(bridgs)

	if item.uid == switchUniqueID and item.itemid == switchID and wallchk.itemid == 448 and walle.itemid == 448 then
			doRemoveItem(wallchk.uid,1)
			doRemoveItem(walle.uid,1)
			doTransformItem(item.uid, 1946)
	elseif item.uid == switchUniqueID and item.itemid == switch2ID then
			doCreateItem(448, bridge)
			doCreateItem(448, bridgs)
			doTransformItem(item.uid, 1945)
		end
	if item.uid == switchUniqueID and item.itemid == switchID and item.uid == sqmID and getCreaturePosition(cid) == player1POS then
			doCreateItem(2486, poxs)
	else 
			doPlayerSendCancel(cid,"You need to place the corpse of the slain Guard.")
end
	return 1
end

I dont want you to fix it for me. I rather want you too tell me if im doing right, like almost there at the end or something.
 
Code:
function onUse(cid, item, frompos, item2, topos)

	local switchUniqueID = 13001
	local switchID = 1945
	local switch2ID = 1946
	local bridge = {x=727, y=544, z=7, stackpos=0}
	local bridgs = {x=727, y=545, z=7, stackpos=0}
	local poxs = {x=728, y=541, z=7, stackpos=1}
	local player1POS = {x = 725, y = 542, z = 7}
	local sqmID = 13001
	
	local wallchk = getThingfromPos(bridge)
	local walle = getThingfromPos(bridgs)

	if item.uid == switchUniqueID and item.itemid == switchID and wallchk.itemid == 448 and walle.itemid == 448 then
			doRemoveItem(wallchk.uid,1)
			doRemoveItem(walle.uid,1)
			doTransformItem(item.uid, 1946)
	elseif item.uid == switchUniqueID and item.itemid == switch2ID then
			doCreateItem(448, bridge)
			doCreateItem(448, bridgs)
			doTransformItem(item.uid, 1945)
		end
	if item.uid == switchUniqueID and item.itemid == switchID and item.uid == sqmID and getCreaturePosition(cid) == player1POS then
			doCreateItem(2486, poxs)
	else 
			doPlayerSendCancel(cid,"You need to place the corpse of the slain Guard.")
end
	return 1
end

I dont want you to fix it for me. I rather want you too tell me if im doing right, like almost there at the end or something.

what are you trying to do exactly...your last if statement has the same item.uid statement in it twice..and i am not sure if doCreateItem will work right (not too familiar with 0.3...but doCreateItem is doCreateItem(itemid, type/count, pos)..so you'd need a type/count in there b4 position)
 
what are you trying to do exactly...your last if statement has the same item.uid statement in it twice..and i am not sure if doCreateItem will work right (not too familiar with 0.3...but doCreateItem is doCreateItem(itemid, type/count, pos)..so you'd need a type/count in there b4 position)

What im trying to do is when not standing on sqm the floors should just get removed. But if an other person is standing on th sqm '13002' then a box/item/etc should come.

The only thing i dont get to work is the getplayerposition to work. If i erase that part the item shows up but well.

and it's TFS 0.2
 
does your script work or were u just asking if you were doing it right?

if not what is not working?

It's not working like i want it.


Player A stands at lever. Pulls it (alone) and 2 sqm goes away. Pull it agin (alone) and 2 sqm comes back. (works without any problems)

But if player B stands on SQM = 13002

Then if Player A pull lever an box/item what ever falls down from the sky on pos. and thats not working.

And yes im kinda asking if im doing right also :P
 
Back
Top