• 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 Door need key

molik

New Member
Joined
Jul 30, 2009
Messages
40
Reaction score
0
How do you make a player only be able to go through a door while having a key in the backpack and only the player can go through, he cant help other players to enter.
i was thinking about teleporting the player but i don't know how to do it.
If someone have a good idea and could help me I'd be glad to listen
 
Last edited:
Set Key Action ID:
PHP:
<action itemid="5785" script="other/key.lua"/>

You use this ITEM on the KEY!

Lua:
local action_id = 5000
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if questStatus == TRUE then
	doSetItemActionId(cid, action_id)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your key has been changed!.")
    else
        doPlayerSendCancel(cid, "You must have completed the key quest!.")
    end
    return TRUE
end

Door:
PHP:
<action itemid="KEY_ID_HERE" script="other/key_door.lua"/>

Use this key on the DOOR.

Lua:
local action_id = 5000
local newPos = {x=100, y=100, z=7} -- Position other side of door
local questStatus = getPlayerStorageValue(cid, 12345)
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if questStatus == TRUE and item.actionid == action_id then
        doTeleportThing(cid, newPos)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may pass!")
    else
	doPlayerSendCancel(cid, "You must have the special key to enter.")
    end
    return TRUE
end
 
Last edited:
I'd like it a more explaining.
"You use this ITEM on the KEY!"
what item, the 5785?
what in the script am i going to change
I got a script making the key get a action id
Code:
local key = doPlayerAddItem(cid, 10546)
		doSetItemActionId(key, 1000)
 
I gave you the scripts you need.
Forget about any others, your just making it confusing.

All you need to change is the storage value (12345).
And the local action_id to whatever you use.

And YES, that item 5785, use it on the KEY.
(You can change it of course)
 
It will get confusing for players if they are going to use an item on a key to make it work. well thx anyway
 
Back
Top