Code:
local config = {
{pos = {x = 100, y = 100, z = 7}, itemid = 2112},
{pos = {x = 120, y = 110, z = 7}, itemid = 2112},
{pos = {x = 105, y = 120, z = 7}, itemid = 2112}
}
function onStepIn(cid, item, position, fromPosition)
local amount = 0
for x = 1, #config do
if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
amount = amount + 1
end
end
if amount == #config do
for x = 1, #config do
doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
end
doTeleportThing(cid, {x = 100, y = 100, z = 7}) -- where it should go
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
end
return true
end
For lever you can use function onUse.
mmm i tried it and that's what i made
made script on action for lever
<action actionid="6502" script="games/hiddenplace.lua"/> <!-- hidden place -->
after then made script on server/action/games/hiddenpalce
local config = {
{pos = {x = 979, y = 975, z = 7}, itemid = 2001},
{pos = {x = 971, y = 975, z = 7}, itemid = 2002},
{pos = {x = 970, y = 981, z = 7}, itemid = 2003},
{pos = {x = 979, y = 981, z = 7}, itemid = 2004}
}
function onStepIn(cid, item, position, fromPosition)
local amount = 0
for x = 1, #config do
if getTileItemById(config[x].pos, config[x].itemid).uid > 0 then
amount = amount + 1
end
end
if amount == #config do
for x = 1, #config do
doRemoveItem(getTileItemById(config[x].pos, config[x].itemid).uid, 1)
end
doTeleportThing(cid, {x = 1050, y = 822, z = 6}) -- where it should go
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a hidden area.")
end
return true
end
and edited it on map and made lever with uniqueid 10995
and doesn't work may you say to me what is the problem?
[30/11/2014 02:24:10] [Error - LuaScriptInterface::loadFile] data/actions/scripts/games/hiddenplace.lua:15: 'then' expected near 'do'
[30/11/2014 02:24:10] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/games/hiddenplace.lua)
[30/11/2014 02:24:10] data/actions/scripts/games/hiddenplace.lua:15: 'then' expected near 'do'