nevermind, i did it myself. For anyone that wants it:
<?
/*
* Callers.php - Designate and list "Callers" for raids and events.
*
* BeBot - An Anarchy Online Chat Automaton
* Copyright (C) 2004 Jonas Jax
*
* Developed by Blondengy (RK1)
* Special thanks goes out to Khalem (RK1) for his support.
*
* File last changed at $LastChangedDate: 2004-12-29 01:41:32 +0100 (Wed, 29 Dec 2004) $
* Revision: $Id: Callers.php 8 2004-12-29 00:41:32Z blondengy $
*
* MySQL Version modifed by Malosar: 2005-10-12
*
*/
$db -> query("CREATE TABLE IF NOT EXISTS callers
(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(30))");
$callers = new Callers($bot);
$commands["pgmsg"]["caller"] = &$callers;
$commands["pgmsg"]["callers"] = &$callers;
/*
The Class itself...
*/
class Callers
{
var $bot;
var $callers;
/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Callers (&$bot)
{
$this -> bot = &$bot;
$this -> callers = array();
}
/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name, $msg)
{
if ($this -> bot -> is_member($name))
{
if (preg_match("/^" . $this -> bot -> commpre . "callers/i", $msg))
$this -> bot -> send_pgroup($this -> show_callers());
else if (preg_match("/^" . $this -> bot -> commpre . "caller add (.+)/i", $msg,
$info))
$this -> caller_add($info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "caller del (.+)/i", $msg,
$info))
$this -> caller_del($info[1]);
}
else
$this -> bot -> send_pgroup("You must be a member to use this command.");
}
/*
Add a caller
*/
function caller_add($name)
{
$name = ucfirst(strtolower($name));
if ($this -> bot -> aoc -> get_uid($name))
{
$this -> bot -> db -> query("INSERT INTO callers (name) VALUES ('". $name ."')");
$this -> bot -> send_pgroup("<font color=#ffff00>" . $name . "</font> has been added
to caller list. " . $this -> show_callers());
}
else
$this -> bot -> send_pgroup("Player <font color=#ffff00>" . $name . "</font> does
not exist.");
}
/*
Remove a caller
*/
function caller_del($name)
{
$name = ucfirst(strtolower($name));
if ($this -> bot -> aoc -> get_uid($name) != -1)
{
if ($this -> bot -> db -> select("SELECT id, name FROM callers ORDER BY name"))
{
$this -> bot -> db -> query("DELETE FROM callers WHERE name = '" . $msg . "'");
$this -> bot -> send_pgroup("<font color=#ffff00>" . $name . "</font> has been
removed from caller list. " . $this -> show_callers());
}
else
$this -> bot -> send_pgroup("<font color=#ffff00>" . $name . "</font> is not on
list of callers. " . $this -> show_callers());
}
else
$this -> bot -> send_pgroup("Player <font color=#ffff00>" . $name . "</font> does
not exist.");
}
/*
Return the list of callers
*/
function show_callers()
{
$call = $this -> bot -> db -> select("SELECT id, name FROM callers ORDER BY name");
if (empty($call))
return "No callers on list.";
else
{
$list = "<font color=CCInfoHeadline>::: List of callers :::</font>\n\n";
foreach ($call as $player)
$list .= " - <a href='chatcmd:///macro ".$player[1]." /assist ".$player[1]."'>".$player[1]."</a>\n";
return $this -> bot -> make_blob("List of Callers", $list);
}
}
}
?>