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

Close doors in 2~3 seconds.

SnakevL

New Member
Joined
Jun 5, 2008
Messages
71
Reaction score
0
Hi! i'm needing a script that close a door opened after 2~3 seconds...

I'll give the ID of the door that i need:

1219 = Door Closed
1220 = Door Opened

1221 = Door Closed
1222 = Door Opened

So, if the door ID is "1219", the door will change do "1220" in "2" seconds. I need this for houses .. :)

Thanks!
 
Hi! i'm needing a script that close a door opened after 2~3 seconds...

I'll give the ID of the door that i need:

1219 = Door Closed
1220 = Door Opened

1221 = Door Closed
1222 = Door Opened

So, if the door ID is "1219", the door will change do "1220" in "2" seconds. I need this for houses .. :)

Thanks!

what about if someone stays in the door sqm (?)
 
well i've done the base script 8) too lazy to make it complete, anyone who understand could do the rest, GL :)

Lua:
function tileChecker(pos)
    local myTable = {}
    if (type(pos) == 'table') then
        for i = 1, 5 do
            pos.stackpos = i
            local thisID = getThingFromPos(pos).itemid
            if thisID > 1 then
                table.insert(myTable, thisID)
            end
        end
    end
    return #myTable > 0 and myTable or nil
end

local function findItem(pos, t)
    if (type(pos) == 'table' and type(t) == 'table') then
        local tmp = tileChecker(pos)
        if tmp then
            for k, i in ipairs(tmp) do
                if isInArray(t, i) then
                    pos.stackpos = k
                    ret = getThingFromPos(pos).uid
                    break
                end
            end
        end
    end
    return ret
end

function myEvent(pos, itemid)
    doTransformItem(findItem(pos, {itemid + 1}), itemid)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doTransformItem(item.uid, item.itemid + 1)
    addEvent(myEvent, 2 * 1000, fromPosition, item.itemid)
    return true
end
 
Last edited:
Back
Top