PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: SilvaO on 15 July, 2005, 12:16:33

Title: UserInfo LUA 4 PT
Post by: SilvaO on 15 July, 2005, 12:16:33
Comandos para o UserInfo

+userinfo ou +whois

QuoteBot = "UserInfo"
function Main()
frmHub:RegBot(Bot)
end
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
-- remove end pipe
data=strsub(data,1,strlen(data)-1)
-- parse the command
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
if (user.bOperator) then
if (cmd=="+userinfo" or cmd=="+whois" ) then
UserInfo(user, data)
return 1
end
end
end
end
function GetArgML(data)
s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")
return arg
end
function UserInfo(user, data)
who=GetArgML(data)
local usr = GetItemByName(who)
user:SendPM(Bot, "Esta ? a informa??o do user: "..who.." |")
-- now whe know the user lets extract the info
-- ip of the user
user:SendPM(Bot, "ip: "..usr.sIP.." |")
-- client type and version
if (strfind(usr.sMyInfoString,"_,b, dcgui = strfind(usr.sMyInfoString,"V:0.(%x+.%x+)")
user:SendPM(Bot, "Vers?o de DCgui : 0."..dcgui.." |")
elseif (strfind(usr.sMyInfoString,"<+")) then
if strfind(usr.sMyInfoString,"clienttype = "oDC"
elseif strfind(usr.sMyInfoString,"V:0.%x+%a") then
clienttype = "czdc++"
elseif strfind(usr.sMyInfoString,"L:") or strfind(usr.sMyInfoString,"B:") then
clienttype = "bcdc++"
else
clienttype = "dc++"
end
_,b, dcver = strfind(usr.sMyInfoString,"V:0.(%x+)")
user:SendPM(Bot, clienttype.." client |")
user:SendPM(Bot, "vers?o: 0."..dcver.." |")
else
user:SendPM(Bot, "Cliente NMDC est? a esconder a tag...")
end
-- active or pasive
if strfind(usr.sMyInfoString,"M:A") then
mode = "active"
user:SendPM(Bot, mode.." mode |")
elseif strfind(usr.sMyInfoString,"M:P") then
mode = "pasive"
user:SendPM(Bot, mode.." mode |")
end
-- hub info
_,b, guest = strfind(usr.sMyInfoString,"H:(%x+)/")
if guest == nil then
_,b, hubs = strfind(usr.sMyInfoString,"H:(%x+)")
if hubs ~= nil then
user:SendPM(Bot, hubs.." - hub(s) |")
end
else
_,b, regged = strfind(usr.sMyInfoString,"H:%x+/(%x+)/")
_,b, opped = strfind(usr.sMyInfoString,"H:%x+/%x+/(%x+)")
if regged ~= nil then
user:SendPM(Bot, guest.." - hub(s) como user regular |")
user:SendPM(Bot, regged.." - hub(s) como user registado |")
user:SendPM(Bot, opped.." - hub(s) como operator |")
end
end
-- slot info
_,b, slots = strfind(usr.sMyInfoString,"S:(%x+)")
if slots ~= nil then
user:SendPM(Bot, slots.." - n? slot(s) abertas |")
end
-- bandwidth upload limiter
if strfind(usr.sMyInfoString,"L:") or strfind(usr.sMyInfoString,"B:") then
_,b, limiter = strfind(usr.sMyInfoString,"B:(%x+)")
if limiter == nil then
_,b, limiter = strfind(usr.sMyInfoString,"L:(%x+)")
if limiter == nil then
_,b, limiter = strfind(usr.sMyInfoString,"U:(%x+)")
if limiter == nil or limiter == "*" then
limiter = "not limited"
end
end
end
if tonumber(limiter) ~= nil then
if strlen(limiter) > 4 then
limiter = limiter / 1024
end
user:SendPM(Bot, "upload limitado a: "..limiter.." Kb/s |")
end
--user:SendPM(Bot, "Velocidade de upload limiteda: "..limiter.." Kb/s |")
end
-- bandwidth download limiter
_,b, dlimiter = strfind(usr.sMyInfoString,"D:(%x+)")
if dlimiter ~= nil then
user:SendPM(Bot, "downloads limitados: "..dlimiter.." Kb/s |")
end
end