PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: AMediaMan on 20 December, 2003, 22:04:26

Title: A stand alone ShowReg script
Post by: AMediaMan on 20 December, 2003, 22:04:26
Hey everyone I'm pretty sure that this has been asked before but i have searched everywhere for it with no luck.

I am using PtokaX TD4 and i would like a sript that shows all the regged users and op users in one list. Like if you where to type say !showregged it will give you a list of all regged users and ops, master an so on. I know there are many multi scripts out there with that but i would like one just to add to my all ready running scripts.

If this is possible or available please toss me a link or post one for me.

                         Thnx, AMediaMan
Title:
Post by: NightLitch on 21 December, 2003, 00:24:29
Just something put together... hope it works...

------------------------------------------------------------
-- Show All Registered Users by Level
-- By NightLitch 2003
--
-- Command: !showregi
------------------------------------------------------------
BotName = "-Regi-"


function DataArrival(curUser, data)
if strsub(data, 1, 1) ~= "<" then return end
local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
if not s then return end
cmd = strlower(cmd)
if (cmd=="showregi") then
ShowRegistered (curUser, data)
return 1
end
end

function ShowRegistered (curUser, data)
local ru = GetUsersByProfile(GetProfileName(3))
local Msg = "\r\n"
Msg = Msg.."\r\n "
Msg = Msg.."\r\n   ?*? Registered Users ?*? "
Msg = Msg.."\r\n????????????????????????"
local temp = {}
for idx, n in ru do
tinsert(temp, n)
end
sort(temp)
for i=1,getn(temp) do
local _,_,regs = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..regs..""
end
local vips = GetUsersByProfile(GetProfileName(2))
Msg = Msg.."\r\n "
Msg = Msg.."\r\n            ?*?   Vips  ?*?"
Msg = Msg.."\r\n????????????????????????"
local temp1 = {}
for idx1, n1 in vips do
tinsert(temp1, n1)
end
sort(temp1)
for i=1,getn(temp1) do
local _,_,vips = strfind(temp1[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..vips..""
end
local ops = GetUsersByProfile(GetProfileName(1))
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Operators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
local temp2 = {}
for idx2, n2 in ops do
tinsert(temp2, n2)
end
sort(temp2)
for i=1,getn(temp2) do
local _,_,ops = strfind(temp2[i],"(%S+)")

Msg = Msg.."\r\n "..i..".  "..ops..""
end
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Masters ?*?"
Msg = Msg.."\r\n????????????????????????"
local mast = GetUsersByProfile(GetProfileName(0))
Msg = Msg.."\r\n "
local temp3 = {}
for idx3, n3 in mast do
tinsert(temp3, n3)
end
sort(temp3)
for i=1,getn(temp3) do
local _,_,master = strfind(temp3[i],"(%S+)")

Msg = Msg.."\r\n "..i..".  "..master..""
end
Msg = Msg.."\r\n________________________"
Msg = Msg.."\r\n            End of List"
curUser:SendData(BotName, Msg)
end

I now a little bit messy,but if it works I can fix it so it is more nice looking...

/NL
Title:
Post by: AMediaMan on 21 December, 2003, 01:32:39
Thnx NightLitch I will try it out and let you know. bbs
Title:
Post by: AMediaMan on 21 December, 2003, 01:37:51
WOW what a rapid response and it does just what i asked and it works fine so far. Lots of thnx NightLitch ive looked everywhere for something like this.
 
                                Thnx, AMediaMan



       ps. Awe crap i dont mean to ask to much of you lol but i forgot one. Could you be so kind to add one for an Aop ..... Say in between the op and master.

sorry to bug you thnx again
Title:
Post by: NightLitch on 21 December, 2003, 12:21:22
Here try this one...

------------------------------------------------------------
-- Show All Registered Users by Level
-- By NightLitch 2003
--
-- Command: !showregi
------------------------------------------------------------
BotName = "-Regi-"


function DataArrival(curUser, data)
if strsub(data, 1, 1) ~= "<" then return end
local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
if not s then return end
cmd = strlower(cmd)
if (cmd=="showregi") then
ShowRegistered (curUser, data)
return 1
end
end

function ShowRegistered (curUser, data)
local ru = GetUsersByProfile(GetProfileName(3))
local Msg = "\r\n"
Msg = Msg.."\r\n "
Msg = Msg.."\r\n   ?*? Registered Users ?*? "
Msg = Msg.."\r\n????????????????????????"
local temp = {}
for idx, n in ru do
tinsert(temp, n)
end
sort(temp)
for i=1,getn(temp) do
local _,_,regs = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..regs..""
end
local vips = GetUsersByProfile(GetProfileName(2))
Msg = Msg.."\r\n "
Msg = Msg.."\r\n            ?*?   Vips  ?*?"
Msg = Msg.."\r\n????????????????????????"
local temp1 = {}
for idx1, n1 in vips do
tinsert(temp1, n1)
end
sort(temp1)
for i=1,getn(temp1) do
local _,_,vips = strfind(temp1[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..vips..""
end
local ops = GetUsersByProfile(GetProfileName(1))
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Operators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
local temp2 = {}
for idx2, n2 in ops do
tinsert(temp2, n2)
end
sort(temp2)
for i=1,getn(temp2) do
local _,_,ops = strfind(temp2[i],"(%S+)")

Msg = Msg.."\r\n "..i..".  "..ops..""
end
local Moder = GetUsersByProfile(GetProfileName(4))      ----------------  Change num. ( 4 ) to the number you have your Super OP or Moderator
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Moderators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
local tempx = {}
for idxx, nx in Moder do
tinsert(tempx, nx)
end
sort(tempx)
for i=1,getn(tempx) do
local _,_,mods = strfind(tempx[i],"(%S+)")

Msg = Msg.."\r\n "..i..".  "..mods..""
end
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Masters ?*?"
Msg = Msg.."\r\n????????????????????????"
local mast = GetUsersByProfile(GetProfileName(0))
Msg = Msg.."\r\n "
local temp3 = {}
for idx3, n3 in mast do
tinsert(temp3, n3)
end
sort(temp3)
for i=1,getn(temp3) do
local _,_,master = strfind(temp3[i],"(%S+)")

Msg = Msg.."\r\n "..i..".  "..master..""
end
Msg = Msg.."\r\n________________________"
Msg = Msg.."\r\n            End of List"
curUser:SendData(BotName, Msg)
end

Slappy as always but can clean it up and make look more good
and right later... don't have to much time right now...
but here you go...

/NL
Title:
Post by: AMediaMan on 21 December, 2003, 14:28:07
Very very nice infact its perfect, i'm not sure why something like this was so hard to find but you got to a tee lol. Thnx a bunch you have helped considerably.

                          Thnx again, AMediaMan



PtokaX is still the best
Title:
Post by: NightLitch on 22 December, 2003, 00:01:52
A little update:

------------------------------------------------------------
-- Show All Registered Users by Level
-- By NightLitch 2003
--
-- Command: !showregs
--
-- Made some fixes...
------------------------------------------------------------
BotName = "-Regi-"

MASTER = 0
MODERATOR = 4
OPERATOR = 1
VIP = 2
REG = 3

function DataArrival(curUser, data)
if strsub(data, 1, 1) ~= "<" then return end
local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
if not s then return end
cmd = strlower(cmd)
if (cmd=="showregs") then
ShowRegistered (curUser, data)
return 1
end
end

function ShowRegistered (curUser, data)
local Msg = "\r\n"
Msg = Msg.."\r\n "
Msg = Msg.."\r\n   ?*? Registered Users ?*? "
Msg = Msg.."\r\n????????????????????????"
local RegUser = GetUsersByProfile(GetProfileName(REG))
local temp = {}
for index, names in RegUser do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,Registered = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..Registered..""
end
Msg = Msg.."\r\n "
Msg = Msg.."\r\n            ?*?   Vips  ?*?"
Msg = Msg.."\r\n????????????????????????"
local VipUser = GetUsersByProfile(GetProfileName(VIP))
local temp = {}
for index, names in VipUser do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,Vips = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..Vips..""
end
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Operators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
local OpUser = GetUsersByProfile(GetProfileName(OPERATOR))
local temp = {}
for index, names in OpUser do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,Operator = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..Operator..""
end
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Moderators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
local ModUser = GetUsersByProfile(GetProfileName(MODERATOR))
local temp = {}
for index, names in ModUser do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,Moderator = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..Moderator..""
end
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Masters ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
local MasUser = GetUsersByProfile(GetProfileName(MASTER))
local temp = {}
for index, names in MasUser do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,Master = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..Master..""
end
Msg = Msg.."\r\n________________________"
Msg = Msg.."\r\n            End of List"
curUser:SendData(BotName, Msg)
end


function ViewRegs(Level,table,ProfileName,Msg)
end



and Plop or Tezlo or Phatty help me on this one...

I couldn't make a multi function on this what did I miss:

function ViewRegs(Level,table,ProfileName,Msg)
local table = GetUsersByProfile(GetProfileName(Level))
local temp = {}
for index, names in table do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,ProfileName = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..ProfileName..""
end
end

ViewRegs(MASTER,MasterTable,MasterName,Msg)


what is wrong, how do I send the data right...

ThX / NightLitch
Title:
Post by: plop on 22 December, 2003, 03:36:13
here you are.
function ViewRegs(Level)
   local table = GetUsersByProfile(Level)
local temp = {}
for index, names in table do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,ProfileName = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..ProfileName..""
end
end

plop
Title:
Post by: NightLitch on 22 December, 2003, 21:08:53
ThX Plop. :-)
Title:
Post by: NightLitch on 22 December, 2003, 21:19:34
it aint working...  :'-(

this is the way I want it to be in a sort of way...

Maybe something is wrong...

function ShowRegistered (curUser, data)
local Msg = "\r\n"
Msg = Msg.."\r\n "
Msg = Msg.."\r\n   ?*? Registered Users ?*? "
Msg = Msg.."\r\n????????????????????????"
ViewRegs(REG)
Msg = Msg.."\r\n "
Msg = Msg.."\r\n            ?*?   Vips  ?*?"
Msg = Msg.."\r\n????????????????????????"
ViewRegs(VIP)
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Operators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
ViewRegs(OPERATOR)
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Moderators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
ViewRegs(MODERATOR)
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Masters ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
ViewRegs(MASTER)
Msg = Msg.."\r\n________________________"
Msg = Msg.."\r\n            End of List"
curUser:SendData(BotName, Msg)
end


function ViewRegs(Level)
   local table = GetUsersByProfile(Level)
local temp = {}
for index, names in table do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,ProfileName = strfind(temp[i],"(%S+)")
Msg = Msg.."\r\n "..i..".  "..ProfileName..""
end
end

Plop help me plz or somebody else...

/NL
Title:
Post by: NightLitch on 22 December, 2003, 23:04:57
plop could you help me out ??? plz...

I don't get it working...

heres the hole script now...

------------------------------------------------------------
-- Show All Registered Users by Level
-- By NightLitch 2003
--
-- Command: !showregs
--
-- Made some fixes...
------------------------------------------------------------
BotName = "-Regi-"

MASTER = 0
MODERATOR = 4
OPERATOR = 1
VIP = 2
REG = 3

function DataArrival(curUser, data)
if strsub(data, 1, 1) ~= "<" then return end
local s, e, cmd, args = strfind(data, "^%b<> %!(%a+)%s*(.*)%|$")
if not s then return end
cmd = strlower(cmd)
if (cmd=="showregs") then
ShowRegistered (curUser, data)
return 1
end
end

function ShowRegistered (curUser, data)
local Msg = "\r\n"
Msg = Msg.."\r\n "
Msg = Msg.."\r\n   ?*? Registered Users ?*? "
Msg = Msg.."\r\n????????????????????????"
ViewRegs(REG)
Msg = Msg.."\r\n "
Msg = Msg.."\r\n            ?*?   Vips  ?*?"
Msg = Msg.."\r\n????????????????????????"
ViewRegs(VIP)
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Operators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
ViewRegs(OPERATOR)
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Moderators ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
ViewRegs(MODERATOR)
Msg = Msg.."\r\n "
Msg = Msg.."\r\n          ?*? Masters ?*?"
Msg = Msg.."\r\n????????????????????????"
Msg = Msg.."\r\n "
ViewRegs(MASTER)
Msg = Msg.."\r\n________________________"
Msg = Msg.."\r\n            End of List"
curUser:SendData(BotName, Msg)
end


function ViewRegs(Level)
   local Table = GetUsersByProfile(GetProfileName(Level))
local temp = {}
for index, names in Table do
tinsert(temp, names)
end
sort(temp)
for i=1,getn(temp) do
local _,_,ProfileName = strfind(temp[i],"(%S+)")
local Msg = ""
Msg = Msg.."\r\n "..i..".  "..ProfileName..""
end
end

plz m8... :-)

/NL
Title:
Post by: AMediaMan on 23 December, 2003, 02:47:10
Hey NightLitch whats wrong with the first two bud ? They work great for me. Are these other ones better ? Just wondering.


                AMediaMan
Title:
Post by: NightLitch on 23 December, 2003, 13:37:47
no it's nothing wrong with them... but I want too learn some
things...

Such as minimize the script a little and think is being a little
optimized if I get this one above working...

Use the ones that work -AMediaMan-.

Gonna post the working one later if I get it working... :-)

Have a good one / NightLitch
Title:
Post by: plop on 23 December, 2003, 14:35:22
here you are nightlitch.
------------------------------------------------------------
-- Show All Registered Users by Level
-- By NightLitch 2003
--
-- Commands: !showregs
--           !showlevel - level may be name or number
--
-- Made some fixes...
-- more fixes by plop
------------------------------------------------------------
BotName = "-Regi-"

NAMES = {
   ["reg"] = "\r\n   ?*? Registered Users ?*? ",
   ["vip"] = "\r\n            ?*?   Vips  ?*?",
   ["operator"] = "\r\n          ?*? Operators ?*?",
   ["moderator"] = "\r\n          ?*? Moderators ?*?",
   ["master"] = "\r\n          ?*? Masters ?*?"
   }

function DataArrival(curUser, data)
if strsub(data, 1, 1) ~= "<" then return end
   data = strsub(data, 1, (strlen(data)-1))
local s, e, cmd, args = strfind(data, "^%b<>%s%!(%a+)%s*(.*)")
if not s then return end
cmd = strlower(cmd)
if (cmd=="showregs") then
      Msg = "\r\n"
ShowRegistered()
      curUser:SendData(BotName, Msg)
return 1
   elseif cmd == "showlevel" then
      Msg = "\r\n"
      ViewRegs(args)
      curUser:SendData(BotName, Msg)
      return 1
end
end

function ShowRegistered()
ViewRegs("REG")
ViewRegs("VIP")
ViewRegs("OPERATOR")
ViewRegs("MODERATOR")
ViewRegs("MASTER")
Msg = Msg.."\r\n\tEnd of List"
end

function ViewRegs(Level)
   table = nil
   if tonumber(Level) then
      Level = GetProfileName(Level)
      table = GetUsersByProfile(Level)
   else
      table = GetUsersByProfile(Level)
   end
   if type(table) == "table" then
      local temp = {}
      for index, names in table do
         tinsert(temp, names)
      end
      sort(temp)
      if getn(temp) == 0 then
         Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
      else
         Msg = Msg..NAMES[strlower(Level)]
         Msg = Msg.."\r\n________________________"
         for i=1,getn(temp) do
            local _,_,ProfileName = strfind(temp[i],"(%S+)")
            Msg = Msg.."\r\n "..i..".  "..ProfileName..""
         end
         Msg = Msg.."\r\n________________________"
         Msg = Msg.."\r\n "
      end
   else
      Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
   end
end
as you can see amediaman, it's a bit shorter now and it excepts anything from profile name 2 profile number.

plop
Title:
Post by: NightLitch on 23 December, 2003, 15:04:14
Thx alot Plop... looks great to...

You have rebuild the hole function so I Am gonna study it.

/NL
Title:
Post by: AMediaMan on 23 December, 2003, 16:39:40
Hey Plop very nice.... not to take anything away from NightLitch but i will try this out as well. Learning Lua seems to be a slow proccess for me lol.Thnx for all the help.
Title:
Post by: AMediaMan on 23 December, 2003, 16:50:08
Well that one doesnt seem to work for me plop, not sure why and ofcourse i didnt copy the error so now i cant place it here lol go figure. Just wanted to let you know.

                  MERRY CHRISTMAS EVERYONE !!!!!

                                           AMediaMan
Title:
Post by: plop on 23 December, 2003, 17:03:44
QuoteOriginally posted by AMediaMan
Well that one doesnt seem to work for me plop, not sure why and ofcourse i didnt copy the error so now i cant place it here lol go figure. Just wanted to let you know.

                  MERRY CHRISTMAS EVERYONE !!!!!

                                           AMediaMan
i do need 2 know what error it gives, as here it all works fine.
it's hard 2 find an error not knowing what 2 look for.
would be great if you give me the command you give and the resulting error, then me or nightlitch can try 2 fix it.

merry christmas 2 u 2.

plop
Title:
Post by: NightLitch on 23 December, 2003, 20:22:14
I have one for ya Plop :-)

