Lua:
-----------------
-- By Colandus --
_CONT = {}
function continue(delay, n, ...)
local func = debug.getinfo(2).func
if(not _CONT[func]) then
_CONT[func] = true
addEvent(repeatContinue, delay, func, delay, n, ...)
end
end
function repeatContinue(func, delay, n, ...)
if(n > 1) then
func(...)
addEvent(repeatContinue, delay, func, delay, n - 1, ...)
else
_CONT[func] = nil
end
end
Lua:
function doThatShit(cid)
if(not isCreature(cid)) then
return
end
doCreatureSay(cid, "HiHO", 1)
-- repeat 4 times (will only repeat 4 times because it count the current call as 1!) each second
continue(1000, 5, cid)
end
function onSay(cid, words, param, channel)
doThatShit(cid)
return true
end
A normal script WITHOUT this function would look like this:
Lua:
function doThatShit(cid, n)
if(not isCreature(cid)) then
return
end
doCreatureSay(cid, "HiHO", 1)
if(n > 1) then
addEvent(doThatShit, 1000, cid, n - 1)
end
end
function onSay(cid, words, param, channel)
doThatShit(cid, 5)
return true
end
NOT WHAT YOU'RE LOOKING FOR?
Check this out: http://otland.net/f163/sleep-not-beds-20193/
Last edited: