Who can help with this?
On connecting usernick change to (ip)::(nick), but in mainchat and PM: nick...only on panel with nicks
And can I to this:
in userinfo change the description to ip's?
Hi,
If i understood you want to show user ips in his description ??? To all users ???
Best regards, nErBoS
Yes, It's realy? I'm saw this in the crazy bot by plop V:?736.way_nutty.865452.i'm_lost
Hi,
Hope it helps...
--Requested by (!(Tys?kan)=)
--Made by nErBoS
sBot = "IP-Show"
connectuser = {}
onlinetxt = "online.txt"
function Main()
frmHub:RegBot(sBot)
end
function OnExit()
SaveToFile(onlinetxt , connectuser , "connectuser")
end
function NewUserConnected(user, data)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
local pos = 0
for i=1, getn(connectuser) do
if (connectuser[i] == user.sName) then
break
end
pos = pos + 1
end
connectuser[pos+1] = user.sName
SendIps(user)
end
OpConnected = NewUserConnected
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..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, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
function SendIps(user)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
for i=1, getn(connectuser) do
if (GetItemByName(connectuser[i]) ~= nil) then
local s,e,info = strfind(GetItemByName(connectuser[i]).sMyInfoString, "$MyINFO%s+$ALL%s+%S+%s+(.*)")
user:SendData( "$MyINFO $ALL "..GetItemByName(connectuser[i]).sName.." "..GetItemByName(connectuser[i]).sIP.." "..info)
end
end
end
Best regards, nErBoS
Don't working ;(
Hi,
Little change, and tested...
--Requested by (!(Tys?kan)=)
--Made by nErBoS
sBot = "IP-Show"
connectuser = {}
onlinetxt = "online.txt"
function Main()
frmHub:RegBot(sBot)
end
function OnExit()
SaveToFile(onlinetxt , connectuser , "connectuser")
end
function NewUserConnected(user, data)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
local pos = 0
for i=1, getn(connectuser) do
if (connectuser[i] == user.sName) then
break
end
pos = pos + 1
end
connectuser[pos+1] = user.sName
SendIps(user)
end
OpConnected = NewUserConnected
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..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, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
function SendIps(user)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
for i=1, getn(connectuser) do
if (GetItemByName(connectuser[i]) ~= nil) then
local s,e,info = strfind(GetItemByName(connectuser[i]).sMyInfoString, "$MyINFO%s+$ALL%s+%S+%s+(.*)")
SendToAll( "$MyINFO $ALL "..GetItemByName(connectuser[i]).sName.." "..GetItemByName(connectuser[i]).sIP.." "..info)
end
end
end
The ip appears in the start of the description. If there is a user that you can?t see just reconnect and you will see it.
Best regards, nErBoS
OK, 10x! :D
Hi! Can i'm using the file online.txt from "Showips" script:
--Requested by (!(Tys?kan)=)
--Made by nErBoS
sBot = "IP-ALL"
loggintxt = "loggin.txt" -- Will be created in the script folder
function Main()
frmHub:RegBot(sBot)
end
function OnExit()
remove(loggintxt)
end
function NewUserConnected(user, data)
OnlineUser(user)
end
function UserDisconnected(user, data)
OfflineUser(user)
end
OpConnected = NewUserConnected
OpDisconnected = UserDisconnected
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd=="!showips") then
ShowIp(user)
return 1
end
end
end
function OnlineUser(user)
local tmp = ""
local time = 0
if (readfrom(loggintxt) == nil) then
writeto(loggintxt)
write(user.sName)
writeto()
else
readfrom(loggintxt)
while 1 do
local line = read()
if (line == nil) then
if (time == 0) then
tmp = tmp..user.sName.."\r\n"
end
break
else
local s,e,who = strfind(line, "(%S+)")
if (who == user.sName) then
time = 1
tmp = tmp..line.."\r\n"
else
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(loggintxt)
write(tmp)
writeto()
end
end
function OfflineUser(user)
local tmp = ""
if (readfrom(loggintxt) ~= nil) then
readfrom(loggintxt)
while 1 do
local line = read()
if (line == nil) then
break
else
local s,e,who = strfind(line, "(%S+)")
if (who ~= user.sName) then
tmp = tmp..line.."\r\n"
end
end
end
readfrom()
writeto(loggintxt)
write(tmp)
writeto()
end
end
function ShowIp(user)
local tmp = ""
tmp = tmp.."All IPS from the HUB:\r\n\r\n"
if (readfrom(loggintxt) ~= nil) then
readfrom(loggintxt)
while 1 do
local line = read()
if (line == nil) then
break
else
local s,e,who = strfind(line, "(%S+)")
if (GetItemByName(who) ~= nil) then
tmp = tmp.."Name :"..who.." IP: "..GetItemByName(who).sIP.."\r\n"
end
end
end
readfrom()
end
user:SendPM(sBot, tmp)
end
There is such structure:
Nick1
Nick2
Nick3
Nick4
etc.
--Ty--
Hi,
Done..
--Requested by (!(Tys?kan)=)
--Made by nErBoS
sBot = "IP-Show"
connectuser = {}
onlinetxt = "online.txt"
function Main()
frmHub:RegBot(sBot)
end
function OnExit()
SaveToFile(onlinetxt , connectuser , "connectuser")
end
function NewUserConnected(user, data)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
local pos = 0
for i=1, getn(connectuser) do
if (connectuser[i] == user.sName) then
break
end
pos = pos + 1
end
connectuser[pos+1] = user.sName
SendIps(user)
end
OpConnected = NewUserConnected
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd=="!showips") then
ShowIp(user)
return 1
end
end
end
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..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, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
function SendIps(user)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
for i=1, getn(connectuser) do
if (GetItemByName(connectuser[i]) ~= nil) then
local s,e,info = strfind(GetItemByName(connectuser[i]).sMyInfoString, "$MyINFO%s+$ALL%s+%S+%s+(.*)")
SendToAll( "$MyINFO $ALL "..GetItemByName(connectuser[i]).sName.." "..GetItemByName(connectuser[i]).sIP.." "..info)
end
end
end
function ShowIp(user)
local tmp = ""
tmp = tmp.."All IPS from the HUB:\r\n\r\n"
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
for i=1, getn(connectuser) do
if (GetItemByName(connectuser[i]) ~= nil) then
tmp = tmp..connectuser[i]..": "..GetItemByName(connectuser[i]).sIP.."\r\n"
end
end
user:SendPM(sBot, tmp)
end
Best regards, nErBoS
Don't working... ;(
Writing:
Syntax Error: expected;
last token read: `[' at line 1 in string "[R.H.]BLAST..."
Hi,
I have tested and is working, have you made any modification ???
Best regards, nErBoS
It's have trouble, when nick of user begining "["...
Syntax Error: expected;
last token read: `[' at line 1 in string "[R.H.][Tushino]BLAST..."
Are you sure you diodn't edit the code at top, for a comment.
but forgot "--" infront?
My curently code:
sBot = "President"
connectuser = {}
onlinetxt = "online.txt"
function OnExit()
SaveToFile(onlinetxt , connectuser , "connectuser")
end
function NewUserConnected(user, data)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
local pos = 0
for i=1, getn(connectuser) do
if (connectuser[i] == user.sName) then
break
end
pos = pos + 1
end
connectuser[pos+1] = user.sName
SendIps(user)
end
OpConnected = NewUserConnected
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd=="!showips") then
ShowIp(user)
return 1
end
end
end
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..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, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
function SendIps(user)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
for i=1, getn(connectuser) do
if (GetItemByName(connectuser[i]) ~= nil) then
local s,e,info = strfind(GetItemByName(connectuser[i]).sMyInfoString, "$MyINFO%s+$ALL%s+%S+%s+(.*)")
SendToAll( "$MyINFO $ALL "..GetItemByName(connectuser[i]).sName.." ::["..GetItemByName(connectuser[i]).sIP.."]::[ "..info)
end
end
end
function ShowIp(user)
local tmp = ""
tmp = tmp.."Ip-?????? ????:\r\n\r\n"
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
for i=1, getn(connectuser) do
if (GetItemByName(connectuser[i]) ~= nil) then
tmp = tmp..connectuser[i]..": "..GetItemByName(connectuser[i]).sIP.."\r\n"
end
end
user:SendPM(sBot, tmp)
end
But file is empty!
On !showips Bot showing:
[10:08] Ip-?????? ????:
(!(Tys?kan)=): 10.5.2.16
=Storm=: 10.3.21.58
WEREWOLF: 10.9.1.86
Totenkopf: 192.168.4.36
- [???????]Carnage: 10.11.5.45
- [bot]~???~: 192.168.5.55
Showing ip's in tag is working successfull
--Ty--
Hi,
ShowIPs in Tag and ShowIps from a command is using the same txt which is "online.txt". What isn?t working ??? I have tested your bot and is workin.
Best regards, nErBoS
Ok, this script is working. Yesterday there is one bag...Today all ok, 10x!
Hello, if i restarting the script's on the hub, files don't modify and still empty on restarting scriptd :(
Hi,
Hummm maybe the function OnExit() his failing, i will see that. When i have an answer i will post here.
Best regards, nErBoS
Hi,
Which ptokax version are you using ???
Best regards, nErBoS
Hi,
Due a stupid bug (me programming), try this one....
sBot = "President"
connectuser = {}
onlinetxt = "online.txt"
function OnExit()
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
SaveToFile(onlinetxt , connectuser , "connectuser")
end
function NewUserConnected(user, data)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
local pos = 0
for i=1, getn(connectuser) do
if (connectuser[i] == user.sName) then
break
end
pos = pos + 1
end
connectuser[pos+1] = user.sName
SendIps(user)
end
OpConnected = NewUserConnected
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd=="!showips") then
ShowIp(user)
return 1
end
end
end
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..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, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
function SendIps(user)
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
for i=1, getn(connectuser) do
if (GetItemByName(connectuser[i]) ~= nil) then
local s,e,info = strfind(GetItemByName(connectuser[i]).sMyInfoString, "$MyINFO%s+$ALL%s+%S+%s+(.*)")
SendToAll( "$MyINFO $ALL "..GetItemByName(connectuser[i]).sName.." ::["..GetItemByName(connectuser[i]).sIP.."]::[ "..info)
end
end
end
function ShowIp(user)
local tmp = ""
tmp = tmp.."Ip-?????? ????:\r\n\r\n"
if (connectuser[1] == nil and readfrom(onlinetxt) ~= nil) then
LoadFromFile(onlinetxt)
end
for i=1, getn(connectuser) do
if (GetItemByName(connectuser[i]) ~= nil) then
tmp = tmp..connectuser[i]..": "..GetItemByName(connectuser[i]).sIP.."\r\n"
end
end
user:SendPM(sBot, tmp)
end
This script will only work 100% in ptokax 0.3.3.0
Best regards, nErBoS
Hi,
Another Bug corrected in the script above.
Best regards, nErBoS