ok trying to remove ppl from rolls when they leave the bot was trying with this.
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"
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:
$this -> commands["pgleave"][$key] -> pgleave($user);
I was playing around trying with
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?