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: function pgleave  (Read 1513 times)

0 Members and 1 Guest are viewing this topic.

Offline Solerna

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
function pgleave
« on: December 06, 2005, 03:04:44 am »
ok trying to remove ppl from rolls when they leave the bot was trying with this.

Code: [Select]
function pgleave($name) {
$num = 0;
foreach($this -> loot as $slot) {
$num++;
unset($this -> loot[$num][$name]);
}
  }


However that instantly crashes the bot as soon as someone leaves the group.

if I rename the function and use it as the result of a command, it works as intended.

The error I get is:

"Fatal error: Call to a member function on a non-object in C:\bebot\Bot.php on line 455"

Code: [Select]
   function inc_pgleave($args)
    {
      $user = $this -> aoc -> get_uname($args[1]);

      $this -> log("PGRP", "LEAVE", $user . " left privategroup.");

      if (!empty($this -> commands["pgleave"]))
      {
        $keys = array_keys($this -> commands["pgleave"]);
        foreach ($keys as $key)
          $this -> commands["pgleave"][$key] -> pgleave($user);
      }
    }


Line 455 being:

Code: [Select]

          $this -> commands["pgleave"][$key] -> pgleave($user);


I was playing around trying with

Code: [Select]
if (isset($this -> loot[$num][$name])){
        unset($this -> loot[$num][$name]);
}


Giving the sameresult. Crash with the same error msg. Did not try this one as reaction to a command though.

Now any ideas anyone?

Offline Blondengy

  • BeBot Creator and Founder
  • BeBot Hero
  • ******
  • Posts: 51
  • Karma: +0/-0
function pgleave
« Reply #1 on: December 06, 2005, 06:19:26 pm »
Sounds like a typo at the very top where you register the functions (the $commands[....] stuff)

Could you copy&paste that?

Offline Solerna

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
function pgleave
« Reply #2 on: December 06, 2005, 07:01:50 pm »
U mean this?

Code: [Select]
$commands["pgleave"][] = &$thisclass;


Edit: And I see it myself >.< Stoopid meh
And it all works like a charm.

Offline Blondengy

  • BeBot Creator and Founder
  • BeBot Hero
  • ******
  • Posts: 51
  • Karma: +0/-0
function pgleave
« Reply #3 on: December 06, 2005, 07:50:12 pm »
/me smiles

Glad it was as simple as that. :)

 

* 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: 426
  • 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