Author Topic: !showreg  (Read 2159 times)

0 Members and 1 Guest are viewing this topic.

Offline Plagued Elohim

  • Member
  • ***
  • Posts: 38
  • Karma: +7/-0
!showreg
« on: 23 April, 2007, 17:52:38 »
Could someone make me a script that shows all the regs by profile and when I type ' * ' it shows me all the regs ... ? Pleeeaaseee ::) like: !showreg Master and !showreg * . Thank you

PtokaX forum

!showreg
« on: 23 April, 2007, 17:52:38 »

Offline achiever

  • Lord
  • ***
  • Posts: 260
  • Karma: +25/-22
Re: !showreg
« Reply #1 on: 23 April, 2007, 17:55:25 »
try teambot update
thks,
achiever.

Offline Plagued Elohim

  • Member
  • ***
  • Posts: 38
  • Karma: +7/-0
Re: !showreg
« Reply #2 on: 23 April, 2007, 19:35:08 »
I have found this code
Code: [Select]
--[[

Registered Users per Profile - LUA 5.0/5.1 by jiten (8/9/2006)

]]--

tSettings = {
-- Bot Name
sName = frmHub:GetHubBotName(),

-- Command Name
sCommand = "showreg",

-- RightClick Menu
sMenu = "Menu"
}

ChatArrival = function(user, data)
local _,_, to = string.find(data,"^$To:%s(%S+)%sFrom:")
local _,_, msg = string.find(data,"%b<>%s(.*)|$")
-- Message sent to Bot or in Main
if (to and to == tSettings.sName) or not to then
-- Parse command
local _,_, cmd = string.find(msg, "^%p(%S+)")
-- Exists
if cmd and tCommands[string.lower(cmd)] then
cmd = string.lower(cmd)
-- If user has permission
if tCommands[cmd].tLevels[user.iProfile] then
return tCommands[cmd].fFunction(user, msg), 1
else
return user:SendData(tSettings.sName, "*** Error: You are not allowed to use this command!"), 1
end
end
end
end

ToArrival = ChatArrival

NewUserConnected = function(user)
-- Supports UserCommands
if user.bUserCommand then
-- For each entry in table
for i, v in pairs(tCommands) do
-- If has permission
if v.tLevels[user.iProfile] then
-- Send
user:SendData("$UserCommand 1 3 "..tSettings.sMenu.."\\"..v.tRC[1]..
"$<%[mynick]> !"..i..v.tRC[2].."&#124;")
end
end
end
end

OpConnected = NewUserConnected

tCommands = {
[tSettings.sCommand] = {
fFunction = function(user, data)
-- Search for profile
local _,_, profile = string.find(data, "^%S+%s(%S+)$")
-- Exists
if profile then
-- Temporary table
local tProfiles = {}
-- Loop through profiles
for i, v in ipairs(GetProfiles()) do
-- Add to custom table
tProfiles[string.lower(v)] = GetProfileIdx(v)
end
-- Profile Exists
if tProfiles[string.lower(profile)] then
-- Header
local sMsg, n = "\r\n\r\n\t"..string.rep("=", 35).."\r\n\t\tUsers by Profile - "..
GetProfileName(tProfiles[string.lower(profile)])..":\r\n\t"..string.rep("-", 70).."\r\n\t", 0
-- Loop through registered users
for i, v in ipairs(frmHub:GetRegisteredUsers()) do
local sStatus = "off"
-- Look for users with same profile
if v.iProfile == GetProfileIdx(profile) then
-- Sum + If online
n = n + 1; if GetItemByName(v.sNick) then sStatus = "on" end
-- Add content
sMsg = sMsg.."\t"..n..". ["..sStatus.."line] "..v.sNick.."\r\n\t"
end
end
-- Send
user:SendData(tSettings.sName, sMsg)
else
user:SendData(tSettings.sName, "*** Error: There isn't such profile!")
end
else
user:SendData(tSettings.sName, "*** Syntax Error: !"..tSettings.sCommand.." <profile name>")
end
end,
tLevels = { [0] = 1, [1] = 1, [2] = 0, [3] = 0, [4] = 0, [5] = 0, },
tRC = { "Show registered Users", " %[line:Profile Name]" },
},
}
can someone modify it so when I type !showreg * it can show me all the profiles? thanks ;)
teambot? it's not a huge script with other commands?

PtokaX forum

Re: !showreg
« Reply #2 on: 23 April, 2007, 19:35:08 »