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

Solved a doRemoveItem problem

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
This code

LUA:
local pos = {x=419,  y=1325,  z=8}

function onUse(cid, item, frompos, item2, topos)
	if getPlayerStorageValue(cid, 1033) == 2 and item.itemid == 2087 then
			doRemoveItem(getTileThingByPos(pos).uid)
			end
		end
does not work

How do I do the doRemoveItem on an actual object?
 
Last edited:
Ok it's still not working, this is what I have in actions.xml

LUA:
	<action itemid="7106" event="script" value="quests/monkeydoor.lua"/>
so it works on the actual item (which is an inactive geyser lol)
and here is the code again

LUA:
local pos = {x=419,  y=1325,  z=8}

function onUse(cid, item, frompos, item2, topos)
	if getPlayerStorageValue(cid, 1033) == 2 and item.itemid == 2087 then
			doRemoveItem(getThingfromPos.uid,1)
			end
		end

All I want the script to do is to make it so when you use that certain key ID on the geyser, it removes the geyser.
 
You have to switch the geyser id with the key id and check for item2.itemid.
With the itemremove you should check for ids so other things like grounds won't get removed instead of the geyser.
LUA:
	doRemoveItem(getTileItemById(pos,7106).uid,1)

Edit: You should also add return true under doRemoveItem so you don't get the "You cannot use this object" message and write return false above the last end, so people do get this message if they use the key on something else.
 
Last edited:
Ok I changed in actions xml the itemid to the id of the key and here is the code

LUA:
local pos = {x=419,  y=1325,  z=8}

function onUse(cid, item, frompos, item2, topos)
	if getPlayerStorageValue(cid, 1033) == 2 and item.itemid == 2087 then
			doRemoveItem(getTileItemById(pos,7106).uid,1)
			return true
			end
		return false
		end

I tried using item2.itemid like you said Limos but that did not work either.

What am I doing wrong??
 
You still have the key id in your item check. You don't have to check for the item you are using if you added it as an item in actions.xml, so instead of that check for the geyser id and with item2.itemid.
And add this: and (getTileItemById(pos, 7106).uid) > 0 incase you have the same item somewhere else to avoid errors if it's gone. Or use an unique id and check for that if you only want the item to be removed if people use that item.

About the key, it's probable already used as door key, so you can try an other item or edit this:
XML:
<action fromid="2086" toid="2092" event="script" value="other/doors.lua"/>
 
Last edited:
Back
Top