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

Key System problems !!

DiegoSkate

Eu tiro é onda.
Joined
Jul 7, 2007
Messages
127
Reaction score
0
Location
Brazil
Hello guys, I need help for script on key system.

I make this quest \/

if item.uid == 5001 then
queststatus = getPlayerStorageValue(cid,5001)
if queststatus == -1 or queststatus == 0 then
doPlayerSendTextMessage(cid,22,"You have found a crystal key.")
setPlayerStorageValue(cid,5001,1)
doSetItemActionId(doPlayerAddItem(cid,2090,1),4001)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
return 0
end
return 1
end
this key working perfect! but the door no =\

How i make key for open the doors? i use TFS 0.2.9


Cya! and help-me!

Yours,
Diego.
 
Last edited by a moderator:
Same ActionID goes to door that the key has, so if u have key w/ AID 4009 u have to add in mapeditor to doors AID: 4009.
 
For me, keys system doesn't work. I have the same aid of key and door, but when i relog, key change aid from 5007 to 3007 o.0
And the key dead not match to the doors.
 
buh! don't work =\

I tested with ActionID 2090 and 4001 on door and say: The key does not match. =(

I have this script \/
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(questDoors, item.itemid) == TRUE then
if getPlayerStorageValue(cid, item.actionid) ~= -1 then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition, TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
end
return TRUE
elseif isInArray(levelDoors, item.itemid) == TRUE then
if item.actionid > 0 and getPlayerLevel(cid) >= item.actionid - 1000 then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition, TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
end
return TRUE
elseif isInArray(keys, item.itemid) == TRUE then
if itemEx.actionid > 0 then
if item.actionid == itemEx.actionid then
if doors[item.itemd] ~= nil then
doTransformItem(itemEx.uid, doors[item.itemid])
return TRUE
end
end
doPlayerSendCancel(cid, "The key does not match.")
return TRUE
end
return FALSE
elseif isInArray(horizontalOpenDoors, item.itemid) == TRUE then
local newPosition = toPosition
newPosition.y = newPosition.y + 1
local doorPosition = fromPosition
doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local doorCreature = getThingfromPos(doorPosition)
if doorCreature.itemid ~= 0 then
if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid then
doPlayerSendCancel(cid, "Sorry, not possible.")
return TRUE
else
doTeleportThing(doorCreature.uid, newPosition, TRUE)
end
end
doTransformItem(item.uid, item.itemid - 1)
return TRUE
elseif isInArray(verticalOpenDoors, item.itemid) == TRUE then
local newPosition = toPosition
newPosition.x = newPosition.x + 1
local doorPosition = fromPosition
doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local doorCreature = getThingfromPos(doorPosition)
if doorCreature.itemid ~= 0 then
if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid then
doPlayerSendCancel(cid, "Sorry, not possible.")
return TRUE
else
doTeleportThing(doorCreature.uid, newPosition, TRUE)
end
end
doTransformItem(item.uid, item.itemid - 1)
return TRUE
elseif doors[item.itemid] ~= nil then
if item.actionid == 0 then
doTransformItem(item.uid, doors[item.itemid])
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
end
return TRUE
end
return FALSE
end

Help-Me Please!

Cya.
 
Copy and paste this doors.lua and it will work.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(questDoors, item.itemid) == TRUE then
if getPlayerStorageValue(cid, item.actionid) ~= -1 then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition, TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
end
return TRUE
elseif isInArray(levelDoors, item.itemid) == TRUE then
if item.actionid > 0 and getPlayerLevel(cid) >= item.actionid - 1000 then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition, TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
end
return TRUE
elseif isInArray(keys, item.itemid) == TRUE then
if itemEx.actionid > 0 then
if item.actionid == itemEx.actionid then
if doors[itemEx.itemid] ~= nil then
doTransformItem(itemEx.uid, doors[itemEx.itemid])
return TRUE
end
end
doPlayerSendCancel(cid, "The key does not match.")
return TRUE
end
return FALSE
elseif isInArray(horizontalOpenDoors, item.itemid) == TRUE then
local newPosition = toPosition
newPosition.y = newPosition.y + 1
local doorPosition = fromPosition
doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local doorCreature = getThingfromPos(doorPosition)
if doorCreature.itemid ~= 0 then
if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid then
doPlayerSendCancel(cid, "Sorry, not possible.")
return TRUE
else
doTeleportThing(doorCreature.uid, newPosition, TRUE)
end
end
doTransformItem(item.uid, item.itemid - 1)
return TRUE
elseif isInArray(verticalOpenDoors, item.itemid) == TRUE then
local newPosition = toPosition
newPosition.x = newPosition.x + 1
local doorPosition = fromPosition
doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local doorCreature = getThingfromPos(doorPosition)
if doorCreature.itemid ~= 0 then
if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid then
doPlayerSendCancel(cid, "Sorry, not possible.")
return TRUE
else
doTeleportThing(doorCreature.uid, newPosition, TRUE)
end
end
doTransformItem(item.uid, item.itemid - 1)
return TRUE
elseif doors[item.itemid] ~= nil then
if item.actionid == 0 then
doTransformItem(item.uid, doors[item.itemid])
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
end
return TRUE
end
return FALSE
end

I ended up copying this from the Mystic Spirit (0.2.10) actions as I wanted it working for my Dead Bug ;) It was just a couple of typos in the original.

One point though, once you close a 'locked' door, it becomes locked again automatically, due to the actionId obviously. Just the way it goes I suppose.
Hope this helped.
 
Back
Top