• 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 How to addEvent?

Binho®

KooL =D
Joined
May 27, 2008
Messages
344
Reaction score
0
Location
BrZ Style
How do I add an event so you can remove 6 pillars in 2 minutes?

Code:
local pillars = {
    {"3766", { x = 16495, y = 15661, z = 12, stackpos = 1 }},
    {"3766", { x = 16496, y = 15661, z = 12, stackpos = 1 }},
    {"3766", { x = 16497, y = 15661, z = 12, stackpos = 1 }},
    {"3766", { x = 16498, y = 15661, z = 12, stackpos = 1 }},
    {"3766", { x = 16499, y = 15661, z = 12, stackpos = 1 }},
    {"3766", { x = 16500, y = 15661, z = 12, stackpos = 1 }}
}

function onStepIn(cid, item, position, fromPosition)
        if(item.uid >= 36210 or item.uid <= 36215) and isPlayer(cid) == TRUE and getPlayerSlotItem(cid, 2).itemid == 8266 then
            for _, v in ipairs(pillars) do
                    doCreateItem(unpack(v))
            end
        end
end
 
Last edited:
Stop double POST...

Example:


PHP:
function removeWall(a)
	wall_pos = {x=95, y=123, z=7, stackpos=1}
        wall = getThingfromPos(wall_pos)
     doRemoveItem(wall.uid,1)
end

addEvent(removeWall,2*60*1000,a)

2*60*1000 = 2 minutes

PD: You will only need to edit the other 5 walls to be removed, use copy and paste :p

BYEBYE!
 
Stop double POST...

Example:


PHP:
function removeWall(a)
    wall_pos = {x=95, y=123, z=7, stackpos=1}
        wall = getThingfromPos(wall_pos)
     doRemoveItem(wall.uid,1)
end

2*60*1000 = 2 minutes

PD: You will only need to edit the other 5 walls to be removed, use copy and paste :p

BYEBYE!

:blink: 6 Pillars = 6 functions?!

I'ill try.
 
:blink: 6 Pillars = 6 functions?!

I'ill try.

Well if you whant to remove 6 pillars in one addEvent then use this:

PHP:
local local Position =
{
	{x = 71, y = 131, z = 7, stackpos = 1},
	{x = 72, y = 131, z = 7, stackpos = 1},
	{x = 73, y = 131, z = 7, stackpos = 1},
	{x = 74, y = 131, z = 7, stackpos = 1},
	{x = 74, y = 131, z = 7, stackpos = 1},
	{x = 74, y = 131, z = 7, stackpos = 1}
}
local pillarsID = 1497
local time = 2 -- minutes
function removePillars(a)
for i = 1, 4 do
if getThingFromPos(Position[i]).itemid == pillarsID then
doRemoveItem(getThingFromPos(Position[i]).uid, 1)
end
end

addEvent(removePillars,time*60*1000,a)

You just need to edit pillarID and Positions
 
Well if you whant to remove 6 pillars in one addEvent then use this:

PHP:
local local Position =
{
    {x = 71, y = 131, z = 7, stackpos = 1},
    {x = 72, y = 131, z = 7, stackpos = 1},
    {x = 73, y = 131, z = 7, stackpos = 1},
    {x = 74, y = 131, z = 7, stackpos = 1},
    {x = 74, y = 131, z = 7, stackpos = 1},
    {x = 74, y = 131, z = 7, stackpos = 1}
}
local pillarsID = 1497
local time = 2 -- minutes
function removePillars(a)
for i = 1, 4 do
if getThingFromPos(Position[i]).itemid == pillarsID then
doRemoveItem(getThingFromPos(Position[i]).uid, 1)
end
end
You just need to edit pillarID and Positions

I had already done this... I forgot to post.
And it has some errors in your there.

local local Position =
Changed to
local Position =
for i = 1, 4 do
Changed to
for i = 1, 6 do
Is 6 pillars and not 4.
local time = 2 -- minutes
addEvent(removePillars,time*60*1000,a)
Only can use arithmetics in addEvent and not words. Thanks!
 
Last edited:
Back
Top