Try this for a change:


say level 7 and it's not found...

!showlevel 7

or in my case,

I have one Profile name:  SU+ / 5 and SU / 4

and when I want it showing it gets nilled... becouse maybe it's
not added to script... but you should prevent this nil value...

Hope I explaind myself right...

Otherwise I will correct it myself...

/NL
Title:
Post by: plop on 23 December, 2003, 23:25:08
easy. lol
------------------------------------------------------------
-- Show All Registered Users by Level
-- By NightLitch 2003
--
-- Commands: !showregs
--           !showlevel - level may be name or number
--
-- Made some fixes...
-- more fixes by plop
------------------------------------------------------------
BotName = "-Regi-"

NAMES = {
   ["reg"] = "\r\n   ?*? Registered Users ?*? ",
   ["vip"] = "\r\n            ?*?   Vips  ?*?",
   ["operator"] = "\r\n          ?*? Operators ?*?",
   ["moderator"] = "\r\n          ?*? Moderators ?*?",
   ["master"] = "\r\n          ?*? Masters ?*?"
   }

function DataArrival(curUser, data)
if strsub(data, 1, 1) ~= "<" then return end
   data = strsub(data, 1, (strlen(data)-1))
local s, e, cmd, args = strfind(data, "^%b<>%s%!(%a+)%s*(.*)")
if not s then return end
cmd = strlower(cmd)
if (cmd=="showregs") then
      Msg = "\r\n"
