Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » BrenBot help.
BrenBot help. [message #438259] Sun, 24 October 2010 10:41 Go to next message
crysis992 is currently offline  crysis992
Messages: 314
Registered: June 2008
Karma: 0
Recruit

Hello, i need a bit help with BrenBot.
I want a !mpage command, that command should page all authed moderators on the modlist. But how I do this?
Re: BrenBot help. [message #438274 is a reply to message #438259] Sun, 24 October 2010 15:32 Go to previous messageGo to next message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
You have to learn Perl to build a brenbot plugin orr kiss-ass enough to have someone build it for you.

http://img339.imageshack.us/img339/1991/nefobbygenyunoreleasere.jpg
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
Re: BrenBot help. [message #438283 is a reply to message #438259] Sun, 24 October 2010 20:25 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
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." );
		}
	}
}


http://s18.postimage.org/jc6qbn4k9/bricks3.png

[Updated on: Sun, 24 October 2010 21:30]

Report message to a moderator

Re: BrenBot help. [message #438284 is a reply to message #438259] Sun, 24 October 2010 22:34 Go to previous messageGo to next message
crysis992 is currently offline  crysis992
Messages: 314
Registered: June 2008
Karma: 0
Recruit

Thank you Blacky =)
Re: BrenBot help. [message #438287 is a reply to message #438259] Mon, 25 October 2010 04:43 Go to previous message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Why are you adding up the number of GDI and Nod players instead of just getting the player list (which you do a few lines later) and checking how many items are in it? Rocked Over


EDIT: And, for reference, you shouldn't ever be accessing ServerStatus, PlayerData or modules directly, they are NOT part of the plugin interface and any plugins using them may break in future versions of BRenBot. You should use plugin::getPlayerList to get the player list and plugin::pagePlayer to page a player. All of the functionality you have used should be available through the plugin interface, if it is not you should request that it is added so you can create future-proof plugins.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Mon, 25 October 2010 04:45]

Report message to a moderator

Previous Topic: Good Huds
Next Topic: Visual Studio 2010 SSGM202+Scripts344 Projects
Goto Forum:
  


Current Time: Fri Nov 15 12:11:25 MST 2024

Total time taken to generate the page: 0.00929 seconds