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: KOS Module w/ Guild KOS  (Read 26249 times)

0 Members and 1 Guest are viewing this topic.

Offline Getrix

  • Contributor
  • *******
  • Posts: 509
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #30 on: December 20, 2009, 12:32:53 pm »
Do as it the message say, learn how to use the command :P

Quote
kos gadd <guildname> : <reason> - Add Guild to Kill on Sight list with reason.  You need to add the : between the guild name and reason.  This is due to spacing in the guild names and the only workaround I know.
Success is not final, failure is not fatal: it is the courage to continue that counts.
- Sorry, i dont have time to reply question on PM. Make a topic.

Offline Space

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #31 on: April 08, 2010, 02:15:26 pm »
1st of all thank you for all the time you spend on this ...

I installed everything as said in previous post, and i can see the KOS.php load without errors.
i also used the !commands subs kos, which works also , i can change buy presing the ABRIVIATIONS A, L,M etz...

BUT still get YOUR ACCES LVL HAS TO BE...

I am the owner, no matter what i chooses in the commands subs kos...
Member, Admin, Superadmin, OWNER...

I get always when trying to add YOUR ACCES LVL MUST BE.....

Anybody any clue what iam doing wrong!


Offline freakyfreak

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #32 on: June 04, 2010, 10:04:42 am »
Hi Guys,

This is my first Try to mod something.
All works fine except the Kos List.
It only shows the Friendly Guilds and Members.

Here is the Code.
Code: [Select]
<?

$kos = new Kos($bot);

