PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: D-J Valhala on 22 February, 2004, 00:39:17

Title: +info
Post by: D-J Valhala on 22 February, 2004, 00:39:17
High Ya All :P Can AnyBody Posy Me A Script That Take +info From User That OffLine?
10x M8t's :P
CyA All
Title:
Post by: NightLitch on 22 February, 2004, 00:58:09
Try one of the bigger bots, CB my NXS-3 allowes it.

/NL
Title:
Post by: D-J Valhala on 22 February, 2004, 01:05:50
lol i use robocop :P i love robocop it's the best for my hub... :)
i need one script not AllInOne script...
10x
Title:
Post by: D-J Valhala on 24 February, 2004, 20:50:10
??????????????????????????????????????????????????????????????????????????????????????????????????????
:\
Title:
Post by: nErBoS on 24 February, 2004, 21:05:38
Hi,

Like NightLitch that commands are in big bots, to make one is need some serious code, and that takes time.

What type of info you want to the command show ???

Best regards, nErBoS
Title:
Post by: NightLitch on 24 February, 2004, 21:07:19
Just to make you happy...

create a folder called - UserInfo - all userinfo's will be stored there.

-- Simple Offline Info by NightLitch
-- Commands must be sent to Bot.
-- Create folder UserInfo

-- BotName --
BotName = "-Info-Bot-"
-- Prefix --
Prefix = "!"

-- Tables --
Temp = {}
Info = {}
-- Info Path --
InfoLog = "UserInfo/"