ShowRegistered()
      curUser:SendData(BotName, Msg)
return 1
   elseif cmd == "showlevel" then
      Msg = "\r\n"
      ViewRegs(args)
      curUser:SendData(BotName, Msg)
      return 1
end
end

function ShowRegistered()
ViewRegs("REG")
ViewRegs("VIP")
ViewRegs("OPERATOR")
ViewRegs("MODERATOR")
ViewRegs("MASTER")
Msg = Msg.."\r\n\tEnd of List"
end

function ViewRegs(Level)
   table = nil
   if tonumber(Level) then
      if GetProfileName(Level) then
         Level = GetProfileName(Level)
         table = GetUsersByProfile(Level)
      end
   else
      table = GetUsersByProfile(Level)
   end
   if type(table) == "table" then
      local temp = {}
      for index, names in table do
         tinsert(temp, names)
      end
      sort(temp)
      if getn(temp) == 0 then
         Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
      else
         Msg = Msg..NAMES[strlower(Level)]
         Msg = Msg.."\r\n________________________"
         for i=1,getn(temp) do
            local _,_,ProfileName = strfind(temp[i],"(%S+)")
            Msg = Msg.."\r\n "..i..".  "..ProfileName..""
         end
         Msg = Msg.."\r\n________________________"
         Msg = Msg.."\r\n "
      end
   else
      Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
   end
