show me my ip in a popup
 

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

show me my ip in a popup

Started by Not, 20 December, 2003, 18:24:31

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Not

Hi, guys  :D .
I've looked around for a small, standalone script that will give users their ip.

I know that this function is included in many larger scriptpackages, but i don't want to replace those that i have today.

Could someone whip up such a script? If possible, it should open in a new popup window...

[ES]latinmusic

-- Not tested
-- Command-->> !myip -->> in mainchat
boName = "MyIP"
function DataArrival(curUser, data)
	if strsub(data, 1, 1) ~= "<" then return end
	local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
	if not s then return end
	cmd = strlower(cmd)
	if (cmd=="myip") then
		curUser:SendPM(botName,"Your current IP is: '"..curUser.sIP.."'.")
		return 1
	end
end

Not

Hmm, didn't work.. so i modified it a bit (maybe screwed it up). Looks like this now, and still doesn't work :p


-- Command-->> +myip -->> in mainchat

BotName="-[PtokaX]-"

function Main()
   frmHub:RegBot(BotName)
end

function DataArrival(curUser, data)
   if strsub(data, 1, 1) ~= "<" then return end
   local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
   if not s then return end
   cmd = strlower(cmd)
   if (cmd=="+myip") then
      curUser:SendPM(botName,"Your current IP is: '"..curUser.sIP.."'.")
      return 1
   end
end

NightLitch

the tiny problem is this:

curUser:SendPM(botName,"Your current IP is: '"..curUser.sIP.."'.")

should be a big B in BotName not like above

correct line

curUser:SendPM(BotName,"Your current IP is: '"..curUser.sIP.."'.")

this should do it...

/NL
//NL

SaintSinner

#4
here did some changes
were just a few spelling errors
and in the DataArrival

Bot = "Ipbot"
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
	data=strsub(data,1,strlen(data)-1)
	s,e,cmd = strfind(data,"%b<>%s+(%S+)")
		
		if cmd == "!myip" then
		user:SendPM(Bot,"Your current IP is  "..user.sIP..".")
		return 1
end
end 
end
   


SaintSinner

QuoteOriginally posted by NightLitch
the tiny problem is this:

curUser:SendPM(botName,"Your current IP is: '"..curUser.sIP.."'.")

should be a big B in BotName not like above

correct line

curUser:SendPM(BotName,"Your current IP is: '"..curUser.sIP.."'.")

this should do it...

/NL


LOL...dammitt,...you were faster..
   


Not

Well, thanks a lot guys, it works like a charm  :D

Looks like this:


-- Command-->> +myip -->> in mainchat

BotName="-[PtokaX]-"

function Main()
   frmHub:RegBot(BotName)
end

function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
   data=strsub(data,1,strlen(data)-1)
   s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      
      if cmd == "+myip" then
      user:SendPM(BotName,"Your current IP is  "..user.sIP..".")
      return 1
end
end
end





Really appreciate you all taking your time and helping me out!

turkiye

it's not a popup it's a PM
 8)

[ES]latinmusic

lol, what silly error, the original error was in this line:
boName= "MyIP" instead botName= "MyIP" seems i was tipying to fast, anyway is fixed now. Also i'm going to edit the first one for someone who need it another time.

[ES]latinmusic

-- Not tested
-- Command-->> !myip -->> in mainchat
botName = "MyIP"
function DataArrival(curUser, data)
	if strsub(data, 1, 1) ~= "<" then return end
	local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
	if not s then return end
	cmd = strlower(cmd)
	if (cmd=="myip") then
		curUser:SendPM(botName,"Your current IP is: '"..curUser.sIP.."'.")
		return 1
	end
end
Seems that there is an error inside the board because i can edit my own post!!!!!!!!!!!!
Anyway edited in this ugly way.

pHaTTy

QuoteOriginally posted by [ES]latinmusic
-- Not tested
-- Command-->> !myip -->> in mainchat
botName = "MyIP"
function DataArrival(curUser, data)
	if strsub(data, 1, 1) ~= "<" then return end
	local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
	if not s then return end
	cmd = strlower(cmd)
	if (cmd=="myip") then
		curUser:SendPM(botName,"Your current IP is: '"..curUser.sIP.."'.")
		return 1
	end
end
Seems that there is an error inside the board because i can edit my own post!!!!!!!!!!!!
Anyway edited in this ugly way.

for a small script there is no real point of
   
local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")


just a note. lol
Resistance is futile!

SMF spam blocked by CleanTalk