PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Pit on 24 November, 2004, 20:45:57

Title: Simple Thing
Post by: Pit on 24 November, 2004, 20:45:57
Greatings scripters

I just wanted a script, that would be able to show the IP
of a username.

EX:
With the cmd !ip , the bot reveals the ip of tha user..

Thanks

Title:
Post by: NemeziS on 24 November, 2004, 21:09:45
Hi, Pit!

Try this:

--## IP_bot
--## Requested by Pit
--## Made by NemeziS

Bot = "IP_bot"

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 == "!ip") then
      ShowIP(user, data)
      return 1
    end
  end
end

function GetArgML(data)
  s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")
  return arg
end
 
function ShowIP(curUser, data)
 who = GetArgML(data)
  if who == nil then
    curUser:SendData(Bot, "Syntax Error, !ip , you must write name of the user!")
    return 1
  else
    local user = GetItemByName(who)
        if user == nil then
          curUser:SendData(Bot, "This is not a user or maybe it's a bot! You must write a real username!")
          return 1
        end
    ip = user.sIP
    curUser:SendData(Bot, "User: "..who.." IP: "..ip.."")
  end
end
;)

Best regards,
NemeziS
Title: Greetings
Post by: Pit on 25 November, 2004, 01:20:25
Hi nemeziS

Thanks for the quick reply..
I'll check it right away..

Keep helping who needs it..

Pit