• 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 isn't working.

luq14

Cookie Cotton Joe's
Joined
Apr 4, 2008
Messages
93
Reaction score
18
Location
Somewhere near sea.
Hello,
It was working perfectly on tfs 0.3.5pl1 for 8.50 client, but on 0.3.6 for 8.54 everything is working except creating stones after delay.

function onUse(cid, item, frompos, item2, topos)
wall1 = {x=695, y=1131, z=13, stackpos=1}
getwall1 = getThingfromPos(wall1)
wall2 = {x=695, y=1132, z=13, stackpos=1}
getwall2 = getThingfromPos(wall2)

if item.actionid == 8765 and item.itemid == 1945 then
doRemoveItem(getwall1.uid,1)
doRemoveItem(getwall2.uid,1)
doTransformItem(item.uid,item.itemid+1)
doCreatureSay(cid,"You have removed stones. They will appear in 3 minutes.", TALKTYPE_ORANGE_1)
addEvent(createwall, (1000*180))
elseif item.actionid == 8765 and item.itemid == 1946 then
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end

return 1
end

function createwall()
if getThingfromPos({x=695, y=1131, z=13, stackpos=1}).itemid < 1354 then
doCreateItem(1354,1,wall1)
doCreateItem(1354,1,wall2)
return TRUE
end
end

Please help, thank you.
Xiddi
 
Code:
local createWall, event = function()
	doCreateItem(1354, 1, {x=695, y=1131, z=13})
	doCreateItem(1354, 1, {x=695, y=1132, z=13})
end, 0

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById({x=695, y=1131, z=13}, 1354).uid)
		doRemoveItem(getTileItemById({x=695, y=1132, z=13}, 1354).uid)
		doTransformItem(item.uid, 1946)
		doCreatureSay(cid, "You have removed stones. They will reappear in 3 minutes.", TALKTYPE_ORANGE_1)
		event = addEvent(createWall, 3 * 60 * 1000)
	elseif item.itemid == 1946 then
		stopEvent(event)
		createWall()
		doTransformItem(item.uid, 1945)
	end
	return true
end
 
Back
Top