!table <name> / LANPARTY!!! :)
 

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

!table / LANPARTY!!! :)

Started by michael, 22 December, 2004, 11:11:00

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

michael

Hi all  :]

Another person and me have a LAN party, sometimes I want to know witch table number that person has.

Ok my question,

If I do !table
I want that the script checks for me on witch table that person has.

The script can filter the table number out an file (table.txt)

123.123.123.123 = table 3
123.123.123.124 = table 4

so if I do !table the script is looking for his ip and then look in the txt file witch table number it is, and then he is saying has table number ?.

This function must only be available for an OP and above

Can someone make this script for me pls ?

Gr Michael  :))

(bad English :S  :( :( )

michael


blackwings

#2
Tomorrow its christmas and many a probably busy with planing stuff or helping friends and family. For the moment I will give a idea of solving the reqeust. It's pretty newbie idea, but it would solve your request and if a skilled lua programmer finds the time, he/she can quickly use my idea to solve it.

My idea is this. Instead of this script checks everyone that connect, it does it thing though a command instead. The bad thing about the idea is that you need 1 copy for the script for each table on the party. But to make it easier for the person that use the commands. the commands could be like =
!table1
!table2
!table3
!table4

and you get a answer if user IS or IS NOT from that table.

I will later try to solve it myself, but I can't promise anything, because I have just newbie lua skills :P
--//Idea for the table checker
--//The IP handling is taken from RangeBlaster v2.05 by Phatty


Bot = "TABLE-CHECKER" 

Ranges = {}

function Main() 
	LoadIps()
end 

--------------------------------------------------------------------------------------------------
-- Load Ips
function LoadIps()
	local tmp = 0
	local handle = openfile("LANtable/table1.dat","r")
	line = read(handle)
	while line do
		tmp = tmp + 1
		local s,e,ipr1,ipr2 = strfind(line,"(%S+)|(%S+)")
		if ipr2 == nil then
		end
		Ranges[ipr1] = ipr2
	line = read(handle)
	end
end
--------------------------------------------------------------------------------------------------
-- IP handle
function Blocked(userip) 
	local s,e,range1,range2,range3,range4 = strfind(userip,"(%d+).(%d+).(%d+).(%d+)")
	for i,p in Ranges do 
		local s,e,ipa1,ipb1,ipc1,ipd1 = strfind(i, "(%d*).(%d*).(%d*).(%d*)") 
		local s,e,ipa2,ipb2,ipc2,ipd2 = strfind(p, "(%d*).(%d*).(%d*).(%d*)")
		if range1 == ipa1 then
			if range1 < ipa1 or range1 > ipa2 then
			else
				if range2 < ipb1 or range2 > ipb2 then
				else
					if range3 < ipc1 or range3 > ipc2 then
					else
						if range4 < ipd1 or range4 > ipd2 then
						else
							collectgarbage()
							flush()
							return 1
						end
					end
				end
			end
		end	
	end	
end

--------------------------------------------------------------------------------------------------
-- Action
function DataArrival(user,data)
	if (strsub(data, 1, 8) == "$Version") then
		if Blocked(user.sIP) == 1 then 
		-- Message that says that the user is from this table
		else
		-- Message that says that the user is NOT from this table
		end
	end
end
--------------------------------------------------------------------------------------------------


michael

Hi

i am a noob about lua scripts  :D
i hope that someone els can make it for me

thanks blackwings for your reply  :))

Grz Michael

NightLitch

If I understand you each "Table" the place where you sit has it's own IP ????

or you just want to know what IP that user have ???

Or you have placed out special IP number for just that "Table" where the user is sitting in the room...

I need to understand your idea...

Have done a half script... but need to now how you wanted it...

/NightLitch
//NL

NightLitch

This should take care of your request I hope...

