I thought it was a good idea so I made one
sub pagemods
{
my ( $session, $heap, $args ) = @_[ SESSION, HEAP, ARG0 ];
my $kernel = $_[KERNEL];
my %args = %{$args};
#if ( $args{arg1} )
if ( $args{arg} =~ m/^\!\S+\s(.+)$/i )
{
my $msg = $1;
my $name = "";
my $string = "";
my $players_gdi = serverStatus::getPlayers_GDI();
my $players_nod = serverStatus::getPlayers_Nod();
my $maxplayers = $players_nod + $players_gdi;
my $msglength = length($msg);
if ( $msglength > 248 ) { sendmsg("Your Message is too long.", $args{nicktype}, "A", $args{nick} ); return; }
elsif ($maxplayers < 1) { sendmsg("No players in Game", $args{nicktype}, "A", $args{nick} ); return; }
else
{
my %playerlist = playerData::getPlayerList();
while ( my ( $id, $player ) = each ( %playerlist ) )
{
if ((modules::IsHalfMod($player->{'name'}) || modules::IsFullMod($player->{'name'}) || modules::IsAdmin($player->{'name'}) ))
{
modules::pagePlayer ( $player->{'id'}, "Admin", "$msg" );
$name = "$player->{'name'} ";
$string = $string . $name;
}
}
my $stringl = length($string);
if ($stringl < 1) { sendmsg("No Mods ingame", $args{nicktype}, "A", $args{nick} ); return;}
else { sendmsg("Mods $string have been paged", $args{nicktype}, "A", $args{nick} ); }
}
}
else { sendmsg("Syntax !pagemods <msg>", $args{nicktype}, "A", $args{nick} ); }
}
sub sendmsg
{
my ( $msg, $nicktype, $chantype, $username ) = @_;
if ($nicktype == 1)
{
plugin::ircmsg ($msg, $chantype );
}
else
{
my ( $result, %player ) = playerData::getPlayerData( $username );
if ( $result == 1 )
{
modules::pagePlayer ( $player{'id'}, "Brenbot", "$msg." );
}
}
}
[Updated on: Sun, 24 October 2010 21:30]
Report message to a moderator