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
Would you like a script for the offline users too ? like !userip <offline nick> ?
-- 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..
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%
One point missing:
curUser:SendData(frmHub:GetHubBotName(), "User " ..vUser.sName.."s ip is: " ..vUser.sIP.. " Have a nice Day")
Ill try it ouT :)
script updated with the fix ;p
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
--[[
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
Thank you all for the scripts
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...
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 :)
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??
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 :)
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) ???
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 >:(
I want it to work for offline users also......but none of the above scripts work for offline users...
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