QuoteOriginally posted by Dessamator
ok then just, show me what chatstats u are using, and we'll see !!
botname = "ChatStat"
ChatStat={}
ChatStatCounter=0
function Main()
frmHub:RegBot(botname)
end
function reset()
ChatStat={}
ChatStatCounter=0
end
function save_stats(user)
remove("chatstat.dat")
local handle=openfile("chatstat.dat","a")
write(handle,ChatStatCounter.."\n")
for a,b in ChatStat do
write(handle,a.."?"..b.."\n")
end
closefile(handle)
user:SendPM(botname,"Chatstat has been successfully saved ...")
end
function load_stats(user)
local handle=openfile("chatstat.dat","r")
ChatStatCounter=read(handle)
Poll={}
while 1 do
local line = read(handle)
if line == nil then break
else
x,y,a=strfind(line,"([^?]*)")
x,y,b=strfind(line,"([^?]*)$")
SendToAll("DEBUG",a..""..b)
ChatStat[a]=tonumber(b)
end
end
closefile(handle)
user:SendPM(botname,"Chatstat has been successfully loaded ...")
end
function show_top5(userobj)
local index1, key1
local index2, key2
local index3, key3
local index4, key4
local index5, key5
key1=0
key2=0
key3=0
key4=0
key5=0
for a,b in ChatStat do
if (ChatStat[a]>key1) then
index5=index4
key5=key4
index4=index3
key4=key3
index3=index2
key3=key2
index2=index1
key2=key1
index1=a
key1=ChatStat[a]
else
if (ChatStat[a]>key2) then
index5=index4
key5=key4
index4=index3
key4=key3
index3=index2
key3=key2
index2=a
key2=ChatStat[a]
else
if (ChatStat[a]>key3) then
index5=index4
key5=key4
index4=index3
key4=key3
index3=a
key3=ChatStat[a]
else
if (ChatStat[a]>key4) then
index5=index4
key5=key4
index4=a
key4=ChatStat[a]
else
if (ChatStat[a]>key5) then
index5=a
key5=ChatStat[a]
end
end
end
end
end
end
userobj:SendPM(botname,"Top 5 poster in this hub : \r\n")
userobj:SendPM(botname,"* Nr. Posts : Name..........")
if (index1~=nil) then
userobj:SendPM(botname,"* 1. "..ChatStat[index1].." : "..index1)
end
if (index2~=nil) then
userobj:SendPM(botname,"* 2. "..ChatStat[index2].." : "..index2)
end
if (index3~=nil) then
userobj:SendPM(botname,"* 3. "..ChatStat[index3].." : "..index3)
end
if (index4~=nil) then
userobj:SendPM(botname,"* 4. "..ChatStat[index4].." : "..index4)
end
if (index5~=nil) then
userobj:SendPM(botname,"* 5. "..ChatStat[index5].." : "..index5)
end
end
function GetCommand(data)
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
return cmd
end
function DataArrival(user, data)
if (( strsub(data, 1, 1) == "<" ) or ( strsub(data, 1, 4) == "$To:" )) then
if (ChatStat[user.sName] == nil) then
ChatStat[user.sName]=1
else
ChatStat[user.sName]=ChatStat[user.sName]+1
end
ChatStatCounter=ChatStatCounter+1
end
if(strsub(data, 1, 4) == "$To:") then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
cmd=strsub(cmd,1,strlen(cmd)-1)
if (whoTo == botname) then
if (cmd=="+showstat")then
show_top5(user)
end
if (user.bOperator) then
if (cmd=="+savestat")then
save_stats(user)
end
if (cmd=="+loadstat")then
load_stats(user)
end
end
end
end
end
i tryid thous you gave to mi and thous cmd text from the script
what ptokax version are u using?, and if ur using the new ptokax , search for the script in the lua5 section, and the commands are the first ones i posted !