If you are a script you know how to delay some actions using addEvent, but if you use something like:
you know if the player logout durig the interval you will got a error in console and you have to do it to avoid errors:
But no more...
Add this function in your lib
and then use like this way to not get errors:
PS: work only if the first param is the creature id
Code:
addEvent(doCreatureSay,5000,cid,'hail',1)
Code:
addEvent(function(cid,msg,typ)
if isPlayer(cid) then
doCreatureSay(cid,msg,typ)
end
end,5000,cid,'hail',1)
Add this function in your lib
Code:
function valid(f)
return function(p,...)
if isCreature(p) then
return f(p,...)
end
end
end
Code:
addEvent(valid(doCreatureSay),5000,cid,'hail',1)
PS: work only if the first param is the creature id