• 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 Removing a wall.

SoloQ

Hard With Style
Joined
Mar 12, 2009
Messages
557
Reaction score
21
Location
Netherlands ;3
Hi guys,

I am trying to make my poi work so for the lava walls you encounter I made this:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cfg = {
		p = {
			wall_ = { x = 32831, y = 32333, z = 11 }, -- Where the wall is.
			lever = { x = 32820, y = 32321, z = 10 } -- Where the lever is.
		},
		wall_id = 6289, -- Wall item id.
	}
	if(item.itemid == 1945) then
			doCreateItem(cfg.wall_id, 1, p.wall_) and doTransformItem(getTileItemById(p.lever, 1946).uid, 1945) end
		end
	elseif(item.itemid == 1946) then
	return doRemoveItem(getTileItemById(p.wall_, cfg.wall_id).uid) and doTransformItem(getTileItemById(h.lever, 1945).uid, 1946)
	end
	return true
end


Error in console is : unexpected symbol near 'and'

Helpzzzz

-Hansie
 
Last edited:
Thats actually what I want.

You start with the wall already in place. If you use the lever lever id goes to 1946, so wall removes.
Somebody puts it back, wall goes back into place.

It isn't working for me do :S
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {
        wall_ = {x = 32831, y = 32333, z = 11}, -- Where the wall is.
        wall_id = 6289 -- Wall item id.
    }
    if(item.itemid == 1945) then
        doRemoveItem(getTileItemById(cfg.wall_, cfg.wall_id).uid) 
        doTransformItem(item.uid, 1946)
    elseif(item.itemid == 1946) then
        doCreateItem(cfg.wall_id, 1, cfg.wall_)
        doTransformItem(item.uid, 1945) 
    end
    return true
end

Now it removes with id 1945 and adds with id 1946.
 
Its from martyx compiling thread.

--------------

function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {
wall_ = {x = 32831, y = 32333, z = 11}, -- Where the wall is.
wall_id = 6289 -- Wall item id.
}
if(item.itemid == 1945) then
doRemoveItem(getTileItemById(cfg.wall_, cfg.wall_id).uid)
doTransformItem(item.uid, 1946)
elseif(item.itemid == 1946) then
doCreateItem(cfg.wall_id, 1, cfg.wall_)
doTransformItem(item.uid, 1945)
end
return true
end


This does work but I had uniqueid instead of actionid in my actions.xml. Thanks Limos :D
 
They beat me to it, but I made this:

Lua:
local t = {
	{x = 32831, y = 32333, z = 11}, 6289
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local k, wall = item.itemid == 1945, getTileItemById(t[1], t[2]).uid
	if(k and wall > 0) then
		doRemoveItem(wall)
	else
		doCreateItem(t[2], 1, t[1])
	end
	return doTransformItem(item.uid, k and 1946 or 1945)
end
 
Back
Top