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...
-- 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
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
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
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
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..
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!
it's not a popup it's a PM
8)
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.
-- 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.
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