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

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

Author Topic: automember  (Read 3495 times)

0 Members and 1 Guest are viewing this topic.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
automember
« on: June 05, 2007, 12:10:03 am »
i tryed to add a module to add any 1 who joins private group to member list put it doesnt seem to work

Code: [Select]
$automember = new automember($bot);

$commands["tell"]["automember"] = &$automember;
$commands["pgmsg"]["automember"] = &$automember;
$commands["pgjoin"][] = &$automember;


/*
The Class itself...
*/
class AutoMember
{
var $bot;



/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function AutoMember (&$bot)
{
$this -> bot = &$bot;
}

    /*
      This gets called when some 1 joins private group
    */
   
    function pgjoin($name)
    {
  $result = $this -> bot -> db -> select("SELECT nickname FROM members WHERE id = " . $this -> bot -> aoc -> get_uid($info[1]));
  if (empty($result))
  {
  if (!$this -> bot -> aoc -> get_uid($info[1]))
  $this -> bot -> send_tell($name, "Player <font color=#ffff00>" . $info[1] . "</font> does not exist");
  else
  {
        $member = $this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($info[1]) . "/bio.xml");
              $members["nickname"] = ucfirst(strtolower($info[1]));
              $members["firstname"] = $this -> bot -> xmlparse($member, "firstname");
              $members["lastname"] = $this -> bot -> xmlparse($member, "lastname");
              $members["rank"] = $this -> bot -> xmlparse($member, "rank_id");
              $members["rank_name"] = $this -> bot -> xmlparse($member, "rank");
              $members["level"] = $this -> bot -> xmlparse($member, "level");
              $members["profession"] = $this -> bot -> xmlparse($member, "profession");
              $members["gender"] = $this -> bot -> xmlparse($member, "gender");
              $members["guild"] = $this -> bot -> xmlparse($member, "organization_name");
              $members["breed"] = $this -> bot -> xmlparse($member, "breed");
              $members["pic"] = $this -> bot -> xmlparse($member, "pictureurl");
              $members["id"] = $this -> bot -> aoc -> get_uid($members["nickname"]);
             
              if (($members["level"] >= 1) && ($members["level"] <= 99))
                $members["lvlrange"] = "1-99";
              else if (($members["level"] >= 100) && ($members["level"] <= 149))
                $members["lvlrange"] = "100-149";
              else if (($members["level"] >= 150) && ($members["level"] <= 199))
                $members["lvlrange"] = "150-199";
              else if (($members["level"] >= 200) && ($members["level"] <= 214))
                $members["lvlrange"] = "200-214";
              else if (($members["level"] >= 215) && ($members["level"] <= 220))
                $members["lvlrange"] = "215-220";
              else
                $members["lvlrange"] = "unknown";

              $this -> bot -> aoc -> buddy_add($members["id"]);
             
              $this -> bot -> db -> query("INSERT INTO members (id, nickname, firstname, lastname, rank, rank_name, level, profession, gender, breed, pic, guild, lvlrange, updated)
                          VALUES ('" . $members["id"] . "',
                                  '" . $members["nickname"] . "', '" . $members["firstname"] . "',
                                  '" . $members["lastname"] . "', '" . $members["rank"] . "',
                                  '" . $members["rank_name"] . "', '" . $members["level"] . "',
                                  '" . $members["profession"] . "', '" . $members["gender"] . "',
                                  '" . $members["breed"] . "', '" . $members["pic"] . "',
                                  '" . $members["guild"] . "', '" . $members["lvlrange"] . "',
" . time() . ")");
              $this -> bot -> db -> query("INSERT INTO member_settings (id, nickname)
                          VALUES ('" . $members["id"] . "',
                                  '" . $members["nickname"] . "')");
  $this -> bot -> send_pgroup("Player <font color=#ffff00>" . $info[1] . "</font> has been added to the bot.");
  $this -> bot -> send_tell($info[1], "<font color=#ffff00>You have been added to the bot.");
  $this -> bot -> send_tell($info[1], "<font color=#00ff00> AutoInv is ON by Default, To Turn off /tell <botname> <pre>autoinv off.</font>");

    }
  }
    }
}

Offline tonyuh

