PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: Alexinno on 28 August, 2007, 17:40:45

Title: online IP checker
Post by: Alexinno on 28 August, 2007, 17:40:45
hello guyz , i can't find any online IP checker script, is there any ? , if yes could somebody point me in the right direction
I would like something like  !whoip IP and output if it is any user with that IP

thx
Title: Re: online IP checker
Post by: CrazyGuy on 28 August, 2007, 18:28:16
Userbekcisi should be your friend when it comes to this  8)
Although it may need an update
Title: Re: online IP checker
Post by: Cêñoßy†ê on 28 August, 2007, 19:11:43
Try this ;)



ChatArrival = function(user,data)
local _,_,cmd,what = data:find("%b<>%s+(%S+)%s(.*)|")
if cmd == "!whoip" then
if what and what:find("%d+%.%d+%.%d+%.%d+") then
if Search(what) == nil then
user:SendData(frmHub:GetHubBotName(),"No user logged with that IP")
else
user:SendData(frmHub:GetHubBotName(),Search(what))
end
else
user:SendData(frmHub:GetHubBotName(),"Invalid IP string (example string 127.0.0.1)")
end
return 1
end
end

Search = function(what)
for _,who in pairs(frmHub:GetOnlineUsers()) do
if who.sIP == what then
return("Found user: "..who.sName.." with ip "..what)
end
end
end
Title: Re: online IP checker
Post by: Alexinno on 31 August, 2007, 14:29:18
10q C??o?y?? for the script ,it's working good :)
Title: Re: online IP checker
Post by: TTB on 31 August, 2007, 16:41:25
if what and what:find("%d+%.%d+%.%d+%.%d+") then

Is this new? Shouldn't it be:

if what and string.find(what,("%d+%.%d+%.%d+%.%d+")) then

Didn't script for a while, but thisone got my attention :-)
Title: Re: online IP checker
Post by: Thor on 31 August, 2007, 17:18:36
Since LUA 5.11 they can be used, easier and faster. string.sub(smth,1,4) == smth:sub(1,4), string.gsub(smth,"%W","") == smth:gsub("%W",""), and so on. less parameter, faster code :)
Title: Re: online IP checker
Post by: TTB on 31 August, 2007, 17:20:42
That's great! Thanx for your explenation.   ;D