Caduceus
Unknown Member
- Joined
- May 10, 2010
- Messages
- 321
- Solutions
- 2
- Reaction score
- 24
I have the wall removing/resetting, however, if the wall is removed, it will not return false. So the event keeps appling on reset.
Code:
local storage = 15009
local wallPos = {
[1] = {x=1227, y=768, z=5, stackpos=1}
}
local time_ = 20 -- 10 seconds
function onStepIn(cid, item, position, fromPosition)
local player = Player(cid)
if not player then
return true
end
local function reset()
-- reset wall
Game.createItem(3492, 1, wallPos[1])
end
-- check if player has storage
if player:getStorageValue(storage) < 1 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You Must Complete the Frozen Hell Quest!")
player:teleportTo(fromPosition, false)
doSendMagicEffect(pos, CONST_ME_POOF)
return false
end
-- [[If wall is down, then can not reuse again while down.
This is my problem area]]
if not item.itemid == 3492 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "The wall is down.")
return false
end
-- add reset
addEvent(reset, time_ * 1000)
-- remove walls, send message
for i = 1, #wallPos do
item:getPosition():sendMagicEffect(CONST_ME_SOUND_BLUE)
doRemoveItem(getThingfromPos(wallPos[i]).uid)
end
player:sendTextMessage(MESSAGE_INFO_DESCR, "It's dangerous out there. Enter at your own risk!")
return true
end