Hameq
Banned User
- Joined
- Aug 8, 2010
- Messages
- 374
- Reaction score
- 36
Hello.
Today i found bug in talk event function i mean that random player is able to spam it because "cancelNPCTalk(events)" doesn't work in my eyes, this function should stop more than 1 running event or something like that.
Look on this movie:
clip0005 - YouTube
Here is script i hope someone know what to do:
Today i found bug in talk event function i mean that random player is able to spam it because "cancelNPCTalk(events)" doesn't work in my eyes, this function should stop more than 1 running event or something like that.
Look on this movie:
clip0005 - YouTube
Here is script i hope someone know what to do:
Code:
function doCreatureSayWithDelay(cid,text,type,delay,e)
if delay<=0 then
doCreatureSay(cid,text,type)
else
local func=function(pars)
doCreatureSay(pars.cid,pars.text,pars.type)
pars.e.done = TRUE
end
e.done = FALSE
e.event = addEvent(func,delay,{cid=cid, text=text, type=type, e=e})
end
end
--returns how many msgs he have said already
function cancelNPCTalk(events)
local ret = 1
for aux = 1, table.getn(events) do
if events[aux].done == FALSE then
stopEvent(events[aux].event)
else
ret = ret + 1
end
end
events = 0
return(ret)
end
function doNPCTalkALot(msgs,interval)
local e={}
local ret={}
if interval==nil then interval=3000 end --3 seconds is default time between messages
for aux=1,table.getn(msgs) do
e[aux]={}
doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_SAY,(aux-1)*interval,e[aux])
table.insert(ret,e[aux])
end
return(ret)
end