!userip For Lua 5.1
 

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

!userip For Lua 5.1

Started by JueLz, 13 August, 2006, 19:24:38

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JueLz

Hello Everybody i need a simple script that Gives me the User's Ip when i request for it
like !userip <nick>
and the bot replies
<botname> User <nick>'s ip is: <IP> Have a nice Day
I am owner of the MzDistortion? Empire
the addy to my hub is mzdistortion.no-ip.org
____________________________________________
--=                        [HT 500]                          =--

BoyKind

Would you like a script for the offline users too ? like !userip <offline nick> ?
With all the respect

Madman

#2
-- Get User's IP script
-- Made by Madman
-- Request by JueLz

function ChatArrival(curUser, data)
	data = string.sub(data, 1, -2)
	local s,e,cmd = string.find(data, "%b<>%s+[%!%+%#](%S+)")
	if cmd == "userip" then
		local s,e,nick = string.find(data, "%b<>%s+%S+%s+(%S+)")
		if nick then
			vUser = GetItemByName(nick)
			if vUser then
				curUser:SendData(frmHub:GetHubBotName(),? "User " ..vUser.sName.. "s ip is: " ..vUser.sIP.. " Have a nice Day")
			else
				curUser:SendData(frmHub:GetHubBotName(), nick.. " is not online")
			end
		else
			curUser:SendData(frmHub:GetHubBotName(), "Syntax: !userip <nick>" )
		end
		return 1
	end
end


I didn't bother to do it for offline users... It just get's the ip from online users..
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

JueLz

No thanks Boykind i have made my own for offline users!
Posted on: 13 August 2006, 22:47:02
[22:57] Syntax [string "-- Get User's IP script..."]:13: '<name>' expected near '"s ip is: "'
Error Found The Script doesn't Work 100%
               
I am owner of the MzDistortion? Empire
the addy to my hub is mzdistortion.no-ip.org
____________________________________________
--=                        [HT 500]                          =--

Thor

One point missing:
curUser:SendData(frmHub:GetHubBotName(),  "User " ..vUser.sName.."s ip is: " ..vUser.sIP.. " Have a nice Day")

JueLz

I am owner of the MzDistortion? Empire
the addy to my hub is mzdistortion.no-ip.org
____________________________________________
--=                        [HT 500]                          =--

Madman

script updated with the fix ;p
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

TTB

Another one

-- !ipinfo by TTB
-- 14 aug. 2006
-- Wrote it in 3 minutes (not tested)

bot = "ipcheck"

function ChatArrival(curUser,data)
	data=string.sub(data,1,string.len(data)-1) 
	s,e,cmd = string.find(data,"%b<>%s+(%S+)")
	if cmd and (cmd=="!userip") and curUser.bOperator then
		s,e,cmd,nick = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
		if nick == nil then
			curUser:SendData(bot, "Syntax error! Please use: !userip <user> to see the IP related on <user>")
		elseif (GetItemByName(nick) == nil) then
			curUser:SendData(bot,"User is not online")
		else
			curUser:SendData(bot, "User: "..nick.." is connected with IP: "..GetItemByName(nick).sIP)
		end
		return 1
	end
end
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

6Marilyn6Manson6

--[[
Get Nick from IP or IP from Nick
by Rincewind (15/11/05)
]]

sBot = "UserInfo"
sPrefix = "+"

function ChatArrival(curUser,data)

	data = string.sub(data,1,-2)
	local s,e,cmd = string.find(data, "%b<>%s+[%"..sPrefix.."](%S+)")
	local s,e,getuser = string.find(data, "%b<>%s+%S+%s+(%S+)")
	
	if cmd == "getip" then
		if curUser.bOperator then
			local user = GetItemByName(getuser)
			if user then
				curUser:SendData(sBot, getuser.." has the IP of "..user.sIP)
			else
				curUser:SendData(sBot, "The nick "..getuser.." is not in use")
			end
			return 1
		else
			curUser:SendData(sBot,"You are not permitted to use this command") return 1
		end
		return 1
	elseif cmd == "getnick" then
		founduser = nil
		for i,user in pairs(frmHub:GetOnlineUsers()) do
			if user.sIP == getuser then
				if founduser then
					founduser = founduser..", "..user.sName
				else
					founduser = user.sName
				end
			end
		end
		if founduser then
			curUser:SendData(sBot, getuser.." has the nick of "..founduser)
		else
			curUser:SendData(sBot, "The IP address "..getuser.." is not in use")
		end
		return 1
	end
				
end


Other solution

JueLz

Thank you all for the scripts
I am owner of the MzDistortion? Empire
the addy to my hub is mzdistortion.no-ip.org
____________________________________________
--=                        [HT 500]                          =--

speedX