class Kos Extends BaseActiveModule
{
var $bot;
var $pkos_list;
var $gkos_list;


function __construct (&$bot)
{
parent::__construct(&$bot, get_class($this));

$this -> register_command("all", "kos", "MEMBER", array('padd' => 'MEMBER', 'gadd' => 'MEMBER', 'pdel' => 'MEMBER', 'gdel' => 'MEMBER'));

$this -> help['description'] = 'Kill On Sight/n created by Kardsen US-Bane';
$this -> help['command']['kos'] = "- Display Kill on Sight list.";
$this -> help['command']['kos padd <playername> <reason>'] = "- Add name to Kill on Sight list with reason.";
$this -> help['command']['kos gadd <guildname> : <reason>'] = "- Add Guild to Kill on Sight list with reason.  You need to add the : between the guild name and reason.  This is due to spacing in the guild names and the only workaround I know.";
$this -> help['command']['kos fpadd <playername> <reason>'] = "- Add name to Guild Friend List with reason.";
$this -> help['command']['kos fgadd <guildname> : <reason>'] = "- Add Guild to Guild Friend List with reason.  You need to add the : between the guild name and reason.  This is due to spacing in the guild names and the only workaround I know.";
$this -> help['command']['kos pdel name'] = "- Remove Player from Kill on Sight list.";
$this -> help['command']['kos gdel guild'] = "- Remove Guild from Kill on Sight list.";
$this -> help['command']['kos fpdel name'] = "- Remove Player from Guild Friend List.";
$this -> help['command']['kos fgdel guild'] = "- Remove Guild from Guild Friend List.";

$this -> bot -> db -> query("CREATE TABLE IF NOT EXISTS `koslist` (
`id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
`player` VARCHAR( 100 ) NOT NULL ,
`addedby` VARCHAR( 100 ) NOT NULL ,
`reason` VARCHAR( 255 ) NULL ,
`type` VARCHAR ( 100 ) NOT NULL,
PRIMARY KEY ( `id` )
);"
);
$this -> load_pkos();
$this -> load_gkos();
$this -> load_fpkos();
$this -> load_fgkos();

}

function command_handler($name, $msg, $origin)
{
if (preg_match("/^kos$/i", $msg))
                        return $this -> show_kos();
                else if (preg_match("/^kos pdel (.*)$/i", $msg, $info))
                        return $this -> delete_pkos($info[1]);
else if (preg_match("/^kos gdel (.*)$/i", $msg, $info))
                        return $this -> delete_gkos($info[1]);
                else if (preg_match("/^kos fpdel (.*)$/i", $msg, $info))
                        return $this -> delete_fpkos($info[1]);
else if (preg_match("/^kos fgdel (.*)$/i", $msg, $info))
                        return $this -> delete_fgkos($info[1]);
                else if (preg_match("/^kos padd (([0-9]|[a-z]|[A-Z])+)(.*)$/i", $msg, $info))
                        return $this -> add_pkos($name, $info[1], $info[3]);
                else if (preg_match("/^kos gadd (([0-9]|[a-z]|[A-Z]| )+):(.*)$/i", $msg, $info))
                        return $this -> add_gkos($name, $info[1], $info[3]);
                else if (preg_match("/^kos fpadd (([0-9]|[a-z]|[A-Z])+)(.*)$/i", $msg, $info))
                        return $this -> add_fpkos($name, $info[1], $info[3]);
                else if (preg_match("/^kos fgadd (([0-9]|[a-z]|[A-Z]| )+):(.*)$/i", $msg, $info))
                        return $this -> add_fgkos($name, $info[1], $info[3]);
else    return "Learn how to use the command. See !help kos";

}

function show_kos()
{
if (empty($this -> pkos_list))
{
if (empty($this -> gkos_list))
{
return "KoS is empty.";
}
}



$blob = "<font color='SILVER' face='hyborianlarge'>:: Kill on Sight Guilds ::</font>\n";
foreach ($this -> gkos_list AS $gkos)
{
$guild = ucfirst($gkos['guild']);
empty($gkos['reason']) ? $reason = "none" : $reason = $gkos['reason'];
$blob .= "\n<font color='#FF0000'>$guild</font>   (reason $reason)\n";

}

$blob .= "\n\n<font color='SILVER' face='hyborianlarge'>:: Kill on Sight Players ::</font>\n";
foreach ($this -> pkos_list AS $pkos)
{
$player = ucfirst($pkos['player']);
$whois = "<a href='chatcmd:///tell <botname> !whois $player'>whois</a>";
$online = "<a href='chatcmd:///tell <botname> !is $player'>online?</a>";
$blob .= "\n<font color='#FF0000'>$player</font>    ($whois)  ($online)";
empty($pkos['reason']) ? $reason = "none" : $reason = $pkos['reason'];
$blob .= "\n    --(reason: $reason)\n";
}

$blob = "\n\n\n<font color='SILVER' face='hyborianlarge'>:: Friendly Guilds ::</font>\n";
foreach ($this -> fgkos_list AS $fgkos)
{
$guild = ucfirst($fgkos['fguild']);
empty($fgkos['reason']) ? $reason = "none" : $reason = $fgkos['reason'];
$blob .= "\n<font color='#FF0000'>$guild</font>   (reason $reason)\n";

}

$blob .= "\n\n\n\n<font color='SILVER' face='hyborianlarge'>:: Friendly Players ::</font>\n";
foreach ($this -> fpkos_list AS $fpkos)
{
$player = ucfirst($pkos['fplayer']);
$whois = "<a href='chatcmd:///tell <botname> !whois $player'>whois</a>";
$online = "<a href='chatcmd:///tell <botname> !is $player'>online?</a>";
$blob .= "\n<font color='#FF0000'>$player</font>    ($whois)  ($online)";
empty($fpkos['reason']) ? $reason = "none" : $reason = $fpkos['reason'];
$blob .= "\n    --(reason: $reason)\n";
}

return "Kill on Sight :: " . $this -> bot -> core("tools") -> make_blob("click to view", $blob);
}

function add_pkos($name, $player, $reason)
{
$player = strtolower($player);
$id = $this -> bot -> aoc -> get_uid($player);
if (empty($id))
{
return "Player " . ucfirst($player) . " does not exist.";
}
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$player' AND type = 'playerkos'");
if (!empty($result))
{
return ucfirst($player) . " is already on Kill on Sight.";
}
$reason = trim($reason);
$this -> bot -> db -> query("INSERT INTO koslist (player, addedby, reason, type) VALUES ('$player', '$name', '$reason', 'playerkos')");
$this -> load_pkos();
return ucfirst($player) . " was added to Kill on Sight.";
}

function add_gkos($name, $guild, $reason)
{
$guild = strtolower($guild);
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$guild' AND type = 'guildkos'");
if (!empty($result))
{
return ucfirst($guild) . " is already on Guild Kill list.";
}
$reason = trim($reason);
$this -> bot -> db -> query("INSERT INTO koslist (player, addedby, reason, type) VALUES ('$guild', '$name', '$reason', 'guildkos')");
$this -> load_gkos();
return ucfirst($guild) . " was added to Kill on Sight.";
}

function add_fpkos($name, $player, $reason)
{
$player = strtolower($player);
$id = $this -> bot -> aoc -> get_uid($player);
if (empty($id))
{
return "Player " . ucfirst($player) . " does not exist.";
}
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$player' AND type = 'fplayerkos'");
if (!empty($result))
{
return ucfirst($player) . " is already on Kill on Sight.";
}
$reason = trim($reason);
$this -> bot -> db -> query("INSERT INTO koslist (player, addedby, reason, type) VALUES ('$player', '$name', '$reason', 'fplayerkos')");
$this -> load_fpkos();
return ucfirst($player) . " was added to Kill on Sight.";
}

function add_fgkos($name, $guild, $reason)
{
$guild = strtolower($guild);
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$guild' AND type = 'fguildkos'");
if (!empty($result))
{
return ucfirst($guild) . " is already on Guild Kill list.";
}
$reason = trim($reason);
$this -> bot -> db -> query("INSERT INTO koslist (player, addedby, reason, type) VALUES ('$guild', '$name', '$reason', 'fguildkos')");
$this -> load_fgkos();
return ucfirst($guild) . " was added to Kill on Sight.";
}

function delete_pkos($player)
{
$player = strtolower($player);
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$player' AND type = 'playerkos'");
if (empty($result))
{
return ucfirst($player) . " is not on Kill on Sight.";
}
$this -> bot -> db -> query("DELETE FROM koslist WHERE player = '$player' AND type = 'playerkos'");
$this -> load_pkos();
return ucfirst($player) . " was removed from Kill on Sight.";
}

function delete_gkos($guild)
{
$guild = strtolower($guild);
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$guild' AND type = 'guildkos'");
if (empty($result))
{
return ucfirst($guild) . " is not on Kill on Sight.";
}
$this -> bot -> db -> query("DELETE FROM koslist WHERE player = '$guild' AND type = 'guildkos'");
$this -> load_gkos();
return ucfirst($guild) . " was removed from Kill on Sight.";
}

function delete_fpkos($player)
{
$player = strtolower($player);
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$player' AND type = 'fplayerkos'");
if (empty($result))
{
return ucfirst($player) . " is not on Kill on Sight.";
}
$this -> bot -> db -> query("DELETE FROM koslist WHERE player = '$player' AND type = 'fplayerkos'");
$this -> load_fpkos();
return ucfirst($player) . " was removed from Kill on Sight.";
}

function delete_fgkos($guild)
{
$guild = strtolower($guild);
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE player = '$guild' AND type = 'fguildkos'");
if (empty($result))
{
return ucfirst($guild) . " is not on Kill on Sight.";
}
$this -> bot -> db -> query("DELETE FROM koslist WHERE player = '$guild' AND type = 'fguildkos'");
$this -> load_fgkos();
return ucfirst($guild) . " was removed from Kill on Sight.";
}
function load_pkos()
{
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE type = 'playerkos' ORDER BY player ASC");
if (!empty($result))
{
$a = array();
foreach ($result AS $row)
{
$a[] = array('player' => $row[1], 'addedby' => $row[2], 'reason' => $row[3], 'type' => $row[4]);
}
$this -> pkos_list = $a;
}
else
{
$this -> pkos_list = array();
}
}

function load_gkos()
{
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE type = 'guildkos' ORDER BY player ASC");
if (!empty($result))
{
$b = array();
foreach ($result AS $row)
{
$b[] = array('guild' => $row[1], 'addedby' => $row[2], 'reason' => $row[3], 'type' => $row[4]);
}
$this -> gkos_list = $b;
}
else
{
$this -> gkos_list = array();
}
}

function load_fpkos()
{
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE type = 'fplayerkos' ORDER BY player ASC");
if (!empty($result))
{
$a = array();
foreach ($result AS $row)
{
$a[] = array('player' => $row[1], 'addedby' => $row[2], 'reason' => $row[3], 'type' => $row[4]);
}
$this -> fpkos_list = $a;
}
else
{
$this -> fpkos_list = array();
}
}

function load_fgkos()
{
$result = $this -> bot -> db -> select("SELECT * FROM koslist WHERE type = 'fguildkos' ORDER BY player ASC");
if (!empty($result))
{
$b = array();
foreach ($result AS $row)
{
$b[] = array('guild' => $row[1], 'addedby' => $row[2], 'reason' => $row[3], 'type' => $row[4]);
}
$this -> fgkos_list = $b;
}
else
{
$this -> fgkos_list = array();
}
}
}
?>

maybe someone can help me.

And there is a little bug in the Whois file.
with the #___ u set it the Botname.koslist, but in the header u set the DB only to koslist.

Old part
Code: [Select]
$blname = $this -> bot -> db -> select("SELECT player FROM #___koslist WHERE player = '". $name . "'");
New part
Code: [Select]
$blname = $this -> bot -> db -> select("SELECT player FROM koslist WHERE player = '". $name . "'");

Offline freakyfreak

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Re: KOS Module w/ Guild KOS
« Reply #33 on: August 10, 2010, 06:49:52 pm »
Push :D

 

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