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: Kill on Sight  (Read 5265 times)

0 Members and 1 Guest are viewing this topic.

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Kill on Sight
« on: December 14, 2005, 06:54:57 am »
This lets you keep a KoS list

!kos
!kos <player> (<reason>)
!kos del <player>


modules/Kos.php

Code: [Select]
<?
$kos = new Kos($bot);

$db -> query("CREATE TABLE IF NOT EXISTS `kos` (
`id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
`player` VARCHAR( 100 ) NOT NULL ,
`addedby` VARCHAR( 100 ) NOT NULL ,
`reason` VARCHAR( 255 ) NULL ,
PRIMARY KEY ( `id` )
);");

$commands["tell"]["kos"] = &$kos;
$commands["pgmsg"]["kos"] = &$kos;
$commands["gc"]["kos"] = &$kos;


class Kos
{
var $bot;
var $kos_list;


function Kos (&$bot)
{
$this -> bot = &$bot;
$this -> load_kos();
}

function tell($name, $msg)
{
$this -> bot -> send_tell($name, $this -> process_command($name, $msg));
}

function pgmsg($name, $msg)
{
$this -> bot -> send_pgroup($this -> process_command($name, $msg));
}

function gc($name, $msg)
{
$this -> bot -> send_gc($this -> process_command($name, $msg));
}

function process_command($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "kos$/i", $msg))
return $this -> show_kos();
if ($this -> bot -> admin -> in_group($name, "admin") || $this -> bot -> admin -> in_group($name, "superadmin"))
{
if (preg_match("/^" . $this -> bot -> commpre . "kos del (.*)$/i", $msg, $info))
return $this -> delete_kos($info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "kos (([0-9]|[a-z]|[A-Z])+)(.*)$/i", $msg, $info))
return $this -> add_kos($name, $info[1], $info[3]);
}
else
{
return "/tell <botname> <pre>help";
}
}

function show_kos()
{
if (empty($this -> kos_list))
{
return "KoS is empty.";
}
$blob = "<font color=CCInfoHeader>::::: Kill on Sight :::::\n";
foreach ($this -> kos_list AS $kos)
{
$player = ucfirst($kos['player']);
$whois = "<a href='chatcmd:///tell helpbot whois $player'>whois</a>";
$online = "<a href='chatcmd:///tell <botname> !is $player'>online?</a>";
$blob .= "\n$player    ($whois)  ($online)";
empty($kos['reason']) ? $reason = "none" : $reason = $kos['reason'];
$blob .= "\n    (reason: $reason)\n";
}
return "Kill on Sight :: " . $this -> bot -> make_blob("click to view", $blob);
}

function add_kos($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 kos WHERE player = '$player'");
if (!empty($result))
{
return ucfirst($player) . " is already on Kill on Sight.";
}
$reason = trim($reason);
$this -> bot -> db -> query("INSERT INTO kos (player, addedby, reason) VALUES ('$player', '$name', '$reason')");
$this -> load_kos();
return ucfirst($player) . " was added to Kill on Sight.";
}

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

function load_kos()
{
$result = $this -> bot -> db -> select("SELECT * FROM kos");
if (!empty($result))
{
$a = array();
foreach ($result AS $row)
{
$a[] = array('player' => $row[1], 'addedby' => $row[2], 'reason' => $row[3]);
}
$this -> kos_list = $a;
}
else
{
$this -> kos_list = array();
}
}
}
?>


help/kos.txt

Code: [Select]
<font color=CCInfoHeader><pre>kos</font>
<font color=CCInfoText>Shows the "Kill on Sight" list.

<font color=CCInfoHeader><pre>kos &lt;player&gt; (&lt;reason&gt;)</font>
Adds someone to KoS, reason is optional.

<font color=CCInfoHeader><pre>kos del &lt;player&gt;</font>
Removes someone from KoS.</font>
« Last Edit: December 14, 2005, 07:08:41 am by Wanuarmi »

Offline Zweiblum

  • BeBot Apprentice
  • ***
  • Posts: 135
  • Karma: +0/-0
Re: Kill on Sight
« Reply #1 on: July 27, 2008, 05:39:36 pm »
anychance to get that baby on bebot 0.5.2 ?
cant find anything with search

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Kill on Sight
« Reply #2 on: July 27, 2008, 06:57:10 pm »
Try out the AoC KOS module, might work - there aren't that many structural changes between the versions.

http://bebot.link/aoc-modules/kos-module-w-guild-kos/

 

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