hey but does this works for offline users......if not thn plzz can u plzz do it for me.....
Posted on: 20 August 2006, 18:50:20
i mean such tht i can see the ip of offline users also....
Posted on: 20 August 2006, 18:51:38
i had such a script...but it is +ip <nick> ....so when i type any other command wid "+" as a prefix thn it shows an syntax error

Even when i make it !ip <nick> ....thn also it shows a syntax error wid those commands  having "!" as a prefix.....so tht's y askin for help...
Thanking You,

speedX

6Marilyn6Manson6

Quote from: speedX on 20 August, 2006, 19:31:19
i had such a script...but it is +ip <nick> ....so when i type any other command wid "+" as a prefix thn it shows an syntax error

Even when i make it !ip <nick> ....thn also it shows a syntax error wid those commands  having "!" as a prefix.....so tht's y askin for help...

Post syntax error :)

speedX

There are other commands also having "+" as a prefix......so when i type those commands then it shows
Quote
Syntax Error, Syntax = +ip <IP or Nick>

So i cant use those commands.....

Same goes wid those commands having "!" as a prefix....

Tht's y i am askin....can we see the ip of offline users in those scripts displayed above??
Thanking You,

speedX

6Marilyn6Manson6

Change:

local s,e,cmd = string.find(data, "%b<>%s+[%"..sPrefix.."](%S+)")


To:

local s,e,cmd = string.find(data, "%b<>%s+[%!%+](%S+)")


And you can use ! or + prefix :)

UwV

#14
Quote from: speedX on 21 August, 2006, 08:29:34
There are other commands also having "+" as a prefix......so when i type those commands then it shows
So i cant use those commands.....

Same goes wid those commands having "!" as a prefix....

Tht's y i am askin....can we see the ip of offline users in those scripts displayed above??

wich of the three scripts are you using or do you want to use speedx ?

all three are pretty easy to change the command and/or prefix .

--------------------------------------------------------------------
1.
- Get User's IP script
-- Made by Madman
-- Request by JueLz

function ChatArrival(curUser, data)
	data = string.sub(data, 1, -2)
	local s,e,cmd = string.find(data, "%b<>%s+[%!%+%#](%S+)")
	if cmd == "userip" then

   %b<>%s+[%!%+%#](%S+)")
   actually listens to !userip , +userip and #userip so you would not want to change it really..
------------------------------------------------------------------------------------------------------
2.
-- !ipinfo by TTB
-- 14 aug. 2006
-- Wrote it in 3 minutes (not tested)

bot = "ipcheck"

function ChatArrival(curUser,data)
	data=string.sub(data,1,string.len(data)-1) 
	s,e,cmd = string.find(data,"%b<>%s+(%S+)")
	if cmd and (cmd=="!userip") and curUser.bOperator then

    if cmd and (cmd=="!userip") and curUser.bOperator then
    listens to !userip  change it to whatever you need .. 
------------------------------------------------------------------------------------------------------
3.
--[[
Get Nick from IP or IP from Nick
by Rincewind (15/11/05)
]]

sBot = "UserInfo"
sPrefix = "+"

function ChatArrival(curUser,data)

	data = string.sub(data,1,-2)
	local s,e,cmd = string.find(data, "%b<>%s+[%"..sPrefix.."](%S+)")
	local s,e,getuser = string.find(data, "%b<>%s+%S+%s+(%S+)")
	if cmd == " getip " then

    this one you can set your prefix in the settings.. 
    "  sPrefix = "+  "
------------------------------------------------------------------------------------------------------

but this "solution" ....
Quote from: 6Marilyn6Manson6 on 21 August, 2006, 08:40:51
Change:
local s,e,cmd = string.find(data, "%b<>%s+[%"..sPrefix.."](%S+)")

To:
local s,e,cmd = string.find(data, "%b<>%s+[%!%+](%S+)")

And you can use ! or + prefix :)
does exactly say it does what you do NOT want it to do ..
(after that mod the script only sees "+ or ! "  as prefix)  ???
\NL   The knowledge and skills you have achieved are meant to be forgotten so you can float comfortably in emptiness, without obstruction.
" Holly loves me,...  . "      ;o)

& don't forget, the motto is :
  -- SUPPORT YOUR LOCAL DJ'S --

6Marilyn6Manson6

Quotebut this "solution" .... does exactly say it does what you do NOT want it to do ..
(after that mod the script only sees "+ or ! "  as prefix)  ???

Ops, true  >:(

speedX

I want it to work for offline users also......but none of the above scripts work for offline users...
Thanking You,

speedX

modular

Quote from: speedX on 21 August, 2006, 13:54:30
I want it to work for offline users also......but none of the above scripts work for offline users...
try ..

http://forum.ptokax.org/index.php?topic=6267#msg61973

SMF spam blocked by CleanTalk