Well i changed !invite to actualy Invite and got rid of !inviteuser now which works fine
i also tried moving some code from my Old privgroup to this new 1 for features such as faction restriction on !join and !invite
i get this error when trying to set a faction
Fatal error: Call to a member function on a non-object in /Sources/Bot.php on line 470
altho not finished this is how my privgroup is now
<?php
/*
* PrivGroup.php - Basic featureset for private group handeling (join/kick etc)
*
* BeBot - An Anarchy Online Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005 Thomas J. Stens� and ShadowRealm Creations
*
* Developed by:
* - Blondengy (RK1)
* - Khalem (RK1)
*
* See Credits file for all aknowledgements.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* File last changed at $LastChangedDate: 2007-06-08 11:26:40 +0200 (Fri, 08 Jun 2007) $
* Revision: $Id: PrivGroup.php 594 2007-06-08 09:26:40Z alreadythere $
*/
$privgroup = new PrivGroup($bot);
if ($bot -> guildbot)
{
$joindef = "gc";
$leavedef = "gc";
}
else
{
$joindef = "pgmsg";
$leavedef = "none";
}
$longjoin = "Which chat channels should be notified about joins to the private chat channel?";
$longleave = "Which chat channels should be notified about leave to the private chat channel?";
$bot -> set -> create("PrivGroup", "EchoJoin", $joindef, $longjoin, "none;pgmsg;gc;both");
$bot -> set -> create("PrivGroup", "EchoLeave", $leavedef, $longleave, "none;pgmsg;gc;both");
$bot -> set -> create("PrivGroup", "JoinString", "#!NICKNAME!# (#!LEVEL!#/#!AT_ID!# #!FACTION!# #!PROFESSION!#, #!ORG!#) has joined #!BOTNAME!#", "Formating string for join notifications.", "", TRUE);
$bot -> set -> create("PrivGroup", "LeaveString", "#!NICKNAME!# has left #!BOTNAME!#", "Formating string for leave notifications.", "", TRUE);
$bot -> set -> create("PrivGroup", "Deactivated", FALSE, "Is joining the private chat deactived?");
$bot -> set -> create("PrivGroup", "DeactivatedText", "Private chatgroup is disabled!", "The text shown if the private chat cannot be joined.", "");
unset($longjoin);
unset($longleave);
unset($joindef);
unset($leavedef);
// Create sane default levels for the commands
$bot -> accesscontrol -> create("tell", "join", "GUEST");
$bot -> accesscontrol -> create("tell", "chat", "GUEST");
//$bot -> accesscontrol -> create("tell", "invite", "GUEST");
$bot -> accesscontrol -> create("tell", "leave", "ANONYMOUS");
$bot -> accesscontrol -> create("tell", "kick", "ANONYMOUS");
$bot -> accesscontrol -> create("tell", "invite", "LEADER");
$bot -> accesscontrol -> create("pgmsg", "invite", "LEADER");
$bot -> accesscontrol -> create("pgmsg", "leave", "ANONYMOUS");
$bot -> accesscontrol -> create("pgmsg", "kick", "ANONYMOUS");
$bot -> accesscontrol -> create("pgmsg", "kickuser", "LEADER");
$bot -> accesscontrol -> create("pgmsg", "kickall", "ADMIN");
$bot -> accesscontrol -> create("gc", "join", "MEMBER");
$bot -> accesscontrol -> create("gc", "invite", "ADMIN");
$bot -> accesscontrol -> create("gc", "kickuser", "ADMIN");
$bot -> accesscontrol -> create("gc", "kickall", "ADMIN");
$bot -> accesscontrol -> create("tell", "lock", "ADMIN");
$bot -> accesscontrol -> create("tell", "faction", "ADMIN");
$bot -> accesscontrol -> create("tell", "forceinvite", "ADMIN");
$bot -> accesscontrol -> create("tell", "maxplayers", "ADMIN");
$bot -> accesscontrol -> create("pgmsg", "lock", "ADMIN");
$bot -> accesscontrol -> create("pgmsg", "faction", "ADMIN");
$bot -> accesscontrol -> create("pgmsg", "forceinvite", "ADMIN");
$bot -> accesscontrol -> create("pgmsg", "maxplayers", "ADMIN");
$commands["tell"]["join"] = &$privgroup;
$commands["tell"]["chat"] = &$privgroup;
$commands["tell"]["leave"] = &$privgroup;
$commands["tell"]["kick"] = &$privgroup;
$commands["tell"]["invite"] = &$privgroup;
$commands["tell"]["invite"] = &$privgroup;
$commands["pgmsg"]["leave"] = &$privgroup;
$commands["pgmsg"]["invite"] = &$privgroup;
$commands["pgmsg"]["kick"] = &$privgroup;
$commands["pgmsg"]["kickuser"] = &$privgroup;
$commands["pgmsg"]["kickall"] = &$privgroup;
$commands["gc"]["join"] = &$privgroup;
$commands["gc"]["invite"] = &$privgroup;
$commands["gc"]["kickuser"] = &$privgroup;
$commands["gc"]["kickall"] = &$privgroup;
$commands['tell']['lock'] = &$PrivGroup;
$commands['tell']['faction'] = &$PrivGroup;
$commands['tell']['forceinvite'] = &$PrivGroup;
$commands['tell']['maxplayers'] = &$PrivGroup;
$commands['pgmsg']['lock'] = &$PrivGroup;
$commands['pgmsg']['faction'] = &$PrivGroup;
$commands['pgmsg']['forceinvite'] = &$PrivGroup;
$commands['pgmsg']['maxplayers'] = &$PrivGroup;
$commands["pgjoin"][] = &$privgroup;
$commands["pgleave"][] = &$privgroup;
/*
The Class itself...
*/
class PrivGroup
{
var $bot;
var $mode;
/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function PrivGroup (&$bot)
{
$this -> bot = &$bot;
$this -> help['description'] = 'Module to handle the privat group.';
$this -> help['command']['join']="Join the private group of the bot.";
$this -> help['command']['chat']="Join the private group of the bot.";
// $this -> help['command']['invite']="Join the private group of the bot.";
$this -> help['command']['leave'] = "Leave the private group of the bot.";
$this -> help['command']['kick'] = "Leave the private group of the bot.";
$this -> help['command']['invite <name>'] = "Invites the player <name> to the private group of the bot.";
$this -> help['command']['kickuser <name>'] = "Kicks player <name> from the private group of the bot.";
$this -> help['command']['kickall'] = "Completely empties the private group of the bot.";
$this -> faction = 'Clan';
$this -> mode = 'include';
$this -> lock = 'disabled';
$this -> maxplayers = '200';
}
/*
This gets called on a tell with the command
*/
function tell($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "join/i", $msg)
// || preg_match("/^" . $this -> bot -> commpre . "invite$/i", $msg)
|| preg_match("/^" . $this -> bot -> commpre . "chat/i", $msg))
{
if ($this -> bot -> settings["Privgroup"]["Deactivated"])
{
$this -> bot -> send_tell($name, $this -> bot -> settings["Privgroup"]["Deactivatedtext"]);
}
else
{
$this -> bot -> aoc -> privategroup_invite($name);
}
}
else if (preg_match("/^" . $this -> bot -> commpre . "leave/i", $msg)
|| preg_match("/^" . $this -> bot -> commpre . "kick$/i", $msg))
$this -> bot -> aoc -> privategroup_kick($name);
else if (preg_match("/^" . $this -> bot -> commpre . "invite (.+)$/i", $msg, $info))
{
if ($this -> bot -> settings["Privgroup"]["Deactivated"])
{
$this -> bot -> send_tell($name, $this -> bot -> settings["Privgroup"]["Deactivatedtext"]);
}
else
{
$this -> invite($name, "tell", $info[1]);
}
}
else if (preg_match('/^'.$this -> bot -> commpre.'lock/i', $msg, $info)) $c = $this -> lock($name);
else if (preg_match('/^'.$this -> bot -> commpre.'maxplayers *([-0-9]+)*/i', $msg, $info)) $c = isset($info['1']) ? $this -> max_players($name, $info['1']) : $this -> max_players($name, 'return');
else if (preg_match('/^'.$this -> bot -> commpre.'forceinvite (.+)$/i', $msg, $info)) $c = $this -> forceinvite($name, ucfirst($info['1']));
else if (preg_match('/^'.$this -> bot -> commpre.'faction exclude (.+)/i', $msg, $info)) $c = $this -> faction($name, 'exclude', ucfirst($info['1']));
else if (preg_match('/^'.$this -> bot -> commpre.'faction (.+)$/i', $msg, $info)) $c = $this -> faction($name, 'include', ucfirst($info['1']));
else $c = $this -> bot -> send_help($name);
$c != '' ? $this -> bot -> send_tell($name, $c) : NULL;
}
/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "leave/i", $msg))
$this -> bot -> aoc -> privategroup_kick($name);
else if (preg_match("/^" . $this -> bot -> commpre . "kick$/i", $msg))
$this -> bot -> aoc -> privategroup_kick($name);
else if (preg_match("/^" . $this -> bot -> commpre . "invite (.+)$/i", $msg, $info))
$this -> invite($name, "pgmsg", $info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "kickuser (.+)$/i", $msg, $info))
$this -> bot -> aoc -> privategroup_kick($info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "kickall$/i", $msg))
$this -> kick_all($name);
else if (preg_match('/^'.$this -> bot -> commpre.'lock/i', $msg, $info)) $c = $this -> lock($name);
else if (preg_match('/^'.$this -> bot -> commpre.'maxplayers *([-0-9]+)*/i', $msg, $info)) $c = isset($info['1']) ? $this -> max_players($name, $info['1']) : $this -> max_players($name, 'return');
else if (preg_match('/^'.$this -> bot -> commpre.'forceinvite (.+)$/i', $msg, $info)) $c = $this -> forceinvite($name, ucfirst($info['1']));
else if (preg_match('/^'.$this -> bot -> commpre.'faction exclude (.+)/i', $msg, $info)) $c = $this -> faction($name, 'exclude', ucfirst($info['1']));
else if (preg_match('/^'.$this -> bot -> commpre.'faction (.+)$/i', $msg, $info)) $c = $this -> faction($name, 'include', ucfirst($info['1']));
$c != '' ? $this -> bot -> send_pgroup($c) : NULL;
}
/*
This gets called on a msg in the guildchat with the command
*/
function gc($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "join/i", $msg))
{
if ($this -> bot -> settings["Privgroup"]["Deactivated"])
{
$this -> bot -> send_gc($this -> bot -> settings["Privgroup"]["Deactivatedtext"]);
}
else
{
$this -> bot -> aoc -> privategroup_invite($name);
}
}
else if (preg_match("/^" . $this -> bot -> commpre . "invite (.+)$/i", $msg, $info))
{
if ($this -> bot -> settings["Privgroup"]["Deactivated"])
{
$this -> bot -> send_gc($this -> bot -> settings["Privgroup"]["Deactivatedtext"]);
}
else
{
$this -> invite($name, "gc", $info[1]);
}
}