Number of regusers
 

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

Number of regusers

Started by BrotherBear, 11 February, 2007, 21:21:06

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BrotherBear

Is there anyone who could make a script with this function:

frmHub:GetRegisteredUsers()

I would like to use it with Rightclick and sorted in Profiles?

Like this:


Profile      Nr of Users

Reg      243
VIP      26
OP      9
Masters      2
etc...

Total registered Users in The Hub: 280

Or know about a script that does this?

Regards,

BrotherBear

bastya_elvtars

#1
Sure thing! :)

-- RegStats by bastya_elvtars
-- requested by BrotherBear
-- shows registered users' numbers by profile

command="getregs" -- the desired command, WITHOUT prefix, the prefixes set in PtokaX will be used

----------------------------------------------------------------------------
Bot=frmHub:GetHubBotName()

function Main()
  prf="[%"..table.concat(frmHub:GetPrefixes(),"%").."]"
end

function ChatArrival (user, data)
  local cmd=data:sub(1,-2):match("%b<>%s+"..prf.."(%S+)")
  if cmd==command then
    local stats={}
    for _,usr in ipairs(frmHub:GetRegisteredUsers()) do
      local profname=GetProfileName(usr.iProfile)
      stats[profname]=stats[profname] or 0
      stats[profname]=stats[profname]+1
    end
    local c=0
    local msg="\r\n"..("-"):rep(45).."\r\nNumber of registered users by profile:\r\n"..("="):rep(25)
    for profname,number in pairs(stats) do
      c=c+number
      msg=msg.."\r\n"..profname..":\t"..number
    end
    msg=msg.."\r\n"..("="):rep(25).."\r\nTotal: "..c
    user:SendPM(Bot,msg)
    return 1
  end
end

function NewUserConnected(user) user:SendData("$UserCommand 1 3 Get # of registered users$<%[mynick]> !"..command.."&#124;") end; OpConnected=NewUserConnected
Everything could have been anything else and it would have just as much meaning.

BrotherBear

LoooL, your are on fire today bastya_elvtars

Sorry for Posting in wrong Forum :(

Thanks for this script it is just what I was looking for!

One thing tough, the total is a little wrong here :)

---------------------------------------------
Number of registered users by profile:
=========================
SVIP:   11
VIP:   99
KVIP:   7
Master:   8
Reg:   428
Moderator:   5
Netfounder:   2
Operator:   19
=========================
Total: 8

Could you fix this, pleeeaaase :) ?
Regards,

BrotherBear

BrotherBear

Are you serious Mutor :) ?

Your script part above, where do I past it?

Under

function Main()
  prf="[%"..table.concat(frmHub:GetPrefixes(),"%").."]"

Or what ?
Regards,

BrotherBear

bastya_elvtars

If you use my script, there is no need for that.
And yes, I already noticed the error and it's already fixed above.

Quote from: Mutor on 11 February, 2007, 22:12:07
Whats to fix?
That's Hungarian math  :P
he-he
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

Quote from: Mutor on 11 February, 2007, 22:23:06
Are YOU serious? You don't know how to call a function?

No, he is an end-user, you know. :P
Everything could have been anything else and it would have just as much meaning.

BrotherBear

Oh is it so easy to learn this stuff ;)

Regards,

BrotherBear

BrotherBear

Yes I did try, but get errors

Have been trying to make MY OWN script all evening, but whitout success :(

I am trying, believe me!!!

As you say, I have been modding code before.

But sometimes it is great to have Forum like this to get some help.
Regards,

BrotherBear

bastya_elvtars

Uhm, could you please post some feedback whether my sctipt works?
Everything could have been anything else and it would have just as much meaning.

BrotherBear

Yes bastya_elvtars it works great :)

Thanks again
As I am from Sweden I have sometimes difficult to understand English
and right know I am really tired :(

Sorry if I didn't try enough, I'll try harder next time :)
Regards,

BrotherBear

SMF spam blocked by CleanTalk