• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Pull lever, remove stone x minute

freddzor11

Member
Joined
May 25, 2009
Messages
695
Reaction score
5
I have tried every script at otland and none works (0.3.6)

I want a script, when you pull lever you remove a stone in x minutes and then it comes back again
and message if pulled.
 
Try this:
Code:
local config ={
    pos = {x=1000, y=1000, z=7},
    itemid = 1304,
    time = 60
}

local function Remove(fromPosition)
    doCreateItem(config.itemid, 1, config.pos)
    doTransformItem(getTileItemById(fromPosition, 1946).uid, 1945)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        doRemoveItem(getTileItemById(config.pos, config.itemid).uid)
        addEvent(Remove, config.time * 1000, fromPosition)
        doTransformItem(item.uid, 1946)
    elseif item.itemid == 1946 then
        if getTileItemById(config.pos, config.itemid).uid > 0 then
            doTransformItem(item.uid, 1945)
        else
            doPlayerSendCancel(cid, "It seems the lever has been already used.")
        end       
    end
    return true
end
 
Try this:
Code:
local config ={
    pos = {x=1000, y=1000, z=7},
    itemid = 1304,
    time = 60
}

local function Remove(fromPosition)
    doCreateItem(config.itemid, 1, config.pos)
    doTransformItem(getTileItemById(fromPosition, 1946).uid, 1945)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        doRemoveItem(getTileItemById(config.pos, config.itemid).uid)
        addEvent(Remove, config.time * 1000, fromPosition)
        doTransformItem(item.uid, 1946)
    elseif item.itemid == 1946 then
        if getTileItemById(config.pos, config.itemid).uid > 0 then
            doTransformItem(item.uid, 1945)
        else
            doPlayerSendCancel(cid, "It seems the lever has been already used.")
        end     
    end
    return true
end
WORKS THANK YOU! SOLVED!
 
Back
Top