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

Solved Remove items and create

yolfran

Mapper-Chibcha
Joined
Jan 14, 2009
Messages
59
Reaction score
0
Location
Bucaramanga-Colombia!!!
Aff the changes in crying damson.....many of my scripts doesnt woork's now and I dont know how to repair them.

Like this one ,I use in poi to remove a stone,the removestone and the event work's OK,but create the stone again... not work's now.

Plix tell me how to repàir them ,here is my code:

PHP:
function onUse(cid, item, pos)
local stonePos = {x=653, y=883, z=9, stackpos=1} ----> initial positon stone
local getStone = getThingfromPos(stonePos)
    if  item.itemid == 1945 and getStone.itemid == 1304 then 
        doRemoveItem(getStone.uid,1)
        addEvent(eventAdd,70000,a)--->time to remove stone
        doTransformItem(item.uid,item.itemid+1)
    elseif item.itemid == 1946 then
        doTransformItem(item.uid,item.itemid-1)
    else
    doPlayerSendCancel(cid,"Sorry, not possible.")
    end
    return TRUE
end
function eventAdd(a)
local stone = {x=653, y=883, z=9}-----> position to create stone again
doCreateItem(1304, 1, stone)
return TRUE
end

and this ir the error in console:

[11/11/2009 12:58:43] Lua Script Error: [Action Interface]
[11/11/2009 12:58:43] in a timer event called from:
[11/11/2009 12:58:43] data/actions/scripts/quests/poi/poione.lua:eek:nUse

[11/11/2009 12:58:43] luaDoRemoveItem(). Item not found
I try to repair it, but i can't :(

thx ;P
 
Last edited:
Code:
local config = {
	pos = {x=653, y=883, z=9},
	id = 1304,
	timeToRemove = 70
}
local event = 0

local function eventAdd(leverPos)
	if getTileItemById(config.pos, config.id).uid == 0 then
		doCreateItem(config.id, 1, config.pos)
	end
	local lever = getTileItemById(leverPos, 1946).uid
	if lever > 0 then
		doTransformItem(lever, 1945)
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local getStone = getTileItemById(config.pos, config.id).uid
	if item.itemid == 1945 and getStone > 0 then 
		doRemoveItem(getStone)
		event = addEvent(eventAdd, config.timeToRemove * 1000, getThingPos(item.uid))
		doTransformItem(item.uid,item.itemid+1)
	elseif item.itemid == 1946 then
		stopEvent(event)
		if getStone == 0 then
			doCreateItem(config.id, 1, config.pos)
		end
		doTransformItem(item.uid,item.itemid-1)
	else
		return FALSE
	end
	return TRUE
end
 
Back
Top