end

tested and working here.
[23:18] <-Regi->

 No users found with the level: 75
[23:22] <-Regi->

 No users found with the level: nothing
plop
Title:
Post by: AMediaMan on 24 December, 2003, 15:02:42
ok guys this is the error i get in the script editor


Syntax Error: function arguments expected;
  last token read: `=' at line 12 in string "code:----------------------------------------------------------..."


this is from the last posted script here, i am using PtokaX TD4 if that helps any.

                               AMediaMan
Title:
Post by: NightLitch on 24 December, 2003, 15:36:18
try copy the script again and leave code out...

or copy this simple copy/paste

Copy all between ============ the lines....


========================================


------------------------------------------------------------
-- Show All Registered Users by Level
-- By NightLitch 2003
--
-- Commands: !showregs
--           !showlevel - level may be name or number
--
-- Made some fixes...
-- more fixes by plop
------------------------------------------------------------
BotName = "-Regi-"

NAMES = {
   ["reg"] = "\r\n   ?*? Registered Users ?*? ",
   ["vip"] = "\r\n            ?*?   Vips  ?*?",
   ["operator"] = "\r\n          ?*? Operators ?*?",
   ["moderator"] = "\r\n          ?*? Moderators ?*?",
   ["master"] = "\r\n          ?*? Masters ?*?"
   }

function DataArrival(curUser, data)
   if strsub(data, 1, 1) ~= "<" then return end
   data = strsub(data, 1, (strlen(data)-1))
   local s, e, cmd, args = strfind(data, "^%b<>%s%!(%a+)%s*(.*)")
   if not s then return end
   cmd = strlower(cmd)
   if (cmd=="showregs") then
      Msg = "\r\n"
      ShowRegistered()
      curUser:SendData(BotName, Msg)
      return 1
   elseif cmd == "showlevel" then
      Msg = "\r\n"
      ViewRegs(args)
      curUser:SendData(BotName, Msg)
      return 1
   end
end

function ShowRegistered()
   ViewRegs("REG")
   ViewRegs("VIP")
   ViewRegs("OPERATOR")
   ViewRegs("MODERATOR")
   ViewRegs("MASTER")
   Msg = Msg.."\r\n\tEnd of List"
end

function ViewRegs(Level)
   table = nil
   if tonumber(Level) then
      if GetProfileName(Level) then
         Level = GetProfileName(Level)
         table = GetUsersByProfile(Level)
      end
   else
      table = GetUsersByProfile(Level)
   end
   if type(table) == "table" then
      local temp = {}
      for index, names in table do
         tinsert(temp, names)
      end
      sort(temp)
      if getn(temp) == 0 then
         Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
      else
         Msg = Msg..NAMES[strlower(Level)]
         Msg = Msg.."\r\n________________________"
         for i=1,getn(temp) do
            local _,_,ProfileName = strfind(temp,"(%S+)")
            Msg = Msg.."\r\n "..i..".  "..ProfileName..""
         end
         Msg = Msg.."\r\n________________________"
         Msg = Msg.."\r\n "
      end
   else
      Msg = Msg.."\r\n ".."No users found with the level: "..Level.."\r\n"
   end
end
[/SIZE]
========================================

You did just copy the code wrong when you got that message....
Title:
Post by: AMediaMan on 24 December, 2003, 16:26:17
Well now you must have been right lol everything works great now. Thnx a million.

One quick question how do you guys save these scripts as LUA is there a program for that ?
Title:
Post by: SaintSinner on 24 December, 2003, 16:39:31
QuoteOriginally posted by AMediaMan
Well now you must have been right lol everything works great now. Thnx a million.

One quick question how do you guys save these scripts as LUA is there a program for that ?

ptokax will save it as lua when you save it under the script editor window.
Title:
Post by: NightLitch on 24 December, 2003, 17:15:06
Or... :-)

Use Notepad and save it as file.lua

You can use all sorts of editors for saving AND creating lua...

I personally like EditPlus with LUA extension(template).

Mery Christmas
Title:
Post by: AMediaMan on 24 December, 2003, 17:36:09
Wow the forum is rocking today lol, Thnx to everyone for all the help you guys are truely amazing.

                                    AMediaMan

       MERRY CHRISTMAS EVERYONE !!!!!
Title:
Post by: wulfy21uk on 25 December, 2003, 06:59:06
any chance of u could add a random number gen or something to prevent auto registration?
Title:
Post by: plop on 26 December, 2003, 01:56:00
QuoteOriginally posted by wulfy21uk
any chance of u could add a random number gen or something to prevent auto registration?
you want a !regme command in this script witch generates a random password.?
posible but not now.

plop
Title:
Post by: AMediaMan on 24 January, 2004, 22:03:18
hey Plop or NightLitch that script works great but..... haha theres always a but right lol.

Well ive changed my profile for my hub so now they dont all show up :( . I was wondering if either of you nice fellows could make it work for me again like i said the script is perfect i just need a couple of profiles added, I will post my profiles.dat here for you thnx for the help in the past and hopefully more to come >:o).

heres my new profile.dat

0|Owner|11111111111111111111111000000001
1|Master|11111111111111111111110000000001
2|Admin|11111111111111111111000000000000
3|Moderator|11111110011111111111000000000000
4|Operator|10111110011111111111000000000000
5|VIP|10000000000001111000000000000000
6|Reg|10000000000000000000000000000000


         Thnx, AMediaMan
Title:
Post by: plop on 25 January, 2004, 22:57:12
QuoteOriginally posted by AMediaMan
hey Plop or NightLitch that script works great but..... haha theres always a but right lol.

Well ive changed my profile for my hub so now they dont all show up :( . I was wondering if either of you nice fellows could make it work for me again like i said the script is perfect i just need a couple of profiles added, I will post my profiles.dat here for you thnx for the help in the past and hopefully more to come >:o).

heres my new profile.dat

0|Owner|11111111111111111111111000000001
1|Master|11111111111111111111110000000001
2|Admin|11111111111111111111000000000000
3|Moderator|11111110011111111111000000000000
4|Operator|10111110011111111111000000000000
5|VIP|10000000000001111000000000000000
6|Reg|10000000000000000000000000000000


         Thnx, AMediaMan
try adding your extra profiles 2 the next parts.
NAMES = {
["reg"] = "\r\n ?*? Registered Users ?*? ",
["vip"] = "\r\n ?*? Vips ?*?",
["operator"] = "\r\n ?*? Operators ?*?",
["moderator"] = "\r\n ?*? Moderators ?*?",
["master"] = "\r\n ?*? Masters ?*?"
}

function ShowRegistered()
ViewRegs("REG")
ViewRegs("VIP")
ViewRegs("OPERATOR")
ViewRegs("MODERATOR")
ViewRegs("MASTER")
Msg = Msg.."\r\n\tEnd of List"
end
then they should fully work and show up.

plop
Title:
Post by: AMediaMan on 26 January, 2004, 03:02:25
haha you know what i tried that twice even i must have missed something works great now thnx alot, one last thing though..... how to make it return in a pm to the user ?

thnx again for all the help, AMediaMan
Title:
Post by: plop on 26 January, 2004, 03:14:56
QuoteOriginally posted by AMediaMan
haha you know what i tried that twice even i must have missed something works great now thnx alot, one last thing though..... how to make it return in a pm to the user ?

thnx again for all the help, AMediaMan
change:
 curUser:SendData(BotName, Msg)
for
 curUser:SendPM(BotName, Msg)

thats it.

plop
Title:
Post by: AMediaMan on 26 January, 2004, 03:51:16
Ok Plop you are teaching me alot here and i thank you much, but lol theres that word again haha, how about a pm in a different window dont i have to reg the bot or something, I have time to learn one more thing if you have time to teach >:o).

Thnx much for the last 2 lessons.


      AMediaMan
Title:
Post by: plop on 26 January, 2004, 04:08:24
QuoteOriginally posted by AMediaMan
Ok Plop you are teaching me alot here and i thank you much, but lol theres that word again haha, how about a pm in a different window dont i have to reg the bot or something, I have time to learn one more thing if you have time to teach >:o).

Thnx much for the last 2 lessons.


      AMediaMan
yw.
2 things you can do.

1) make this script show up in the users list by adding
function Main()
   frmHub:RegBot(BotName)
end
2) use a name from 1 of your other scripts, as long as the name is shown in the userslist the pm window will open.
this is a client issue not a hub.

plop
Title:
Post by: AMediaMan on 26 January, 2004, 04:30:44
Perfect Plop now if only i can remember this i might get somewhere hahaha, thnx for all the great help.

                AMediaMan
Title:
Post by: plop on 26 January, 2004, 12:09:59
QuoteOriginally posted by AMediaMan
Perfect Plop now if only i can remember this i might get somewhere hahaha, thnx for all the great help.

                AMediaMan
yw.
but i hope you don't get into trouble. lol

plop