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

Remove walla x time

Sweetlove

Member
Joined
Jun 22, 2009
Messages
270
Reaction score
14
Location
Sverige
Hello!

i got this script, works fine.. but i want it to teleport player x+1 if get players pos where the wall is being spawned back at.

Code:
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 = 1000 -- 5 sec.
local reset_after = 10 * 1000 -- 60 seconds
local wall_id = 1543 -- itemid of the walls
local walls = { -- wall positions
    {x=825, y=1099, z=6}
}

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
 
Where and when should the player be teleported, what do you mean by: "i want it to teleport player x+1 if get players pos"?
 
If he stand on the location the wall is when it comes back i want the player to be teleproted either < > v ^ , dosnt rly matter

Also! would it be possible to put exhaustion on the lever? cuz if ppl spam the lever while the wall is removed errors will appear in console
 
Inside reset_walls, you just need to check if a player is in position, if so, teleport him to another position.
 
Back
Top