here is a little something from me to you all that want to use it:
--###------------------------------------------------------###--
-- Standalone Userinfo Database
-- Created by NightLitch (2005)
--###------------------------------------------------------###--
tSet = {}
tSet.BotName = "-Database-"
tSet.Weeks = 2
--###------------------------------------------------------###--
sMyINFO = {}
sTIME = {}
sIP = {}
tFunc = {}
tFunc.LoadFile = function(filename,table)
local file,err = io.open(filename, "r")
if err then tFunc.SaveFile(filename, table) return 1 end
for line in file:lines() do
local s,e,nick,value = string.find(line, "(%S+)%|(.*)")
if nick and value ~= "" then
table[nick] = value
end
end
file:close()
end
tFunc.SaveFile = function(filename,table)
local file,err = io.open(filename, "w")
for nick, value in table do
file:write(nick.."|"..value.."\n")
end
file:close()
end
tFunc.Add = function(nick,value,table)
table[nick] = value
end
tFunc.Remove = function(nick,value,table)
table[nick] = nil
end
tFunc.GetTime = function()
local T = {}
for a,b in os.date("*t") do T[a] = b end
local time = os.time({year = T.year,month = T.month,day = (T.day+(tSet.Weeks*7)),hour = T.hour,min = T.min,sec = T.sec,isdst = T.isdst})
return time
end
tFunc.Cleaner = function()
local t,c = 0,0
for sNick,sTime in sTIME do
t = t + 1
if os.time() > tonumber(sTime) then
c = c + 1
sTIME[sNick] = nil
sMyINFO[sNick] = nil
sIP[sNick] = nil
end
end
OnExit()
return "*** "..c.." / "..t.." users have been deleted from database ***"
end
tFunc.List = function()
local line = "\r\n"
line = line .. "\r\n -----###-----------------------------------------------------------------------------------------------------------------------------------------------------------------###-----"
line = line .. "\r\n # Current Clean List # "
line = line .. "\r\n -----###-----------------------------------------------------------------------------------------------------------------------------------------------------------------###-----"
for sNick,sTime in sTIME do
if os.time() > tonumber(sTime) then
line = line .. "\r\n\t "..sNick.." is last seen "..os.date("%A %d %B %Y (%H:%M:%S)", tonumber(sTime))
end
end
line = line .. "\r\n -----###-----------------------------------------------------------------------------------------------------------------------------------------------------------------###-----"
return line
end
tFunc.Online = function(nick)
if GetItemByName(nick) then return "Online" else return "Offline" end
end
tFunc.Find = function(value)
if string.find(value, "%d+%.%d+%.%d+%.%d+") then
local line = "*** Users found on IP: "..value..": \r\n\r\n"
for nick,ip in sIP do
if ip == value then
line = line .. "\t "..nick.." ("..tFunc.Online(nick)..")\r\n"
end
end
return line
else
local tUser = GetItemByName(value)
if tUser then
return tUser
else
for nick,ip in sIP do
if string.lower(value) == string.lower(nick) then
return {sName = nick, sIP = sIP[nick], sMyInfoString = sMyINFO[nick]}
end
end
end
end
return
end
tFunc.SplitMyInfoString = function(MyINFO,table)
local _,_,Descr,Speed,Mail,Share = string.find(MyINFO, "%$MyINFO %$ALL %S+ (.*)%$ %$(.*)%$(%S*)%$%s*(%-*%d*)%$%|$")
local _,_,Tag = string.find(Descr, "(%b<>)$")
Tag = Tag or ""
Descr = string.sub(Descr, 1,string.len(Descr) - string.len(Tag))
Speed = string.sub(Speed, 1,string.len(Speed) - 1)
table["sDescription"] = Descr table["sTag"] = Tag table["sConnection"] = Speed table["sEmail"] = Mail table["iShareSize"] = tFunc.ShareUnit(tonumber(Share))
if Tag == "" then return table end
local Limiter = {["B"] = "(%d+)",["L"] = "(%d+)",["F"] = "%d+%/(%d+)"}
local Mode = {["A"] = "Active",["P"] = "Passive", ["5"] = "Socket"}
local TagString, TagTable = Tag, {}
TagString = string.sub(TagString,1,string.len(TagString)-1)
TagString = TagString..","
string.gsub( TagString, "(.):([^,]+),", function( letter, value ) if letter == "O" then return "" end if Limiter[letter] then _,_,value = string.find(value, Limiter[letter]) end TagTable[letter] = value end)
local _,_,sClient = string.find(TagString, "^(<%S+)%s+")
hubs = 0
if tonumber(TagTable["H"]) == nil then string.gsub(TagTable["H"], "(%d+)", function (num) hubs = hubs +tonumber(num) end) else hubs = tonumber(TagTable["H"]) end
table["sClient"] = sClient
table["sClientVersion"] = TagTable["V"]
table["sMode"] = Mode[TagTable["M"]]
table["iBlimit"] = TagTable["B"] or TagTable["L"] or TagTable["F"] or "unlimited"
table["iSlots"] = TagTable["S"]
table["iHubs"] = hubs
return table
end
tFunc.ShareUnit = function(intSize)
if tonumber(intSize) ~= 0 then
local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
intSize = tonumber(intSize);
local sUnits;
for index = 1, table.getn(tUnits) do
if(intSize < 1024) then
sUnits = tUnits[index];
break;
else
intSize = intSize / 1024;
end
end
return string.format("%0.1f %s",intSize, sUnits);
else
return "0 Bytes"
end
end
function NewUserConnected(sUser)
tFunc.Add(sUser.sName,sUser.sIP, sIP)
tFunc.Add(sUser.sName,sUser.sMyInfoString, sMyINFO)
tFunc.Add(sUser.sName,tFunc.GetTime(), sTIME)
end
function UserDisconnected(sUser)
tFunc.Add(sUser.sName,sUser.sIP, sIP)
tFunc.Add(sUser.sName,sUser.sMyInfoString, sMyINFO)
tFunc.Add(sUser.sName,tFunc.GetTime(), sTIME)
end
OpConnected = NewUserConnected
OpDisconnected = UserDisconnected
function Main()
tFunc.LoadFile("sMyINFO.dat", sMyINFO)
tFunc.LoadFile("sIP.dat", sIP)
tFunc.LoadFile("sTIME.dat", sTIME)
end
function OnExit()
tFunc.SaveFile("sMyINFO.dat", sMyINFO)
tFunc.SaveFile("sIP.dat", sIP)
tFunc.SaveFile("sTIME.dat", sTIME)
end
function ChatArrival(sUser,sData)
local _,_,Cmd,Arg = string.find(sData, "%b<>%s*(%S+)%s*(.*)%|")
if Cmd == "!cleanlist" and sUser.bOperator then
sUser:SendData(tSet.BotName, tFunc.List() )
return 1
elseif Cmd == "!clean" and sUser.bOperator then
local msg = tFunc.Cleaner()
SendToAll(tSet.BotName, msg)
elseif Cmd == "!getinfo" and sUser.bOperator then
local s,e,value = string.find(Arg, "(%S+)")
if value == nil then sUser:SendData(tSet.BotName, "*** Syntax: !getinfo ") return 1 end
local usr = tFunc.Find(value)
if usr == nil then sUser:SendData(tSet.BotName, "*** Nothing found on "..value) return 1
elseif type(usr) == "string" then sUser:SendData(tSet.BotName, usr) return 1
elseif type(usr) == "table" then
usr = tFunc.SplitMyInfoString(usr.sMyInfoString,usr)
local line = ""
line = line .. "\r\n -----###-----------------------------------------------------------------------------------------------------------------------------------------------------------------###-----"
line = line .. "\r\n # Information on: "..value.." # "
line = line .. "\r\n -----###-----------------------------------------------------------------------------------------------------------------------------------------------------------------###-----"
line = line .. "\r\n Nickname: "..usr.sName
line = line .. "\r\n IP: "..usr.sIP
line = line .. "\r\n Client: "..usr.sClient.." v."..usr.sClientVersion
line = line .. "\r\n Share: "..usr.iShareSize
line = line .. "\r\n Mode: "..usr.sMode
line = line .. "\r\n Slots: "..usr.iSlots
line = line .. "\r\n Hubs: "..usr.iHubs
line = line .. "\r\n Bandwidth: "..usr.iBlimit
line = line .. "\r\n Description: "..usr.sDescription
line = line .. "\r\n Tag: "..usr.sTag
line = line .. "\r\n Connection Speed: "..usr.sConnection
line = line .. "\r\n Email: "..usr.sEmail
line = line .. "\r\n Status: "..tFunc.Online(usr.sName)
line = line .. "\r\n Last Login: "..os.date("%A %d %B %Y (%H:%M:%S)", tonumber(sTIME[usr.sName]) )
line = line .. "\r\n -----###-----------------------------------------------------------------------------------------------------------------------------------------------------------------###-----"
sUser:SendData(tSet.BotName, line)
return 1
end
end
end
report errors and other things...
Cheers // NightLitch
hmmm, looks a lot cleaner than ur other code, and more optimized as well, well done !
QuoteOriginally posted by Dessamator
hmmm, looks a lot cleaner than ur other code, and more optimized as well, well done !
Question is does it work OK that is what I need to know...
The cleaner part that is...
Other then that it could be some minior bugs, but what doesn't have bugs. ;)
yah sure ill test it, but dont worry there's gonna be a lot of testers soon, and bugs will arise as always, :)
can u add this function and for registered users?
thx
Having an IP history of the queried nick would also be very good...
Thanks..
Getting "Saturday 20 August 2005" like Last login query results for queries made in "Saturday 23 August 2005".. Date is buggy..
I tried to correct but couldnt succeed due to being unable where this error happens from. Anyone can correct that?
Some one can correct that date bug? Please :(
Maybe some of you would like to try this (http://ptxscriptdb.psycho-chihuahua.net/download.php?view.83), as many requests are covered.
bastya_elvtars, your script is really good and nearly what I need but;
- iprange info command locks computer, i couldnt find why
- Instead of
local v,u=bytestoh(Share)[/li][/list]
msg=msg.."Shared: "..sUsersShare.." "..u.."\r\n"..
this local v,u=bytestoh(Share)
local sUsersShare = string.format( "%.2f",v)
msg=msg.."Shared: "..sUsersShare.." "..u.."\r\n"..
kinda things would be much useful
BTW thanks for the script..
QuoteOriginally posted by GeceBekcisi
iprange info command locks computer, i couldnt find why
Yeah, I saw it, and frankly, I don't know the reason at the moment, but already inspecting.
-- // EDIT
It crashed PtokaX here. I think it is weird, because it worked fine with the previous version. Gonna build a coroutine for the range info, maybe that helps, because this shouldnt't happen.
QuoteOriginally posted by GeceBekcisi
Instead of local v,u=bytestoh(Share)
msg=msg.."Shared: "..sUsersShare.." "..u.."\r\n"..
this local v,u=bytestoh(Share)
local sUsersShare = string.format( "%.2f",v)
msg=msg.."Shared: "..sUsersShare.." "..u.."\r\n"..
kinda things would be much useful
Oh, yes, I way lowe loooooooong decimal numbers. The bytestoh function does not format the string it returns, you have to do it yourself, feel free to edit my scripts.
Found and eliminated the bug. Please update (http://ptxscriptdb.psycho-chihuahua.net/download.php?view.84).
Two requests.
1. Option to disable inbuilt right click commands. It looks kind of stupid now when at my hub I have all mouse commands translated in finnish. All but dabase's.
2. Profile names aren't same in every hub. In my case all my op's are vip's at userinfo and so on.
Bastya? Im having a problem with the script. Im using robocop as security software, and im having a netfounder profile, which im using....and the script wont recognize me as operator so i cant use it....you have a quick fix for this problem?
QuoteOriginally posted by Herman
Bastya? Im having a problem with the script. Im using robocop as security software, and im having a netfounder profile, which im using....and the script wont recognize me as operator so i cant use it....you have a quick fix for this problem?
It is not designed to use nonstandard profiles, it can be changed to support it, but I cannot do it for you now.
my guess would be to edit the line
local proftable={[0]="Superoperator",[1]="Operator",[2]="VIP",[3]="Registered User"}
to match your Profile settings
but then on the other hand i'm still a bit of a noob in scripting myself :D
QuoteOriginally posted by Psycho_Chihuahua
my guess would be to edit the line
local proftable={[0]="Superoperator",[1]="Operator",[2]="VIP",[3]="Registered User"}
to match your Profile settings
but then on the other hand i'm still a bit of a noob in scripting myself :D
Well, i tried adding netfounder to that line...but it didnt work. When i use the !getinfo command on a netfounder, it says he is a "user"
hello
how can i change the rightclick name in your userinfo script bastya_elvtars ? i whant to change the name from Userinfo to -=] UserInfo [=- but i dont see where to do it in the script ?(
cheers
QuoteOriginally posted by GrinSlaW
hello
how can i change the rightclick name in your userinfo script bastya_elvtars ? i whant to change the name from Userinfo to -=] UserInfo [=- but i dont see where to do it in the script ?(
cheers
In the lua file at the top you see this:
-- Bot's data
Bot={
name="-UserInfo-"
Change -UserInfo- to the name you want your bot to be called
umh thats where i change the bot name i know that. The questions was where i change the rightclick name
tnx anyway :)
cheers
QuoteOriginally posted by GrinSlaW
umh thats where i change the bot name i know that. The questions was where i change the rightclick name
tnx anyway :)
cheers
Think you have to change the names in the rigstration commands at the bottom of the file.
Dunno what tho, if not helped by bastya, you could just use the trial and error way
i have tried that just get syntax error when i change there
yes hope bastya will post some help :)
*EDIT* found out where it was it was not so hard if you read the script properly then i found it :)
cheers
QuoteOriginally posted by GrinSlaW
i have tried that just get syntax error when i change there
yes hope bastya will post some help :)
*EDIT* found out where it was it was not so hard if you read the script properly then i found it :)
cheers
Sorry for not posting the solution, I could not use my HDDs for a while, otherwise I would post a fix. Gotta create a lecture now... later...
well i had a look trough the script and it looks like the whole script is based on the botname ... so i guess its not possible to change rightclick without rewriting the script... or?
guess i found it
here you go
if not PM then
rightclick["$UserCommand "..context.." Userinfo\\"..name.."$<%[mynick]> "..command.."|"]=level
else
rightclick["$UserCommand "..context.." Userinfo\\"..name.."$$To: "..Bot.name.." From: %[mynick] $<%[mynick]> "..command.."|"]=level
end
just change where it says "userinfo\\" to what ever...like ex "]userinfo[\\"
worked here
Hey bastya? could you add so i can use NetFounder profile with the db?
QuoteOriginally posted by Herman
Hey bastya? could you add so i can use NetFounder profile with the db?
Post your Profiles.xml.
QuoteOriginally posted by bastya_elvtars
QuoteOriginally posted by Herman
Hey bastya? could you add so i can use NetFounder profile with the db?
Post your Profiles.xml.
Master
1111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Operator
1001111110110011111001100010111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
VIP
0000000000000001111000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Reg
0000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Moderator
1111111110110011111011100110111101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
NetFounder
1111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Isnt it possible to make the Netfounder profile recieve the Usrinfo bot commands?
QuoteOriginally posted by Psycho_Chihuahua
my guess would be to edit the line
local proftable={[0]="Superoperator",[1]="Operator",[2]="VIP",[3]="Registered User"}
to match your Profile settings
but then on the other hand i'm still a bit of a noob in scripting myself :D
i guess for you it would probably be something like
local proftable={[0]="Master",[1]="Operator",[2]="VIP",[3]="Registered User",[4]="Moderator",[5]="Netfounder"}
Getting this error with bastya_evltars script
Syntax ...d Settings\user\Desktop\PtokaX1\scripts\UserInfo.lua:561: ...d Settings\user\Desktop\PtokaX1\scripts\UserInfo.lua:524: attempt to index local `f' (a nil value)
My script contains a serious flaw and I strongly discourage using it. I will post a fixed version soon, in case you need it.
Thnx i would appretiate it
Errh, are this tread dead? Wonder if you have updated the userinfo script bast. :))
I would like use this script if there's any progress on it or a similar script if sum1 can point me in the right direction?
Many thanx.
I am sorry, but working on it, won't be released until the new PtokaX.