collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Members Online  (Read 6285 times)

0 Members and 1 Guest are viewing this topic.

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Members Online
« on: December 03, 2005, 05:41:58 am »
This is a pretty simple one that will show how many bot members are online

Save as MembersOnline.php in your modules folder, and use !membersonline on tells or raidchannel

Code: [Select]
<?
$membersOnline = new MembersOnline($bot);

$commands["tell"]["membersonline"] = &$membersOnline;
$commands["pgmsg"]["membersonline"] = &$membersOnline;


class MembersOnline
{
var $bot;
var $message;


function MembersOnline (&$bot)
{
$this -> bot = &$bot;
}

function tell($name, $msg)
{
$this -> bot -> send_tell($name, $this -> processCommand($name, $msg));
}

function pgmsg($name, $msg)
{
$this -> bot -> send_pgroup($this -> processCommand($name, $msg));
}


function processCommand($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "membersonline$/i", $msg))
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
$allonline = array_keys($this -> bot -> commands["tell"]["online"] -> guild);
$online = count($allonline);
return "There are <font color=#ffff00>$online</font> <botname> members online.";
}
}
}
}
?>
« Last Edit: December 11, 2005, 03:55:22 pm by Khalem »

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Re: Members Online
« Reply #1 on: December 11, 2005, 10:54:05 am »
I don't think this work if you have over 1000 members, can someone confirm this?

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Members Online
« Reply #2 on: December 11, 2005, 06:10:46 pm »
There's a much easier way of showing the online members, and to show an actual list.

Get the members from the DB, 1 by 1, and as you get, check if they are online, (which doesn't exactly need to be saved in buddylist), add 1 to a counter, make an array if you want to show all members.

If you understand that, it theoretically should work :P I'll try to do up an online list today and post.
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Members Online
« Reply #3 on: December 11, 2005, 11:28:12 pm »
Silly question, but why not just use the online.php for this?
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Members Online
« Reply #4 on: December 12, 2005, 01:17:21 am »
I made a !memberslist to show all members of the bot, along with if they were online.

That piece Wanuarmi posted is just repetition as it's already a module for the bot :p
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Re: Members Online
« Reply #5 on: December 12, 2005, 01:33:18 am »
what it does is show how many bot members are online, not on the chat

its mostly for raid bots, but it breaks after you have more than 1k members,
cause it counts the online people on the bots buddy list

 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 265
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal