Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » BrenBot Refund Command (For people that use BrenBot still.)
BrenBot Refund Command [message #471581] Fri, 13 July 2012 09:51 Go to next message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma: 0
Colonel

I decided to fix the !refund command on BrenBot, it now will give the player the credits instead of just saying it did.

I also added !defund so you can take a players credits.

EDIT: Also fixed the double was typo ;p

Requirements
BrenBot: Of course
ExtraConsoleCommands Plugin: The Commands use GiveCredits and TakeCredits, only available with the plugin.

All I did was edit the pm and xml files to the following.

!refund
sub refund
{
	my ( $kernel, $session, $heap, $args ) = @_[ KERNEL, SESSION, HEAP, ARG0 ];
	my %args = %{$args};

	if ($args{arg1} && $args{arg2}  && ($args{arg2} =~ m/^(-?\d+)$/ ))
	{
	my ( $result, %player ) = playerData::getPlayerData( $args{'arg1'} );
	if ( $result == 1 )
	{
        my $amount = $args{arg2};

	plugin::RenRemCMD ( "GiveCredits $player{id} $amount" );
        plugin::RenRemCMD("ppage $player{id}  you have been giving $amount credits by $args{nick}.");
        plugin::ircmsg ( " $player{name} was refunded $amount credits by $args{nick}", A);
	}
        else {
        doMsg("Error: $args{arg1} was not found ingame, or is not unique",$args{nicktype}, "A");
        }
       }
       else
       {
        doMsg("Syntax: !refund <player> <amount>",$args{nicktype}, "A");
   }
}

!defund
sub defund
{
	my ( $kernel, $session, $heap, $args ) = @_[ KERNEL, SESSION, HEAP, ARG0 ];
	my %args = %{$args};

	if ($args{arg1} && $args{arg2}  && ($args{arg2} =~ m/^(-?\d+)$/ ))
	{
	my ( $result, %player ) = playerData::getPlayerData( $args{'arg1'} );
	if ( $result == 1 )
	{
        my $amount = $args{arg2};

	plugin::RenRemCMD ( "TakeCredits $player{id} $amount" );
        plugin::RenRemCMD("ppage $player{id}  $args{nick} has taken $amount credits from you.");
        plugin::ircmsg ( " $player{name} was defunded $amount credits by $args{nick}", A);
	}
        else {
        doMsg("Error: $args{arg1} was not found ingame, or is not unique",$args{nicktype}, "A");
        }
       }
       else
       {
        doMsg("Syntax: !defund <player> <amount>",$args{nicktype}, "A");
   }
}
  • Attachment: BRenBot.pm
    (Size: 6.97KB, Downloaded 102 times)
  • Attachment: BRenBot.xml
    (Size: 2.41KB, Downloaded 89 times)


Live Your Life Not Some one Else's.| Sharing Is Caring

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide

[Updated on: Fri, 13 July 2012 09:57]

Report message to a moderator

Re: BrenBot Refund Command [message #471582 is a reply to message #471581] Fri, 13 July 2012 09:58 Go to previous messageGo to next message
zunnie is currently offline  zunnie
Messages: 2959
Registered: September 2003
Location: Netherlands
Karma: 0
General (2 Stars)

Nice Smile

https://multiplayerforums.com/uploads/monthly_2018_03/TCW2_Signature.png.6236a0dbc6e1e53472a18fe8cd15e47b.png
Re: BrenBot Refund Command [message #471586 is a reply to message #471581] Fri, 13 July 2012 10:24 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

Cool, but the regular expression from:

if ($args{arg1} && $args{arg2}  && ($args{arg2} =~ m/^(-?\d+)$/ ))


still accepts a negative number in both commands, even though neither uses them. it'll probably just get really confused, actually.


-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

Re: BrenBot Refund Command [message #471594 is a reply to message #471586] Fri, 13 July 2012 11:03 Go to previous message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma: 0
Colonel

Ethenal wrote on Fri, 13 July 2012 12:24

Cool, but the regular expression from:

if ($args{arg1} && $args{arg2}  && ($args{arg2} =~ m/^(-?\d+)$/ ))


still accepts a negative number in both commands, even though neither uses them. it'll probably just get really confused, actually.


I see what your saying.

That you will have to ask danpual why he or whom ever made the pm file, why ;p


Live Your Life Not Some one Else's.| Sharing Is Caring

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
Previous Topic: [SSGM 4.0 Plugin] Beacon Mute
Next Topic: [SSGM 4.0 Plugin] Range and RoF Cheat Detection
Goto Forum:
  


Current Time: Wed Nov 27 19:41:35 MST 2024

Total time taken to generate the page: 0.00582 seconds