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

Door.lua

ToloXXX

New Member
Joined
Dec 14, 2014
Messages
93
Reaction score
4
this is for a lock door script, when using a key it should open, the door action id number is the same as key but gives me an error and door wont open. Any thoughts or another way to do it? 0.3.6



Lua:
local config = {
	positions = {
		from = {x = 1218, y = 1719, z = 7},
		to = {x = 1219, y = 1719, z = 7}
	},
	keyActionId = 2000

function getDistance(a, b)
	return math.max(math.abs(a.x - b.x), math.abs(a.y - b.y))
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.uid == 2091 then
		local teleportPosition = getDistance(getCreaturePosition(cid), config.positions.from) < getDistance(getCreaturePosition(cid), config.positions.to) and config.positions.to or config.positions.from
		doTeleportThing(cid, teleportPosition)
	end
	return true
end[code=lua]
 
Back
Top