sestorme
Member
I want to create an addEvent which will constantly loop itself if a condition is met:
And of course it don't loop.
Also tried like this:
I bet it's rather easy, it's just need to be implemented in the right way.
Lua:
function run(left)
if (left > 0) then
doSendMagicEffect(getPlayerPosition(cid),5)
addEvent(run, 1000, left-1)
if (getCreatureMana(cid) >= 1) then
run(1)
end
end
run(1)
And of course it don't loop.
Also tried like this:
Lua:
function run(left)
if (left > 0) then
doSendMagicEffect(getPlayerPosition(cid),5)
addEvent(run, 1000, left-1)
if (getCreatureMana(cid) >= 1) then
function run(left)
if (left > 0) then
doSendMagicEffect(getPlayerPosition(cid),5)
addEvent(run, 1000, left-1)
end
end
run(1)
end
return true
end
end
run(1)
I bet it's rather easy, it's just need to be implemented in the right way.