BrenBot Refund Command [message #471581] |
Fri, 13 July 2012 09:51 |
|
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
Cookie Jar<glome> Who stole the cookie from the cookie jar?!
<content> glome stole the cookie from the cookie jar!
<glome> Who me?!
<content> Yes you!
<glome> Couldn't be!
<content> Then WHO?!!
<glome> Woody stole the cookie from the cookie jar!
*** glome has been kicked by DrWoody (fuck you i didn't touch the motherfucking cookie, bitch
Suicide<TB> I was depressed last night so I called the Suicide Life Line.
<TB> I reached a call center in Pakistan.
<TB> I told them I was suicidal.
<TB> They got all excited and asked if I could drive a truck
[Updated on: Fri, 13 July 2012 09:57] Report message to a moderator
|
|
|
|
|
Re: BrenBot Refund Command [message #471594 is a reply to message #471586] |
Fri, 13 July 2012 11:03 |
|
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
Cookie Jar<glome> Who stole the cookie from the cookie jar?!
<content> glome stole the cookie from the cookie jar!
<glome> Who me?!
<content> Yes you!
<glome> Couldn't be!
<content> Then WHO?!!
<glome> Woody stole the cookie from the cookie jar!
*** glome has been kicked by DrWoody (fuck you i didn't touch the motherfucking cookie, bitch
Suicide<TB> I was depressed last night so I called the Suicide Life Line.
<TB> I reached a call center in Pakistan.
<TB> I told them I was suicidal.
<TB> They got all excited and asked if I could drive a truck
|
|
|