hello i am making a quest, and i want to have levers to pull and when i pull the levers the wall will disappear.
yes it works but if some one stands on the wall spawn position when it is about to spawn so does it bugg and no wall will be spawned. and this leads to cheating and sutch.
this is my current script:
Does some one know if it is posible to make some kind of reset, and that it checks if the wall is there or not?
thanks
yes it works but if some one stands on the wall spawn position when it is about to spawn so does it bugg and no wall will be spawned. and this leads to cheating and sutch.
this is my current script:
PHP:
function del(pos, id)
local thing = getTileItemById(pos, id).uid
if thing > 0 then
doRemoveItem(thing)
end
end
function reset_walls(pos, id)
local thing = getTileItemById(pos, id).uid
if thing < 1 then
doCreateItem(id, 1, pos)
end
end
function reset_lever(pos)
local lev = getTileItemById(pos, 1946).uid
if lev > 0 then
doTransformItem(lev, 1945)
end
end
local eventLever = 0
local eventDel = {}
local eventReset = {}
local pause = 5000 -- 5 sec.
local reset_after = 10 * 1000 -- 10 seconds
local wall_id = 1498 -- itemid of the walls
local walls = { -- wall positions
{x=414, y=252, z=11}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
for i = 1, #walls do
eventDel[i] = addEvent(del, pause * i, walls[i], wall_id)
eventReset[i] = addEvent(reset_walls, reset_after + pause * i, walls[i], wall_id)
end
eventLever = addEvent(reset_lever, reset_after + pause * #walls, fromPosition)
elseif item.itemid == 1946 then
stopEvent(eventLever)
for i = 1, #eventDel do
stopEvent(eventDel[i])
end
for i = 1, #eventReset do
stopEvent(eventReset[i])
end
for i = 1, #walls do
reset_walls(walls[i], id)
end
doTransformItem(item.uid, 1945)
end
return true
end
Does some one know if it is posible to make some kind of reset, and that it checks if the wall is there or not?
thanks