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

addEvent not functioning

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
Here is my script, everything works fine except for the addEvents

LUA:
local pos = {x=419,  y=1325,  z=8}

function onUse(cid, item, frompos, itemEx, topos)
	if getPlayerItemCount(cid, 2087) >= 1 and item.itemid == 7106 then
			doRemoveItem(getTileItemById(pos,7106).uid,1)
			addEvent(one(), 100, cid)
		return true
	end

local function one()
	addEvent(respawn(), 900, cid)
end

local function respawn()
	doTileAddItem(pos, 7106)
end

end
 
You only have to use 1 addEvent, just write the function in the addEvent without () and remove , cid. Also the time is in milliseconds, so 100 is a bit fast. 1000 = 1 sec.
Use this for creating the item.
LUA:
doCreateItem(7106,1,pos)
 
I highly suggest making a script to remove the item, then make it so the tile on the other side is what creates the wall. making a time limit allows other players to be able to walk through, or other various problems... anyway here is the scirpt you posted.

LUA:
local pos = {x=419,  y=1325,  z=8}
 
function onUse(cid, item, frompos, itemEx, topos)
	if getPlayerItemCount(cid, 2087) >= 1 and item.itemid == 7106 then
			doRemoveItem(getTileItemById(pos,7106).uid,1)
			addEvent(respawnTile, 1500, cid)
		else
			doPlayerSendCancel(cid, "You dont have the items needed!")
		return false
		end
		return true
	end
 
local function respawnTile()
	doCreateItem(7106, 1, pos)
end
 
I highly suggest making a script to remove the item, then make it so the tile on the other side is what creates the wall. making a time limit allows other players to be able to walk through, or other various problems... anyway here is the scirpt you posted.

LUA:
local pos = {x=419,  y=1325,  z=8}
 
function onUse(cid, item, frompos, itemEx, topos)
	if getPlayerItemCount(cid, 2087) >= 1 and item.itemid == 7106 then
			doRemoveItem(getTileItemById(pos,7106).uid,1)
			addEvent(respawnTile, 1500, cid)
		else
			doPlayerSendCancel(cid, "You dont have the items needed!")
		return false
		end
		return true
	end
 
local function respawnTile()
	doCreateItem(7106, 1, pos)
end

No that is not recommended :P That way it will be easier too boost players though.

- - - Updated - - -

Thread: addEvent not functioning
cuz your cool

Who reped this o.O?
 
LUA:
local pos = {x=419,  y=1325,  z=8}
 
function onUse(cid, item, frompos, itemEx, topos)
	if getPlayerItemCount(cid, 2087) >= 1 and item.itemid == 7106 then
			doRemoveItem(getTileItemById(pos,7106).uid,1)
			addEvent(respawnTile, 1500, cid)
		else
			doPlayerSendCancel(cid, "You dont have the items needed!")
		return false
		end
		return true
	end
 
local function respawnTile()
	doCreateItem(7106, 1, pos)
end
 
Don't use cid in the addEvent like I said in my post and don't use return false (just remove it) with onUse if you already having a cancel message.
 
Back
Top