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

Lever won't work.

Curry McFlurry

New Member
Joined
Dec 16, 2007
Messages
7
Reaction score
0
Okay so I'm new to scripting and tried this lever script out. But it doesn't seem to work.
Can anyone tell me what I did wrong?

The lever works once but it won't change into the 1946. It stays at 1945.

Code:
function onUse(cid, item, frompos, item2, topos)
statuepos1 = {x=1027, y=1098, z=7, stackpos=1}
statuepos2 = {x=1027, y=1097, z=7, stackpos=1}
statue1 = getThingfromPos(statuepos1)
statue2 = getThingfromPos(statuepos2)
if item.itemid == 1945 and item.uid == 6010 then
doRemoveItem(statue1.uid,2767)
doRemoveItem(statue2.uid,2768)
doTransformItem(item.uid,1946)
doPlayerSendTextMessage(cid,22,"What's with that strange noise?")
elseif(item.itemid == 1946 and item.uid == 6010) then
doCreateItem(statue1.uid,2767)
doCreateItem(statue2.uid,2768)
doTransformItem(item.uid,1945) 
doPlayerSendTextMessage(cid,22,"There is that strange noise again!")
else
doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
end
end

Code:
<action uniqueid="6010" event="script" value="other/remove.lua"/>
 
LUA:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 1945 then
	doRemoveItem(getThingfromPos({x=1027, y=1098, z=7, stackpos=1}).uid, 2767)
	doRemoveItem(getThingfromPos({x=1027, y=1097, z=7, stackpos=1}).uid, 2768)
	doTransformItem(item.uid, item.itemid+1)
	doPlayerSendTextMessage(cid, 22, "What's with that strange noise?")
elseif item.itemid == 1946 then
        doCreateItem(2767, 1, {x=1027, y=1098, z=7, stackpos=1})
        doCreateItem(2768, 1, {x=1027, y=1097, z=7, stackpos=1})
	doTransformItem(item.uid, item.itemid-1) 
	doPlayerSendTextMessage(cid,22,"There is that strange noise again!")
else
	doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
end
	return 1
end

Should work, if it don't, another guy will probably help you. Good luck!
 
Thanks that worked, but let's say I wanted to move this object to the side and then back into the original spot. Like a sliding door.
I only get it to disappear from the starting point but it won't go back.
 
LUA:
function onUse(cid, item, frompos, item2, topos)
 
if item.itemid == 1945 then
	doRemoveItem(getThingfromPos({x=1027, y=1098, z=7, stackpos=1}).uid, 2767)
    doCreateItem(2768, 1, {x=1027, y=1097, z=7, stackpos=1})
	doTransformItem(item.uid, item.itemid+1)
	doPlayerSendTextMessage(cid, 22, "What's with that strange noise?")
elseif item.itemid == 1946 then
    doCreateItem(2767, 1, {x=1027, y=1098, z=7, stackpos=1})
	doRemoveItem(getThingfromPos({x=1027, y=1097, z=7, stackpos=1}).uid, 2767)
	doTransformItem(item.uid, item.itemid-1) 
	doPlayerSendTextMessage(cid, 22, "There is that strange noise again!")
else
	doPlayerSendTextMessage(cid, 22, "Sorry, not possible.")
end
	return 1
end

Something like that? Let's say you have id: 0000 or w/e, now it will remove the item and create it on another spot, and when you pull the lever again it will reverse that action ~
 
Back
Top