PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Loading on 25 June, 2005, 21:57:16

Title: Stat-logger lua 5 modified
Post by: Loading on 25 June, 2005, 21:57:16
hi ppl
i have this script in my hub

--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 = "?CIA??"

Version = "?CIA??"

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(""..BOTName.." Iniciado a"..os.date("  %d/%m-%Y as %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,"Os ultimos "..MaxLogins.." Users ke entraram\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.." com o E-mail "..email..", com este IP "..user.sIP.." E com este Share "..share2.." Gb")

statlogfile = ("Data/"..D..""..MM..""..Y..".txt")

file=io.open(statlogfile,"a+")

file:write("\t","No dia "..os.date("%d").."."..os.date("%m").."."..os.date("%y").." - "..os.date("%H")..":"..os.date("%M").." - "..user.sName.." com o E-mail : "..email..", com este IP : "..user.sIP.." E com este Share : "..share2.."Gb Conectou-se a este hub \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

it works fine but i have another one
i have 2 more commnds :   !clearlogs  and   !searchlog

can anybody put these comands in this script ?


best regards

Loading
Title:
Post by: Dessamator on 25 June, 2005, 22:16:31
try this (http://board.univ-angers.fr/thread.php?threadid=4756&boardid=26&sid=5001a8e4a066cff80f659f28f5a43c3b&page=1#11)
Title:
Post by: Loading on 25 June, 2005, 23:07:01
thanks man
i will shek if it works im my hub

best regards

Loading