(ip)::(nick)
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

(ip)::(nick)

Started by (!(Tys?kan)=), 16 April, 2004, 16:46:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

(!(Tys?kan)=)

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?
--Ty--

nErBoS

Hi,

If i understood you want to show user ips in his description ??? To all users ???

Best regards, nErBoS
--## nErBoS Spot ##--

(!(Tys?kan)=)

#2
Yes, It's realy? I'm saw this in the crazy bot by plop   V:?736.way_nutty.865452.i'm_lost
--Ty--

nErBoS

#3
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
--## nErBoS Spot ##--

(!(Tys?kan)=)

--Ty--

nErBoS

#5
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
--## nErBoS Spot ##--

(!(Tys?kan)=)

--Ty--

(!(Tys?kan)=)

#7
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--
--Ty--

nErBoS

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
--## nErBoS Spot ##--

(!(Tys?kan)=)

Don't working... ;(
Writing:
Syntax Error:  expected;
  last token read: `[' at line 1 in string "[R.H.]BLAST..."
--Ty--

nErBoS

Hi,

I have tested and is working, have you made any modification ???

Best regards, nErBoS
--## nErBoS Spot ##--

(!(Tys?kan)=)

It's have trouble, when nick of user begining "["...
Syntax Error:  expected;
  last token read: `[' at line 1 in string "[R.H.][Tushino]BLAST..."
--Ty--

kepp

Are you sure you diodn't edit the code at top, for a comment.
but forgot "--" infront?
Guarding    

(!(Tys?kan)=)

#13
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--
--Ty--

nErBoS

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
--## nErBoS Spot ##--

(!(Tys?kan)=)

Ok, this script is working. Yesterday there is one bag...Today all ok, 10x!
--Ty--

(!(Tys?kan)=)

Hello, if i restarting the script's on the hub, files don't modify and still empty on restarting scriptd :(
--Ty--

nErBoS

Hi,

Hummm maybe the function OnExit() his failing, i will see that. When i have an answer i will post here.

Best regards, nErBoS
--## nErBoS Spot ##--

nErBoS

Hi,

Which ptokax version are you using ???

Best regards, nErBoS
--## nErBoS Spot ##--

nErBoS

#19
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
--## nErBoS Spot ##--

nErBoS

Hi,

Another Bug corrected in the script above.

Best regards, nErBoS
--## nErBoS Spot ##--

SMF spam blocked by CleanTalk