-- New User Connected --
function NewUserConnected(curUser,data)
LogInfo(curUser)
end
-- Data Arrival --
function DataArrival(curUser, data)
if strsub(data, 1, 4) == "$To:" then
local s,e,to,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
if to == BotName then
data = text
data = strsub(data,1,strlen(data)-1)
if (GetCom(curUser,data) == 1) then
return 0
else
return 0
end
end
end
end
-- Get Command --
function GetCom(curUser,data)
local _,_,cmd = strfind(data,"^%b<>%s+%"..Prefix.."(%S+)")
if cmd then
if IPCommand[cmd] and curUser.iProfile==0 then
local Com = IPCommand[cmd](curUser,data)
return 1
end
end
end
-- Commands --
IPCommand = {
["getinfo"] = function(curUser,data)
local _,_,nick = strfind( data,"%b<>%s+%S+%s+(%S+)")
if (nick == nil or nick == "") then
curUser:SendPM(BotName,"Syntax: "..Prefix.."getinfo ")
return 1
end
local IP, Profile, MyInfo = GetInfo(nick)
if IP==0 and Profile==0 and MyInfo==0 then
curUser:SendPM(BotName,"User not found.")
return 1
end
ClientTAG = {
{ " { " { " { " { "zDC++","zDC++" },{ "","MS++V" },
{ "","MS++V" },{ " { "<.P>","Phantom DC++" },}
local _,_,Nick = strfind( MyInfo, "^%$MyINFO %$ALL (%S+)%s*")
local _,_,Speed,Share = strfind( MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $([^$]+)[^$]%$[^$]*%$%s*(%d+)%$" )
local _,_,Slots = strfind( MyInfo, "S:(%d+)")
local _,_, Ver,Mode = strfind(MyInfo,"V:(%S+),M:([S,A,P])")
local _,_, Hubs = strfind(MyInfo,"H:(%x+)")
local Client = "Unknown"
for i = 1,getn(ClientTAG) do
if strfind(MyInfo,ClientTAG[i][1]) then
Client = ClientTAG[i][2]
end
end
local line = "\r\n"
line = line .. "\r\n User Info on: "..Nick
line = line .. "\r\n --------------------------------------------------------------------"
line = line .. "\r\n --------------------------------------------------------------------"
line = line .. "\r\n IP: "..IP
line = line .. "\r\n Client: "..Client
line = line .. "\r\n Version: "..Ver
line = line .. "\r\n Mode: "..Mode
line = line .. "\r\n Hubs: "..Hubs
line = line .. "\r\n Slots: "..Slots
line = line .. "\r\n Speed: "..Speed
line = line .. "\r\n Share: "..format("%.2f",Share/1024/1024/1024)
line = line .. "\r\n --------------------------------------------------------------------"
line = line .. "\r\n --------------------------------------------------------------------"
curUser:SendPM(BotName,line)
end,

}

-- Log Users Info --
function LogInfo(curUser)
Info[strlower(curUser.sName)] = {["IP"]=curUser.sIP,["PROFILE"]=curUser.iProfile,["MYINFO"]=curUser.sMyInfoString,}
SaveToFile(InfoLog..strlower(curUser.sName)..".dat" , Info , "Info")
Info = nil
Info = {}
collectgarbage()
flush()
return 1
end
-- Get Info --
function GetInfo(nick)
LoadFromFile(InfoLog..strlower(nick)..".dat")
local usr = Info[strlower(nick)]
if usr then
IP = usr["IP"]
Profile = usr["PROFILE"]
MyInfo = usr["MYINFO"]
return IP,Profile, MyInfo
else
return 0,0,0
end
end
-- Serialize --
function Serialize(tTable, sTableName, hFile, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(hFile, "hFile equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";

write(hFile, sTab..sTableName.." = {\n" );

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, hFile, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
write(hFile, sTab.."\t"..sKey.." = "..sValue);
end

write(hFile, ",\n");
end

write(hFile, sTab.."}");
end
-- Save Table to File --
function SaveToFile(file , table , tablename)
local hFile = openfile(file, "w");
Serialize(table, tablename, hFile);
closefile(hFile);
end
-- Load Table From File --
function LoadFromFile (file)
assert(readfrom(file),file.." is not found.Generating new "..file..". All is fine. Don't panic.")
dostring(read("*all"))
readfrom()
end

hope this work this is a clean rip from my NXS-3 & IP-NXS-RANGER

/NL
Title:
Post by: D-J Valhala on 25 February, 2004, 18:17:12
thank you dude but i cant see the commend... !getinfi = ptokax commend
*** Nick: shantoxcy IP: 192.117.244.37
so what can i do? and maybe you can do it? the commend can be somthing like +off usernick\ip
and again thank you m8 :)))
Title:
Post by: NightLitch on 25 February, 2004, 18:18:24
Send the command PM to bot.
Title:
Post by: D-J Valhala on 25 February, 2004, 18:19:56
and where is the "UserInfo" folder should be in the script's folder or the ptokax folder 10x :P
Title:
Post by: D-J Valhala on 25 February, 2004, 18:22:52
BTW the bot is not reggd in the code... and it's more good to me that the bot is offline bot ... hope you can help me :)
Title:
Post by: NightLitch on 25 February, 2004, 18:49:31
here you go:

-- Simple Offline Info by NightLitch
-- Commands is sent in Main-Chat
-- Create folder UserInfo

-- BotName --
BotName = "-Info-Bot-"
-- Prefix --
Prefix = "!"

--Command--
cmd1 = "offinfo"
-- Tables --
Temp = {}
Info = {}
-- Info Path --
InfoLog = "UserInfo/"

-- New User Connected --
function NewUserConnected(curUser,data)
LogInfo(curUser)
end
-- Data Arrival --
function DataArrival(curUser, data)
if strsub(data, 1, 1) == "<" then
data = strsub(data,1,strlen(data)-1)
if (GetCom(curUser,data) == 1) then
return 1
else
return 0
end
end
end
-- Get Command --
function GetCom(curUser,data)
local _,_,cmd = strfind(data,"^%b<>%s+%"..Prefix.."(%S+)")
if cmd then
if IPCommand[cmd] and curUser.iProfile==0 then
local Com = IPCommand[cmd](curUser,data)
return 1
end
end
end
-- Commands --
IPCommand = {
[cmd1] = function(curUser,data)
local _,_,nick = strfind( data,"%b<>%s+%S+%s+(%S+)")
if (nick == nil or nick == "") then
curUser:SendData(BotName,"Syntax: "..Prefix.."getinfo ")
return 1
end
local IP, Profile, MyInfo = GetInfo(nick)
if IP==0 and Profile==0 and MyInfo==0 then
curUser:SendData(BotName,"User not found.")
return 1
end
ClientTAG = {
{ " { " { " { " { "zDC++","zDC++" },{ "","MS++V" },
{ "","MS++V" },{ " { "<.P>","Phantom DC++" },}
local _,_,Nick = strfind( MyInfo, "^%$MyINFO %$ALL (%S+)%s*")
local _,_,Speed,Share = strfind( MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $([^$]+)[^$]%$[^$]*%$%s*(%d+)%$" )
local _,_,Slots = strfind( MyInfo, "S:(%d+)")
local _,_, Ver,Mode = strfind(MyInfo,"V:(%S+),M:([S,A,P])")
local _,_, Hubs = strfind(MyInfo,"H:(%x+)")
local Client = "Unknown"
for i = 1,getn(ClientTAG) do
if strfind(MyInfo,ClientTAG[i][1]) then
Client = ClientTAG[i][2]
end
end
local line = "\r\n"
line = line .. "\r\n User Info on: "..Nick
line = line .. "\r\n --------------------------------------------------------------------"
line = line .. "\r\n --------------------------------------------------------------------"
line = line .. "\r\n IP: "..IP
line = line .. "\r\n Client: "..Client
line = line .. "\r\n Version: "..Ver
line = line .. "\r\n Mode: "..Mode
line = line .. "\r\n Hubs: "..Hubs
line = line .. "\r\n Slots: "..Slots
line = line .. "\r\n Speed: "..Speed
line = line .. "\r\n Share: "..format("%.2f",Share/1024/1024/1024)
line = line .. "\r\n --------------------------------------------------------------------"
line = line .. "\r\n --------------------------------------------------------------------"
curUser:SendData(BotName,line)
end,

}

-- Log Users Info --
function LogInfo(curUser)
Info[strlower(curUser.sName)] = {["IP"]=curUser.sIP,["PROFILE"]=curUser.iProfile,["MYINFO"]=curUser.sMyInfoString,}
SaveToFile(InfoLog..strlower(curUser.sName)..".dat" , Info , "Info")
Info = nil
Info = {}
collectgarbage()
flush()
return 1
end
-- Get Info --
function GetInfo(nick)
LoadFromFile(InfoLog..strlower(nick)..".dat")
local usr = Info[strlower(nick)]
if usr then
IP = usr["IP"]
Profile = usr["PROFILE"]
MyInfo = usr["MYINFO"]
return IP,Profile, MyInfo
else
return 0,0,0
end
end
-- Serialize --
function Serialize(tTable, sTableName, hFile, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(hFile, "hFile equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";

write(hFile, sTab..sTableName.." = {\n" );

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, hFile, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
write(hFile, sTab.."\t"..sKey.." = "..sValue);
end

write(hFile, ",\n");
end

write(hFile, sTab.."}");
end
-- Save Table to File --
function SaveToFile(file , table , tablename)
local hFile = openfile(file, "w");
Serialize(table, tablename, hFile);
closefile(hFile);
end
-- Load Table From File --
function LoadFromFile (file)
assert(readfrom(file),file.." is not found.Generating new "..file..". All is fine. Don't panic.")
dostring(read("*all"))
readfrom()
end
/NL
Title:
Post by: D-J Valhala on 25 February, 2004, 22:05:45
nope it's not working :\
Title:
Post by: NightLitch on 26 February, 2004, 00:18:34
Well above code works for me.

BUT! As you wanted it. Offline info the info file must exist.

It does work for me.

I have here a link with all that is needed:

Offline Info Download (http://swenorth.myftp.org/network/nightlitch/files/offline_info.rar)
Title:
Post by: D-J Valhala on 26 February, 2004, 17:06:53
yo yo yo thank's man it's work Pefect !!!

CyA :D