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

Open door if item in backpack?

kokosal

New Member
Joined
Feb 21, 2010
Messages
115
Reaction score
0
I want to make a door that you only can open if you have the right item in backpack, or a platform that you only can walk on if you have the right item in backpack. Can somebody please give me a script for that? :)
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

	if(isInArray(specialDoors, item.itemid)) then
	if (item.actionid == 2076 and getPlayerItemCount(cid, ID_OF_ITEM) > 0) then
		doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition)
	else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, you need item.")
		end
	return true
end
return false
end

Rep++
 
MUCH more user friendly.

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local item = 2160
local amount = 1
local position = {x=1000, y=1000, z=7}

if getPlayerItemCount(cid, item) >= 1 then
	doPlayerRemoveItem(cid, item, amount)
		doPlayerSendTextMessage(cid, "Welcome!")
			doTeleportThing(cid, position)
	else
		doPlayerSendCancel(cid, "Sorry, you need a special item.")
			return true
	end
end
 
Back
Top