A stand alone ShowReg script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

A stand alone ShowReg script

Started by AMediaMan, 20 December, 2003, 22:04:26

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

AMediaMan

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

NightLitch

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
//NL

AMediaMan

Thnx NightLitch I will try it out and let you know. bbs

AMediaMan

#3
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

NightLitch

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
//NL

AMediaMan

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

NightLitch

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
//NL

plop

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NightLitch

//NL

NightLitch

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
//NL

NightLitch

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
//NL

AMediaMan

Hey NightLitch whats wrong with the first two bud ? They work great for me. Are these other ones better ? Just wondering.


                AMediaMan

NightLitch

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
//NL

plop

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NightLitch

Thx alot Plop... looks great to...

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

/NL
//NL

AMediaMan

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.

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

plop

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NightLitch

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
//NL

plop

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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

AMediaMan

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

NightLitch

#21
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....
//NL

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 ?

SaintSinner

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.
   


NightLitch

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
//NL

SMF spam blocked by CleanTalk