  • BeBot User
  • **
  • Posts: 48
  • Karma: +0/-0
Re: automember
« Reply #1 on: June 05, 2007, 12:37:21 am »
Seems like you just copy and paste the code from somewhere since you're trying to look up $info[1] where you need to lookup $name. I assume the other parts are from roster_GUILD so they should be correct. Just replace $info[1] with $name and it should work. If not repost with the problem afterwards.

Another way to do it is to put
Code: [Select]
$this -> bot -> commands["tell"]["member"] -> tell($name, $this -> bot -> commpre . "member " . $name);instead of all the stuff inside the pgjoin function. (assuming the function in your roster_GUILD is called member)

Tony

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: automember
« Reply #2 on: June 05, 2007, 03:14:56 am »
Thank you that works but now im was trying to add some more stuff i realy needed and
on the faction part i get an error "unable to call function faction" or somit
also my ban part doesnt seen to work :/
Code: [Select]
$automember = new automember($bot);

$commands["tell"]["automember"] = &$automember;
$commands["pgmsg"]["automember"] = &$automember;
$commands["pgjoin"][] = &$automember;
$commands['pgmsg']['faction'] = &$privgroup;



/*
The Class itself...
*/
class AutoMember
{
var $bot;



/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function AutoMember (&$bot)
{
$this -> bot = &$bot;
$this -> faction = 'Clan';

}

    /*
      This gets called when some 1 joins private group
    */
   
