i lik ethis script converted into lua5, incl the addional functions i wrote in the thread:
http://board.univ-angers.fr/thread.php?threadid=2359&boardid=12&styleid=1&sid=2f3be16aeeb3237d39da8bde443c80ec
-- Stat-logger 0.3 by Troubadour
-- created a seperated config file + gui
-- Stat-logger 0.2 by Troubadour
-- to write all info to a file with the os.date of that day when users math.log in (name, e-mail, ip and share)
-- command for viewing the files is !
-- for example !280704 is the command to view the file of 28 juli 2004
-- Stat-logger 0.1 by Troubadour
-- to write all info to a file when a user logs in (name, e-mail, ip and share)
-- command to view the file is !statlog
-- Lua 5 version by Markitos (6/6/2005)
Grab it here(Not tested) (http://mznetwork.mozdesigners.com/i/forum_files/Stat-logger03.rar)
Best regards
Markitos, you also need to convert the file handling and Arrivals.
"DataArrival" should be changed to "ChatArrival" and the To: part becomes "ToArrival".
Cheers
QuoteOriginally posted by jiten
Markitos, you also need to convert the file handling and Arrivals.
"DataArrival" should be changed to "ChatArrival" and the To: part becomes "ToArrival".
Cheers
Didn't understand dis part " and the To: part becomes "ToArrival". "
It's something like this "ToArrival = ChatArrival" can u you give me an example?
Respectfully...
-- Stat-logger 0.3 by Troubadour
-- created a seperated config file + gui
-- Stat-logger 0.2 by Troubadour
-- to write all info to a file with the date of that day when users log in (name, e-mail, ip and share)
-- command for viewing the files is !
-- for example !280704 is the command to view the file of 28 juli 2004
-- Stat-logger 0.1 by Troubadour
-- to write all info to a file when a user logs in (name, e-mail, ip and share)
-- command to view the file is !statlog
D = os.date("%d")
MM = os.date("%m")
Y = os.date("%y")
statlogfile = ("Data/"..D..""..MM..""..Y..".txt")
function Main()
if io.open("Stat-logger03.cfg","r") then -- is used for the settings
dofile("Stat-logger03.cfg")
else
BOTName = "Stat-logger"
Version = "Stat-logger03"
end
frmHub:RegBot(BOTName)
if not io.open("Data/check.dat","r") then
os.execute("mkdir Data")
io.output("Data/check.dat")
io.close()
io.output()
end
SendToAll("( >>>> "..Version.." Started"..os.date(" the %d/%m-%Y at %X ").." <<<< )")
end
function ChatArrival(user,data)
data=string.sub(data,1,-2)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
cmd = string.sub(cmd, 2,string.len(cmd))
if io.open("Data/"..cmd..".txt") then
showtext(user, cmd)
return 1
end
end
function ToArrival(user,data)
s,e,cmd = string.find(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
cmd = string.sub(cmd, 2,string.len(cmd))
if io.open("Data/"..cmd..".txt") then
showtext(user, cmd)
return 1
end
end
function OpConnected(user)
description,email,share=MyInfoString(user.sMyInfoString)
local share2 = string.format("%0.2f",(share / (1024*1024*1024)))
--SendToAll("Stat-logger",user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.." Gb")
statlogfile = ("Data/"..D..""..MM..""..Y..".txt")
file=io.open(statlogfile,"a+")
file:write("\t","On the "..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - "..user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.."Gb connected \r\n")
file:close()
end
NewUserConnected = OpConnected
function MyInfoString(data)
s,e,description,nada,email,share = string.find(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
return description,email,share
end
function showtext(user, cmd)
lines = "\r\n\r\n"
for line in io.lines("Data/"..cmd..".txt") do
if line == nil then
io.close()
break
end
lines = lines..line.."\r\n"
end
user:SendPM(BOTName, lines)
end
Done!
QuoteOriginally posted by Markitos
QuoteOriginally posted by jiten
Markitos, you also need to convert the file handling and Arrivals.
"DataArrival" should be changed to "ChatArrival" and the To: part becomes "ToArrival".
Cheers
Didn't understand dis part " and the To: part becomes "ToArrival". "
It's something like this "ToArrival = ChatArrival" can u you give me an example?
Respectfully...
hmm, he was talking about this :
if(strsub(data, 1, 4) == "$To:") then
when u are converting to lua 5 u change that to this :
function ToArrival(user,data)
and this two parts of code u change from this :
function DataArrival(user,data)
if( strsub(data, 1, 1) == "<" ) then
end
to this :
function ChatArrival(user,data)
Hi Dessamator,
Thank you very much for convert Troubadour's Stat-Logger into LUA5!!!
But I have one problem!
In the file for e.g.: 060605.txt -> I have only log of the newest user (who last logged on the hub)!
Older logs of users were enter on the hub didn't save into this file (The newer log rewrite older log) :(
How's that?
Thanks in adnvance for answer!
Penguin
P.S.
Sorry for my English! :rolleyes:
QuoteOriginally posted by Penguin
Hi Dessamator,
Thank you very much for convert Troubadour's Stat-Logger into LUA5!!!
But I have one problem!
In the file for e.g.: 060605.txt -> I have only log of the newest user (who last logged on the hub)!
Older logs of users were enter on the hub didn't save into this file (The newer log rewrite older log) :(
How's that?
Thanks in adnvance for answer!
Penguin
P.S.
Sorry for my English! :rolleyes:
Fixed !
Post edited !
yes, thanx a lot for converting it, but as requested in the other thread, i would like this script to log on a per user base users details...
so i can do this:
+statlog [nick]
On the 06.06.05 - 16:28 - [nick] with e-mail nick@mail.com, IP 192.168.1.100 and with share 19.943974516355Gb connected
On the 07.06.05 - 16:28 - [nick] with e-mail nick@mail.com , IP 192.168.1.100 and with share 29.943974516355Gb connected
On the 07.06.05 - 22:21 - [nick] with e-mail nick@mail.com , IP 192.168.1.100 and with share 13.943974516355Gb connected
so i can log users activity
QuoteOriginally posted by sander815
yes, thanx a lot for converting it, but as requested in the other thread, i would like this script to log on a per user base users details...
so i can do this:
+statlog [nick]
On the 06.06.05 - 16:28 - [nick] with e-mail nick@mail.com, IP 192.168.1.100 and with share 19.943974516355Gb connected
On the 07.06.05 - 16:28 - [nick] with e-mail nick@mail.com , IP 192.168.1.100 and with share 29.943974516355Gb connected
On the 07.06.05 - 22:21 - [nick] with e-mail nick@mail.com , IP 192.168.1.100 and with share 13.943974516355Gb connected
so i can log users activity
no need to add that in this script, for starters a similar script already exists, userinfo database by nightlitch, and others, theres iplog which does the same too, hope u understand :)
QuoteOriginally posted by Dessamator
Fixed !
Post edited !
OK, Thank you very much Dessamator!!!
point me to them then, if possible
i have never found a script that does what i describe..
QuoteOriginally posted by sander815
point me to them then, if possible
i have never found a script that does what i describe..
As I pointed before, search for "Connection Log". It does that...
Cheers
Quote"userinfo" database by nightlitch, and others, theres "iplog" which does the same too,
click on the links in my signature and learn how to search my boy, search !
K, got a question.. does the Stat-logger 0.3 add a log for each day?.... if it does a way to keep the folder where the txt files are stored from getting huge would be nice. Maybe a clear command or del command to ..........time limit to self delete :) ..... just asking. I didnt see anyway of deleting the files except going into the scripts folder and manually doing it.
hmm,indeed thats a good point, but, how long should it stay there?
maybe be settable by the master\Op before auto delete or even yet at the very least have an option to say....... delete 050605-080205 :) ..... a range. Just an idea.
hmm, indeed, ill see what i can do ! i think ill set it to a week on default :)
--Lua 5 By Dessamator
-- Stat-logger 0.3a
-- added !lastips(request by Penguin)
-- Stat-logger 0.3 by Troubadour
-- created a seperated config file + gui
-- Stat-logger 0.2 by Troubadour
-- to write all info to a file with the date of that day when users log in (name, e-mail, ip and share)
-- command for viewing the files is !
-- for example !280704 is the command to view the file of 28 juli 2004
-- Stat-logger 0.1 by Troubadour
-- to write all info to a file when a user logs in (name, e-mail, ip and share)
-- command to view the file is !statlog
D = os.date("%d")
MM = os.date("%m")
Y = os.date("%y")
a={}
statlogfile = ("Data/"..D..""..MM..""..Y..".txt")
MaxLogins = 15
function Main()
if io.open("Stat-logger03.cfg","r") then -- is used for the settings
dofile("Stat-logger03.cfg")
else
BOTName = "Stat-logger"
Version = "Stat-logger03"
end
frmHub:RegBot(BOTName)
if not io.open("Data/check.dat","r") then
os.execute("mkdir Data")
io.output("Data/check.dat")
io.close()
io.output()
end
SendToAll("( >>>> "..Version.." Started"..os.date(" the %d/%m-%Y at %X ").." <<<< )")
end
function ChatArrival(user,data)
data=string.sub(data,1,-2)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
local n,temp=0,"The last "..MaxLogins.."logged users\r\n"
if cmd =="!lastips" then
for line in io.lines("Data/"..D..""..MM..""..Y..".txt") do
table.insert(a, line)
end
for i=table.getn(a),1, -1 do
if n temp=temp..a[i].."\r\n"
n=n+1
end
end
user:SendData(BOTName,temp)
end
cmd = string.sub(cmd, 2,string.len(cmd))
if io.open("Data/"..cmd..".txt") then
showtext(user, cmd)
return 1
end
end
function ToArrival(user,data)
s,e,cmd = string.find(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
cmd = string.sub(cmd, 2,string.len(cmd))
if io.open("Data/"..cmd..".txt") then
showtext(user, cmd)
return 1
end
end
function OpConnected(user)
description,email,share=MyInfoString(user.sMyInfoString)
local share2 = string.format("%0.2f",(share / (1024*1024*1024)))
--SendToAll("Stat-logger",user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.." Gb")
statlogfile = ("Data/"..D..""..MM..""..Y..".txt")
file=io.open(statlogfile,"a+")
file:write("\t","On the "..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - "..user.sName.." with e-mail "..email..", IP "..user.sIP.." and with share "..share2.."Gb connected \r\n")
file:close()
end
NewUserConnected = OpConnected
function MyInfoString(data)
s,e,description,nada,email,share = string.find(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
return description,email,share
end
function showtext(user, cmd)
lines = "\r\n\r\n"
for line in io.lines("Data/"..cmd..".txt") do
if line == nil then
break
end
lines = lines..line.."\r\n"
end
io.close()
user:SendPM(BOTName, lines)
end
QuoteOriginally posted by Dessamator
-- added !lastips(request by Penguin)
Hey Dessamator,
Thank you very much!!!
QuoteOriginally posted by Penguin
QuoteOriginally posted by Dessamator
-- added !lastips(request by Penguin)
Hey Dessamator,
Thank you very much!!!
no prob, btw i edited the script above, it might resolve ur prob(im unsure)
QuoteOriginally posted by Dessamator
no prob, btw i edited the script above, it might resolve ur prob(im unsure)
OK -> THX
I test it.
goody :)
Thanks for yet another awesome script :)
Well done!
QuoteOriginally posted by Dessamator
goody :)
m8, maybe it's better to post this one in the Finished Scripts section as it's a wanted one :D
Cheers
QuoteOriginally posted by jiten
QuoteOriginally posted by Dessamator
goody :)
m8, maybe it's better to post this one in the Finished Scripts section as it's a wanted one :D
Cheers
Done !
Hi
Can?t make a function in bot for me?
User join in the hub, and this bot our another, send pm for Master.
Exemple:
1? -User xxx Ip: xxxx share: xxxx description: xxx are join in the Hub.
2? -User xxx Ip: xxxx share: xxxx description: xxx are left.
QuoteOriginally posted by ?[-?Genius?-]?
Hi
Can?t make a function in bot for me?
User join in the hub, and this bot our another, send pm for Master.
Exemple:
1? -User xxx Ip: xxxx share: xxxx description: xxx are join in the Hub.
2? -User xxx Ip: xxxx share: xxxx description: xxx are left.
Looks a bit like the "IP Monitoring" script with some extra code.
QuoteOriginally posted by •[-•Genius•-]•
Hi
Can?t make a function in bot for me?
User join in the hub, and this bot our another, send pm for Master.
Exemple:
1? -User xxx Ip: xxxx share: xxxx description: xxx are join in the Hub.
2? -User xxx Ip: xxxx share: xxxx description: xxx are left.
ur obviously not serious, in a hub with more than 500 users, the master would get 500 PMs, each time the hub is restarted, in other words flooding the Master (not a good idea)