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

AddEvent problem ;p

TriamerA

The Mystic One.
Joined
Nov 16, 2008
Messages
1,257
Reaction score
18
Location
Poland
Code:
  local config = {

    -- snake position 1
    snake = {x=32858, y=32526, z=11, stackpos=1}, 
	
	

	-- Time to remove snake in Seconds
    timeToRemove = 5,
	timeToRemove2 = 6,
			
    }
		

	function onUse(cid, item, fromPos, item2, toPos)	
	 if item.itemid == 4861 then
	 local getsnake = getThingfromPos(config.snake)
		    doRemoveItem(getsnake.uid)
            doCreatureSay(cid, "The cobra has been destroyed.", TALKTYPE_ORANGE_1)	
            addEvent(doCreateItem, config.timeToRemove * 1000, 4861, 1, config.snake)
			--->>> NOT WORKING addEvent(doItemSetAttribute,config.timeToRemove2 * 1000, config.snake, "actionid", 44406) 
	 else
	   doCreatureSay(cid, "?.", TALKTYPE_ORANGE_1)
	   	        doTransformItem(item.uid,item.itemid-1)
		        end
    return TRUE
end


That's my script, the only thing is not working is changing newly made item's action id

I'm getting error in my console that item is not found.


Temp solved by making itemid instead of actionid ;]
 
Last edited:
LUA:
--->>> NOT WORKING addEvent(doItemSetAttribute,config.timeToRemove2 * 1000, config.snake, "actionid", 44406)

you are not declaring the item uid

and this is the function you need

LUA:
doSetItemActionId(uid, actionid)

because doItemSetAttribute has been deprecated
 
Last edited:
try this one [0.3.6]
LUA:
local config = {
-- snake position 1
    snake = {x=32858, y=32526, z=11, stackpos=1}, 
-- Time to remove snake in Seconds
    timeToRemove = 5,
    timeToRemove2 = 6 }
        

function onUse(cid, item, fromPos, item2, toPos)    
    if item.itemid == 4861 then
        doRemoveItem(getThingfromPos(config.snake).uid)
        doCreatureSay(cid, "The cobra has been destroyed.", TALKTYPE_ORANGE_1)    
        addEvent(doCreateItem, config.timeToRemove * 1000, 4861, 1, config.snake)
        addEvent(doSetItemActionId,config.timeToRemove2 * 1000, getThingFromPos(config.snake).uid, 44406)
    else
        doCreatureSay(cid, "?.", TALKTYPE_ORANGE_1)
           doTransformItem(item.uid,item.itemid-1)
    end
return true
end
 
Back
Top