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

Lua Doors, items and fields put on them

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,782
Solutions
25
Reaction score
491
Location
Sweden
Hello, I have a problem with my door scripts on my server. I'm not using TFS so please don't tell me just to use their script. I lack some of their functions.

Anyway, the problem is that you can close doors even if there is an item or a field on it.

Edit:

Issue was the topOrder definition in Game::internalGetThing(...)
 
Last edited:
LUA:
local function checkStackpos(item, p)
	p.stackpos = 255
	local a = getThingFromPos(p)
 
	return (item == a.uid or a.itemid < 100 or getThingFromPos({x=p.x, y=p.y, z=p.z, stackpos=254}).itemid == 0)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not checkStackpos(item.uid, fromPosition) then
		return FALSE
	end

	local nextTile = {x=fromPosition.x+1, y=fromPosition.y, z=fromPosition.z}
	if(getTilePzInfo(fromPosition) == 1 and getTilePzInfo(nextTile) == 0) then
		nextTile.x = fromPosition.x-1
	end
 
	doRelocate(fromPosition, nextTile)
 
	doTransformItem(item.uid, item.itemid-1)
	return TRUE
end
 
Back
Top