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

Help fast with a script

habiba

New Member
Joined
Aug 26, 2007
Messages
586
Reaction score
4
Location
Örebro, Sweden
why dose the switch not work?
I added UniqueID 4008 on the switch and no UniqueID on the framework wall = id 1037

the problem is that the switch not working.

PHP:
function onUse(cid, item, frompos, item2, topos)

	rockpos = {x=32094, y=32149, z=10, stackpos=1}
	getpiece = getThingfromPos(rockpos)
		if item.uid == 4008 and item.itemid == 1945 and getpiece.itemid == 1037 then
		doRemoveItem(getpiece.uid,1)
		doTransformItem(item.uid,item.itemid+1)
		elseif item.uid == 4008 and item.itemid == 1946 then
		doCreateItem(1037,1,rockpos)
		doTransformItem(item.uid,item.itemid-1)
	else
		doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
	end
return 1
end
end

PHP:
<action uniqueid="4008" script="Rookgaard quests/Rookgaard Quests.lua"/>
 
Last edited:
Dont know how to say it properly in english, but you are checking for the uniqueid right after same check, like:
Code:
if item.uid == 2008 then 
    if item.uid == 4008 then
        --
    end
end

You have to end the first part to check for another.

Code:
if item.uid == 2008 then
    --
end

if item.uid == 4008 then
    --
end
 
Also you don't need to assign the framework wall a unique ID. You can get the framework wall via the coordinates and getThingFromPos(). It's sufficient if the lever has a uniqueID to trigger the script. Afaik you get bugged anyway if you have 2 same unique IDs in your map. Correct me if I'm wrong.
 
my falt i dont got any unique id on the framework wall only at the switch
edited the frist post.

19:35 You see a switch.
ItemID: [1945].
UniqueID: [4008].
Position: [X: 32094] [Y: 32148] [Z: 9].


19:35 You see a framework wall.
ItemID: [1037].
Position: [X: 32094] [Y: 32149] [Z: 10].
 
Try

PHP:
function onUse(cid, item, frompos, item2, topos)

local rockpos = {x=32094, y=32149, z=10, stackpos=1}
local getpiece = getThingfromPos(rockpos)

	if item.uid == 4008 and item.itemid == 1945 and getpiece.itemid == 1037 then

		doRemoveItem(getpiece.uid,1)
		doTransformItem(item.uid,item.itemid+1)

	elseif item.uid == 4008 and item.itemid == 1946 then

		doCreateItem(1037,1,rockpos)
		doTransformItem(item.uid,item.itemid-1)

	else

		doPlayerSendCancel(cid, "Sorry, not possible.")
		return 1

	end

end

Depending on what OT you use you don't need to use doTransformItem() for the levers. Some OTs have the lever flipping prescripted. In that case you don't need to check for the levers uniqueID either.
 
Last edited:
it dont work
Edit: If you are trying to do the rookgard bridge thing from cave rats your stackpos should be "0" since the bridge ID is taken as stackpos=0!

So try this:
PHP:
function onUse(cid, item, frompos, item2, topos)

    rockpos = {x=32094, y=32149, z=10, stackpos=0}
    getpiece = getThingfromPos(rockpos)
        if item.uid == 4008 and item.itemid == 1945 and getpiece.itemid == 1037 then
        doRemoveItem(getpiece.uid,1)
        doTransformItem(item.uid,item.itemid+1)
        elseif item.uid == 4008 and item.itemid == 1946 then
        doCreateItem(1037,1,rockpos)
        doTransformItem(item.uid,item.itemid-1)
    else
        doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
    end
return TRUE
end

Rep me if worked :p
 
Last edited:
Back
Top