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]