--###############################################--
-- IP - Table -- By NightLitch 2004-12-23 --
--###############################################--
BotName = "T-Bot"
Version = "0.1"
TableCommand = "!table"
--###############################################--
IpTable = {

["123.123.123.121"] = "Table 1",
["123.123.123.122"] = "Table 2" ,
["123.123.123.123"] = "Table 3",
["123.123.123.124"] = "Table 4",
["123.123.123.125"] = "Table 5",
["123.123.123.126"] = "Table 6",
["123.123.123.127"] = "Table 7",
["123.123.123.128"] = "Table 8",
["123.123.123.129"] = "Table 9",
["123.123.123.130"] = "Table 10",

-- continue type in amount of ip's with table numbers...
}
--###############################################--
function DataArrival(sUser,sData)
	if strsub(sData, 1,1) == "<" then
		local _,_,Cmd,Arg = strfind(sData, "%b<>%s+(%S+)%s*(.*)%|")
		if Command[Cmd] and sUser.bOperator then
			return Command[Cmd](sUser,Arg)
		end
	end
end
--###############################################--
Command = {}
Command[TableCommand] = function(sUser,sArg)
	local _,_,Nickname = strfind(sArg, "(%S+)")
	if Nickname == nil then sUser:SendData(BotName, "Syntax: !table  ") return 1 end
	local tUser = GetItemByName(Nickname)
	if tUser == nil then sUser:SendData(BotName, "User "..Nickname.." is not online or wrong username.") return 1 end
	sUser:SendData(BotName, "User "..tUser.sName.." have IP "..tUser.sIP.." and sits at "..IpTable[tUser.sIP])
	return 1
end
--###############################################--
--// NightLitch 2004-12-23

Merry Christmas // NightLitch
//NL

michael

( the place where you sit has it's own IP ??)

Yes every table has his own ip

6Marilyn6Manson6

Good work NightLight... ;) bye King Of Lua :P

blackwings

ya, NL script is great, so I don't have to make a crappy script with my newbie lua skills :P


michael

#9
I made a mistake :(

Your script is working perfect :)

I had written the wrong ip in the script

Thank you very much

Gr Michael :D:D:D:D

Madman

Just to avoid the Error you got before... ;)

--###############################################--
-- IP - Table -- By NightLitch 2004-12-23 --
-- Updated By Madman
--###############################################--
BotName = "T-Bot"
Version = "0.1"
TableCommand = "!table"
--###############################################--
IpTable = {

["123.123.123.121"] = "Table 1",
["123.123.123.122"] = "Table 2" ,
["123.123.123.123"] = "Table 3",
["123.123.123.124"] = "Table 4",
["123.123.123.125"] = "Table 5",
["123.123.123.126"] = "Table 6",
["123.123.123.127"] = "Table 7",
["123.123.123.128"] = "Table 8",
["123.123.123.129"] = "Table 9",
["123.123.123.130"] = "Table 10",

-- continue type in amount of ip's with table numbers...
}
--###############################################--
function DataArrival(sUser,sData)
	if strsub(sData, 1,1) == "<" then
		local _,_,Cmd,Arg = strfind(sData, "%b<>%s+(%S+)%s*(.*)%|")
		if Command[Cmd] and sUser.bOperator then
			return Command[Cmd](sUser,Arg)
		end
	end
end
--###############################################--
Command = {}
Command[TableCommand] = function(sUser,sArg)
	local _,_,Nickname = strfind(sArg, "(%S+)")
	if Nickname == nil then sUser:SendData(BotName, "Syntax: "..TableCommand.."  ") return 1 end
	local tUser = GetItemByName(Nickname)
	if tUser == nil then sUser:SendData(BotName, "User "..Nickname.." is not online or wrong username.") return 1 end
	if IpTable[tUser.sIP] == nil then sUser:SendData(BotName, "User dont have a IP that is in the table") return 1 end
	sUser:SendData(BotName, "User "..tUser.sName.." have IP "..tUser.sIP.." and sits at "..IpTable[tUser.sIP])
	return 1
end
--###############################################--
--// NightLitch 2004-12-23

now the script tells if the user dont have a IP that is in the table =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

michael

Yes it works :D:D

Thanks   :D

Grz Michael

SMF spam blocked by CleanTalk