Help me with !showreg
 

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

Help me with !showreg

Started by Janhouse, 15 April, 2004, 19:43:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Janhouse

I found this script in forums but I don't like it because when I write !showreg, information is shown in main chat window but I want that you can see information in PM.

Here is that script...
-- !showreg
-- !showlevel  - level may be name or number

BotName = "LV"

NAMES = {
   ["reg"] = "\r\n                                                    ---Profils Reg---",
   ["vip"] = "\r\n                                                    ---Profils VIP---",
   ["operator"] = "\r\n                                                    ---Profils  Operators---",
   ["moderator"] = "\r\n                                                    ---Profils Moderators---",
   ["master"] = "\r\n                                                    ---Profils 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=="showreg") 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("MASTER")
	ViewRegs("OPERATOR")
	ViewRegs("VIP")
	ViewRegs("REG")
	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 ".."Lietotaji ar profilu "..Level.." nav atrasti. \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 ".."Lietotaji ar profilu  "..Level.." nav atrasti. \r\n"
   end
end



Please help me. I am newbie in lua scripts.  :rolleyes:

plop

change.

curUser:SendData(BotName, Msg)

for

curUser:SendPM(BotName, Msg)

needs 2 be done on 2 places and your done.

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

Janhouse

Thank you! I will try.

SMF spam blocked by CleanTalk