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

Bridge lever isn't working correctly -.-.

knighters god

Active Member
Joined
Feb 14, 2009
Messages
166
Solutions
1
Reaction score
40
So I would like some help about a lever that should summon a bridge when you right click it but when you right click the lever again it should remove the bridge. and all that is working is to summon it but the lever is stuck at "1645" instead of changing to "1646".
LUA:
 ---By Tetra20---
 function onUse(cid, item, fromPosition, itemEx, toPosition)
	flagpos = {x=827, y=1162, z=7, stackpos=1}
	getflag = getThingfromPos(flagpos)
	flagpos1 = {x=827, y=1163, z=7, stackpos=1}
	getflag1 = getThingfromPos(flagpos1)
	flagpos2 = {x=827, y=1164, z=7, stackpos=1}
	getflag2 = getThingfromPos(flagpos2)
	flagpos3 = {x=827, y=1164, z=7, stackpos=1}
	getflag3 = getThingfromPos(flagpos3)
	flagpos4 = {x=827, y=1165, z=7, stackpos=1}
	getflag4 = getThingfromPos(flagpos4)
	flagpos5 = {x=827, y=1166, z=7, stackpos=1}
	getflag5 = getThingfromPos(flagpos5)
	flagpos6 = {x=827, y=1167, z=7, stackpos=1}
	getflag6 = getThingfromPos(flagpos6)
	flagpos7 = {x=828, y=1168, z=7, stackpos=1}
	getflag7 = getThingfromPos(flagpos7)
	flagpos8 = {x=828, y=1167, z=7, stackpos=1}
	getflag8 = getThingfromPos(flagpos8)
	flagpos9 = {x=828, y=1166, z=7, stackpos=1}
	getflag9 = getThingfromPos(flagpos9)
	flagpos10 = {x=828, y=1165, z=7, stackpos=1}
	getflag10 = getThingfromPos(flagpos10)
	flagpos11 = {x=828, y=1164, z=7, stackpos=1}
	getflag11 = getThingfromPos(flagpos11)
	flagpos12 = {x=828, y=1163, z=7, stackpos=1}
	getflag12 = getThingfromPos(flagpos12)
	flagpos13 = {x=828, y=1162, z=7, stackpos=1}
	getflag13 = getThingfromPos(flagpos13)
    if item.uid == 5050 and item.itemid == 1945 then
	doCreateItem(1284, 1, {x=827, y=1162, z=7})
	doCreateItem(1284, 1, {x=827, y=1163, z=7})
	doCreateItem(1284, 1, {x=827, y=1164, z=7})
	doCreateItem(1284, 1, {x=827, y=1165, z=7})
	doCreateItem(1284, 1, {x=827, y=1166, z=7})
	doCreateItem(1284, 1, {x=827, y=1167, z=7})
	doCreateItem(1284, 1, {x=827, y=1168, z=7})
	doCreateItem(1284, 1, {x=828, y=1168, z=7})
	doCreateItem(1284, 1, {x=828, y=1167, z=7})
	doCreateItem(1284, 1, {x=828, y=1166, z=7})
	doCreateItem(1284, 1, {x=828, y=1165, z=7})
	doCreateItem(1284, 1, {x=828, y=1164, z=7})
	doCreateItem(1284, 1, {x=828, y=1163, z=7})
	doCreateItem(1284, 1, {x=828, y=1162, z=7})
	doTransformItem(item.uid, item.itemid +1)
	elseif item.uid == 5050 and item.itemid == 1946 then
	doRemoveItem(getflag.uid)
	doRemoveItem(getflag1.uid)
	doRemoveItem(getflag2.uid)
	doRemoveItem(getflag3.uid)
	doRemoveItem(getflag4.uid)
	doRemoveItem(getflag5.uid)
	doRemoveItem(getflag6.uid)
	doRemoveItem(getflag7.uid)
	doRemoveItem(getflag8.uid)
	doRemoveItem(getflag9.uid)
	doRemoveItem(getflag10.uid)
	doRemoveItem(getflag11.uid)
	doRemoveItem(getflag12.uid)
	doRemoveItem(getflag13.uid)
	doTransformItem(item.uid, item.itemid - 1)
	end
	end
XML:
	<action uniqueid="5050" event="script" value="bridge.lua"/>
and some pics about it.
bild 1.jpgbild 2.jpgbild 3.jpg
REP++ if help
 
I'll check the code later, but you can't just remove the "brigde" since the stackpos of the drawbridge is 0 (floor) you need to transform it instead of remove it.

@Edit: The lever isn't changing because you forgot to add the return true at the onUse function :P
 
Last edited:
I'll check the code later, but you can't just remove the "brigde" since the stackpos of the drawbridge is 0 (floor) you need to transform it instead of remove it.

@Edit: The lever isn't changing because you forgot to add the return true at the onUse function :P

Well I didn't really do the script, Can't script Lua,XML and thos things just learning website coding but thanks you if you could fix the code for me :D
 
Last edited:
As Cthugha said the drawbridge is stackpos 0, but if you did remove it it would only create black space you would have to replace it, this script is not set up to remove the bridge it is set up to remove the flags from the specified coordinates. I am not on my pc so it would be much too difficult to make an example script right now but basically no part of this script is set up to remove the bridge
 
As Cthugha said the drawbridge is stackpos 0, but if you did remove it it would only create black space you would have to replace it, this script is not set up to remove the bridge it is set up to remove the flags from the specified coordinates. I am not on my pc so it would be much too difficult to make an example script right now but basically no part of this script is set up to remove the bridge
Where and how should I place "return true" in the script? I made so the script creates lava and dirt instead of trying to remove the bridge.
 
Back
Top