    function pgjoin($name)
    {
if(!$this -> bot -> commands['tell']['banlist'] -> bancheck($name)) {
    if($this -> faction($name, '', '') == '1') {
  $result = $this -> bot -> db -> select("SELECT nickname FROM members WHERE id = " . $this -> bot -> aoc -> get_uid($name));
  if (empty($result))
  {
  if (!$this -> bot -> aoc -> get_uid($name))
  $this -> bot -> send_tell($name, "Player <font color=#ffff00>" . $name . "</font> does not exist");
  else
  {
        $member = $this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml");
              $members["nickname"] = ucfirst(strtolower($name));
              $members["firstname"] = $this -> bot -> xmlparse($member, "firstname");
              $members["lastname"] = $this -> bot -> xmlparse($member, "lastname");
              $members["rank"] = $this -> bot -> xmlparse($member, "rank_id");
              $members["rank_name"] = $this -> bot -> xmlparse($member, "rank");
              $members["level"] = $this -> bot -> xmlparse($member, "level");
              $members["profession"] = $this -> bot -> xmlparse($member, "profession");
              $members["gender"] = $this -> bot -> xmlparse($member, "gender");
              $members["guild"] = $this -> bot -> xmlparse($member, "organization_name");
              $members["breed"] = $this -> bot -> xmlparse($member, "breed");
              $members["pic"] = $this -> bot -> xmlparse($member, "pictureurl");
              $members["id"] = $this -> bot -> aoc -> get_uid($members["nickname"]);
             
              if (($members["level"] >= 1) && ($members["level"] <= 99))
                $members["lvlrange"] = "1-99";
              else if (($members["level"] >= 100) && ($members["level"] <= 149))
                $members["lvlrange"] = "100-149";
              else if (($members["level"] >= 150) && ($members["level"] <= 199))
                $members["lvlrange"] = "150-199";
              else if (($members["level"] >= 200) && ($members["level"] <= 214))
                $members["lvlrange"] = "200-214";
              else if (($members["level"] >= 215) && ($members["level"] <= 220))
                $members["lvlrange"] = "215-220";
              else
                $members["lvlrange"] = "unknown";

              $this -> bot -> aoc -> buddy_add($members["id"]);
             
              $this -> bot -> db -> query("INSERT INTO members (id, nickname, firstname, lastname, rank, rank_name, level, profession, gender, breed, pic, guild, lvlrange, updated)
                          VALUES ('" . $members["id"] . "',
                                  '" . $members["nickname"] . "', '" . $members["firstname"] . "',
                                  '" . $members["lastname"] . "', '" . $members["rank"] . "',
                                  '" . $members["rank_name"] . "', '" . $members["level"] . "',
                                  '" . $members["profession"] . "', '" . $members["gender"] . "',
                                  '" . $members["breed"] . "', '" . $members["pic"] . "',
                                  '" . $members["guild"] . "', '" . $members["lvlrange"] . "',
" . time() . ")");
              $this -> bot -> db -> query("INSERT INTO member_settings (id, nickname)
                          VALUES ('" . $members["id"] . "',
                                  '" . $members["nickname"] . "')");
  $this -> bot -> send_pgroup("Player <font color=#ffff00>" . $name . "</font> has been added to the bot.");
  $this -> bot -> send_tell($name, "<font color=#ffff00>You have been added to the bot.");
  $this -> bot -> send_tell($name, "<font color=#00ff00> AutoInv is ON by Default, To Turn off /tell <botname> <pre>autoinv off.</font>");

    }
  }
} else $c = 'AutoMember is currently restricted to'.$this -> highlight_1.$this -> faction.'</font>.';
} else $c = $this -> highlight_1.$name.'</font>is Banned WTF is " . $name . " doing here .... Kicking.';
$this -> bot -> aoc -> privategroup_kick($who);
    }

Offline tonyuh

  • BeBot User
  • **
  • Posts: 48
  • Karma: +0/-0
Re: automember
« Reply #3 on: June 05, 2007, 11:37:15 am »
Again you're copying from somewhere and forgot to copy the whole thing. You need to copy the function "faction" from the file you copy that from, or point the command to that php instead of the same file (ie. $this -> bot -> privgroup -> faction($arg1, $arg2, $arg3)). Also you need to fix that last 2 lines, $c doesn't do anything after its been assigned.

For the ban part, try using
Code: [Select]
if (!$this -> bot -> banlist -> bancheck($name)) {instead, that way of doing commands is when you want the answer to be given back to a person, shouldn't use it within the function if you want to use the result.

Tony

Offline Blueeagle

  • Omnipotent
  • BeBot Hero
  • ******
  • Posts: 323
  • Karma: +0/-0
Re: automember
« Reply #4 on: June 05, 2007, 10:17:29 pm »
I'm trying to be funny, not mean but you seem like the definition(urbandictionary.com) of a copy paste monkey.

:D
The only problem that can't be solved by adding another wrapper is having too many wrappers.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: automember
« Reply #5 on: June 06, 2007, 07:36:58 pm »
lol yer i copy and paste alot :p

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: automember
« Reply #6 on: June 06, 2007, 07:52:56 pm »
Fatal error: Call to a member function on a non-object in /data/members/paid/a/o/aofiles.com/htdocs/battle150/modules/AutoMember.php on line 48

48 = ban line

Offline tonyuh

  • BeBot User
  • **
  • Posts: 48
  • Karma: +0/-0
Re: automember
« Reply #7 on: June 06, 2007, 08:38:27 pm »
Make sure to put
Code: [Select]
$this -> bot -> banlist = &$this;in the banlist module so it can be used globally. Just put it after
Code: [Select]
$this -> bot = &$bot;in the constructor function.

Tony

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: automember
« Reply #8 on: June 07, 2007, 12:00:17 am »
still getting that error for both things
i have posted the 3 files and changed to txt here
http://www.aofiles.com/modules/

Offline tonyuh

  • BeBot User
  • **
  • Posts: 48
  • Karma: +0/-0
Re: automember
« Reply #9 on: June 07, 2007, 12:19:28 am »
I'm just guessing here but I think its because banlist.php will be loaded after automember.php (since A comes before B) so you need to change your php file name from AutoMember.php to zAutoMember.php or change Banlist.php to 1Banlist.php. Also try not to use capitalised function name (ie. $this -> bot -> banlist -> bancheck($name))

Tony

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: automember
« Reply #10 on: June 07, 2007, 04:48:13 am »
i dont think thats the prob
as the error happens when some 1 joins the private group

Offline tonyuh

  • BeBot User
  • **
  • Posts: 48
  • Karma: +0/-0
Re: automember
« Reply #11 on: June 07, 2007, 07:18:24 pm »
I can't see why the ban line is still wrong, can you copy paste the error log from the console please. With some lines before the error as well.

Tony

 

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


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 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: 672
  • 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