---------------------------------------------------------------------<!-- Keys -->
<action itemid="2086-2092;10032;10091" event="script" value="other/keys.lua"/>
REVERSE_DOORS, CHILD_DOORS = {}, {}
AUTO_CLOSE_DOORS = {
actionid = { 7777,777 }, -- actionid list like {1,2,3 }
xtime = 5 , -- in sec
}
for k, v in pairs(DOORS) do
REVERSE_DOORS[v] = k
local tmp = getItemInfo(v)
if(tmp.transformUseTo ~= 0) then
CHILD_DOORS[tmp.transformUseTo] = k
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.aid > 0 and itemEx.aid > 0) then
if(isPlayerPzLocked(cid) and getTileInfo(toPosition).protection) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
return true
end
local doors = DOORS[itemEx.itemid]
local closed_door = itemEx.itemid
if(not doors) then
doors = REVERSE_DOORS[itemEx.itemid]
closed_door= doors
end
if(not doors) then
doors = CHILD_DOORS[itemEx.itemid]
closed_door= doors
end
print ( closed_door )
if(doors) then
if(item.actionid ~= itemEx.actionid) then
doPlayerSendCancel(cid, "The key does not match.")
else
if isInArray(AUTO_CLOSE_DOORS.actionid, item.actionid) then
addEvent(doPlayerSendCancel, 2*1000, cid, "3" )
addEvent(doPlayerSendCancel, 3*1000, cid, "2" )
addEvent(doPlayerSendCancel, 5*1000, cid, "1" )
local xtime = AUTO_CLOSE_DOORS.xtime*1000
addEvent(function () doTransformItem(getThingfromPos(toPosition).uid, closed_door) end, xtime)
doTransformItem(itemEx.uid, doors)
else
doTransformItem(itemEx.uid, doors)
end
end
return true
end
end
return false
end
forget to remove ( from the beginerif(isInArray(AUTO_CLOSE_DOORS.actionid, item.actionid) then
-- chose une of that line
if(isInArray(AUTO_CLOSE_DOORS.actionid, item.actionid)) then
-- or this other
if isInArray(AUTO_CLOSE_DOORS.actionid, item.actionid) then
and past this code inside.data\actions\lib\actions.lua
DOORS = {
[1209] = 1211, [1212] = 1214, [1231] = 1233, [1234] = 1236, [1249] = 1251, [1252] = 1254, [3535] = 3537, [3544] = 3546, [4913] = 4915, [4916] = 4918,
[5098] = 5100, [5107] = 5109, [5116] = 5118, [5125] = 5127, [5134] = 5136, [5137] = 5139, [5140] = 5142, [5143] = 5145, [5278] = 5280, [5281] = 5283,
[5732] = 5734, [5735] = 5737, [6192] = 6194, [6195] = 6197, [6249] = 6251, [6252] = 6254, [6891] = 6893, [6900] = 6902, [7033] = 7035, [7042] = 7044,
[8541] = 8543, [8544] = 8546, [9165] = 9167, [9168] = 9170, [9267] = 9269, [9270] = 9272, [10268] = 10270, [10271] = 10273, [10468] = 10470,
[10477] = 10479, [10775] = 10777, [10784] = 10786, [12092] = 12094, [12099] = 12101, [12188] = 12190, [12197] = 12199
}
OT : 9.81
The Global Server Version: (3.28 - r19) - Codename: (Apocalypse)
thoses door list i riped from my OT : 9.81 maybe thoses ids are wrong in ur ot.exemple take the 1st id put that door in ur map
ID : 1209
and test with action id 7777