• 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 a stone with lever

xexam

New Member
Joined
Aug 3, 2010
Messages
172
Reaction score
2
I tried to make an script that when someone use the lever with it removes a stone id yyy from pos xxx... and the stones appear again in 5 minutes...

I didn't knew how to do this, can someone make it for me please?
 
If you using 0.3 +

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    removals = { -- 1304
        { x = 1491 , y = 418 , z = 15, stackpos = 1 },

    }
    
     if item.itemid == 1945 then
        for i = 1, #removals do
            doRemoveItem(getThingfromPos(removals[i]).uid, 1)
        end
		local LeverPos = {x=1486, y=456, z=12}
		doSendMagicEffect(LeverPos, CONST_ME_POFF)
		doTransformItem(item.uid, item.itemid + 1)
	end
  return TRUE
end

credits goes to Saro?

PHP:
	<action actionid="6666" event="script" value=".lua"/>
 
both of your proposition doesnt work, the stone doesnt disappear, thats the script i tried to use

Code:
local stonepos = {x=1002, y=1005, z=7, stackpos=1} -- Stone pos
function onUse(cid, item, fromPos, item2, toPos)
    if item.itemid == 1945 then
        doRemoveItem(getThingfromPos(stonepos).uid, 1)
        doTransformItem(item.uid,1946)
        addEvent(onTimer5, 2*60*1000) --2minutes
    end
return true
end

function onTimer5() --creates wall back
    doTransformItem(getThingFromPos({x=1000, y=1006, z=7, stackpos=1}).uid, 1945)--lever pos
    doCreateItem(1355,1,{x=1002, y=1005, z=7})-- Stone pos
end

Code:
<action actionid="6666" event="script" value="stone.lua"/>

and lever actionid is set to 6666

also there is no error in the console, but when i pull the lever, there is another one under it... i dont know why, the stone isnt giving a shit, it doesnt even moves

any ideas?
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local stone_id = [COLOR="red"]XXXX[/COLOR]
    local pos = [COLOR="red"]{x = 100, y = 100, z = 7}[/COLOR]
    local stone = getTileItemById(pos, stone_id)
    if stone.uid > 0 then
        doRemoveItem(stone.uid)
        addEvent(function() doCreateItem(stone_id, 1, pos) end, 5 * 60)
        return true
    else
        return doPlayerSendCancel(cid, "Sorry, not possible.")
    end
    
    return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Try to search next time ;)

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)   
    wall_pos = {x=617, y=647, z=12, stackpos=1}   
    wall = getThingfromPos(wall_pos)   
   
        if item.itemid == 1945 and wall.itemid == 1034 then  
            doSendMagicEffect(wall_pos, 10)   
                doRemoveItem(wall.uid, 1)   
                doTransformItem(item.uid, 1946)   
            addEvent(createWall, 3 * 1000)   
        elseif item.itemid == 1946 then 
            doTransformItem(item.uid, 1945)   
        else 
            doPlayerSendCancel(cid,"Sorry, not possible.") 
        end   
    return TRUE  
end   
   
function createWall()    
    doCreateItem(1034, wall_pos)  
    doSendMagicEffect(wall_pos, 10)  
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local stone_id = [COLOR="red"]XXXX[/COLOR]
    local pos = [COLOR="red"]{x = 100, y = 100, z = 7}[/COLOR]
    local stone = getTileItemById(pos, stone_id)
    if stone.uid > 0 then
        doRemoveItem(stone.uid)
        addEvent(function() doCreateItem(stone_id, 1, pos) end, 5 * 60)
        return true
    else
        return doPlayerSendCancel(cid, "Sorry, not possible.")
    end
    
    return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end


yay, the stone disappear for like 0.1 sec and re-appear, the lever dont move anyway
@edit
its the best script i tried out, because i made the stone to disappear and appear AFTER 30 sec, itso k now but the lever doesnt move yet... ill try to fix it out, thanx JDB


Try to search next time ;)

lol, i did... the script you gave me doesnt work... it doesnt even do anything yay

@EDIT, okay - i remixed JDB's script and it works perfect, thanx alot !
 
Last edited:
Back
Top