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

Why aint my lever script working?

Shinobino

New Member
Joined
Jan 26, 2009
Messages
39
Reaction score
0
Hello, at start I want to say I'm totally new to scripting.
I've changed a scipr of some other guy so it can work on my OT.
It's the script of pvp turnament area, we got 9 spots, when I pull the lever walls near those spots will open and players will be able to enter the battlefield.

To actions.xml I've put this:
Code:
<action itemid="1945" event="script" value="other/lever.lua"/>

then I've made new file lever.lua with this inside:

Code:
function onUse(cid, item, frompos, item2, topos)
statuepos1 = {x=1035, y=993, z=7, stackpos=1}
statuepos2 = {x=1037, y=993, z=7, stackpos=1}
statuepos3 = {x=1039, y=993, z=7, stackpos=1}
statuepos4 = {x=1041, y=993, z=7, stackpos=1}
statuepos5 = {x=1043, y=993, z=7, stackpos=1}
statuepos6 = {x=1045, y=993, z=7, stackpos=1}
statuepos7 = {x=1047, y=993, z=7, stackpos=1}
statuepos8 = {x=1049, y=993, z=7, stackpos=1}
statuepos9 = {x=1051, y=993, z=7, stackpos=1}
statue1 = getThingfromPos(statuepos1)
statue2 = getThingfromPos(statuepos2)
statue3 = getThingfromPos(statuepos3)
statue4 = getThingfromPos(statuepos4)
statue5 = getThingfromPos(statuepos5)
statue6 = getThingfromPos(statuepos6)
statue7 = getThingfromPos(statuepos7)
statue8 = getThingfromPos(statuepos8)
statue9 = getThingfromPos(statuepos9)
if item.itemid == 1945 and item.uid == 6010 then
doRemoveItem(statue1.uid,1028)
doRemoveItem(statue2.uid,1028)
doRemoveItem(statue3.uid,1028)
doRemoveItem(statue4.uid,1028)
doRemoveItem(statue5.uid,1028)
doRemoveItem(statue6.uid,1028)
doRemoveItem(statue7.uid,1028)
doRemoveItem(statue8.uid,1028)
doRemoveItem(statue9.uid,1028)
doTransformItem(item.uid,1946)
doPlayerSendTextMessage(cid,22,"You can hear that somewhere has change something. It cant be so far.")
elseif(item.itemid == 1946 and item.uid == 6010) then
doCreateItem(statue1.uid,1028)
doCreateItem(statue2.uid,1028)
doCreateItem(statue3.uid,1028)
doCreateItem(statue4.uid,1028)
doCreateItem(statue5.uid,1028)
doCreateItem(statue6.uid,1028)
doCreateItem(statue7.uid,1028)
doCreateItem(statue8.uid,1028)
doCreateItem(statue9.uid,1028)
doTransformItem(item.uid,1945) 
doPlayerSendTextMessage(cid,22,"You can hear that somewhere has change something. It cant be so far.")
else
doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
end
end

Could someone help me?^^
 
Code:
<action uniqueid="6010" event="script" value="other/lever.lua"/>
Code:
function onUse(cid, item, frompos, item2, topos)
	for i = 0, 8 do
		if item.itemid == 1945 then
			doRemoveItem(getTileItemById({x=1035 + i * 2, y=993, z=7}, 1028).uid)
		else
			doCreateItem(1028, 1, {x=1035 + i * 2, y=993, z=7})
		end
	end
	doCreatureSay(cid, "You heard that something has changed somewhere. It can't be that far.", TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top