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

doRemoveItem

SasirO

Banned User
Joined
Apr 30, 2009
Messages
559
Reaction score
0
This script is working just the removeitem funcion not, after steping on a tile im getting teleported and a stone appears but its not getting removed after 10 seconds...

Code:
function onStepIn(cid, item, frompos, item2, topos) 

local stone_pos = {x=32826, y=32274, z= 11}
playerpos = getPlayerPosition(cid) 
novapos = {x=32826, y=32273, z=12} 
if item.uid == 14550 and isPlayer(cid) == TRUE then
doTeleportThing(cid, novapos)
 doCreateItem(1285,1,stone_pos)
 addEvent(reCreate, 10*1000)
end 
return true
end

function reCreate()
doRemoveItem(1285,1,stone_pos)
return TRUE
end


Code:
[27/06/2009 14:42:12] in a timer event called from: 
[27/06/2009 14:42:12] data/movements/scripts/pitsofinferno/poi_glowny.lua:onStepIn

[27/06/2009 14:42:12] luaDoRemoveItem(). Item not found
 
Code:
local stonePos = {x=32826, y=32274, z= 11}
local novaPos = {x=32826, y=32273, z=12} 

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
        for _i, i in ipairs(tileChecker(pos)) do
            if isInArray(t, i) then
                pos.stackpos = _i
                ret = getThingFromPos(pos).uid
                break
            end
        end
    end
    return ret
end

local function reCreate()
    doRemoveItem(findItem(stonePos, {1285}))
end

function onStepIn(cid, item, position, fromPosition)
    if (item.uid == 14550 and isPlayer(cid) == TRUE) then
        doTeleportThing(cid, novaPos)
        doCreateItem(1285, 1, stonePos)
        addEvent(reCreate, 10 * 1000)
    end 
    return TRUE
end



tileChecker(pos) and findItem(pos, t) can be usefull, especialy for people who dont know use stackpos (:
 
maybe instead of tons of function use it?:

PHP:
local stone_pos = {x=32826, y=32274, z= 11}
playerpos = getPlayerPosition(cid) 
novapos = {x=32826, y=32273, z=12} 
if item.uid == 14550 and isPlayer(cid) == TRUE then
doTeleportThing(cid, novapos)
 doCreateItem(1285,1,stone_pos)
 addEvent(reCreate, 10*1000)
end 
return true
end

function reCreate()
stoneI = getTileItemById(stone_pos,1285)
if stoneI.itemid == 1285 then
doRemoveItem(stoneI.uid,1)
end
return TRUE
end
 
Back
Top