Code: Select all
########################################
# deathAlert -- Notice u'r bot death!
# This is a modification of AlertSound plugins made by
#
# ©2007 by Contrad
#
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#
# How to install :
# Just paste to PLUGINS folder inside OPENKORE root folder.
#
# How to use :
# <config.txt>
# beepOnDeath (num) Beep when death until (num) times.
#
# Anyway I use 'Bahasa' instead of 'English' to promote INDONESIA. :D
# U'r free to translate it.
package deathAlert;
use strict;
use Plugins;
use Globals;
use Utils;
use Log qw(message);
use Network::Send;
use Utils;
Plugins::register('deathAlert', 'bip 2 kali kalo mati', \&Unload);
my $packetHook = Plugins::addHook('parseMsg/pre', \&CheckPacket);
sub Unload {
Plugins::delHook('parseMsg/pre', $packetHook);
}
sub CheckPacket {
return if (!$config{'beepOnDeath'});
my $hookName = shift;
my $args = shift;
my $switch = $args->{switch};
my $msg = $args->{msg};
if ($switch eq "0080") {
# someone disappeared here
my $ID = substr($msg, 2, 4);
if ($ID eq $accountID) {
# You are dead.
for (1..$config{'beepOnDeath'}) {$interface->beep();}
}
}
}
1;