Home » Renegade Discussions » Mod Forum » brenbot plugin needed
Re: brenbot plugin needed [message #419013 is a reply to message #418863] |
Mon, 01 February 2010 13:57 |
|
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma:
|
General (5 Stars) |
|
|
Well I am pretty busy with stuff at the moment but after reading this I decided it should be pretty easy to do... simply override the built in auth-command with a plugin one, call the built-in command from the plugin command and then check that the auth was successful.
NOTE: This code is untested as I simply don't have the time right now, I just threw it together in 5 minutes to show how it can be done. It might or might not work as intended.
Oh, just an FYI, the issue with temp mods leaving the game and still being temped when rejoining was fixed several versions ago, in an internal beta prior to 1.50 if I remember correctly.
EDIT: And, before anyone asks, the plugin will only call the attach console command for successful authentications on Admins, Full Mods, Half Mods and Temp Mods, all other successful authentications will NOT trigger the console command.
For anyone interested in the relevant code without downloading the zip file;
Toggle Spoiler# Function for !auth command
sub auth
{
my %args = %{$_[ ARG0 ]};
# Is the player already authed?
my ( $result, %player ) = plugin::getPlayerData($args{'nick'});
if ( $result == 1 && (!defined($player{'isAuthed'}) || $player{'isAuthed'} != 1) )
{
# Call the real auth command
commands::auth(@_);
# Are they now authed?
( $result, %player ) = plugin::getPlayerData($args{'nick'});
if ( $result == 1 && defined($player{'isAuthed'}) && $player{'isAuthed'} == 1 )
{
# Is the player some type of moderator?
if ( plugin::isAdmin($player{'id'}) || plugin::isFullMod($player{'id'}) || plugin::isHalfMod($player{'id'}) || plugin::isTempMod($player{'id'}) )
{
# Attach script
plugin::RenRemCMD('attach $player{id} auth_script');
}
}
}
}
In addition to the code for the overridden command you will also need to copy the command declaration from the commands.xml file into the plugins XML file (otherwise the bot won't know your new command exists), add the command event to the plugins events list in the XML and handle the command event in the plugin code in the usual way.
Because plugin commands are looked for first any command in a plugin matching the name of a built in command will override the built in command.
EDIT 2: See 2 posts down for download, fixed a bug. Note that the code in the spoiler above has been updated to the correct version as attached to the post below.
[Updated on: Mon, 01 February 2010 14:20] Report message to a moderator
|
|
|
|
|
brenbot plugin needed
By: reborn on Sat, 30 January 2010 07:41
|
|
|
Re: brenbot plugin needed
By: reborn on Sat, 30 January 2010 11:17
|
|
|
Re: brenbot plugin needed
By: Hex on Sat, 30 January 2010 11:48
|
|
|
Re: brenbot plugin needed
By: reborn on Sat, 30 January 2010 18:52
|
|
|
Re: brenbot plugin needed
|
|
|
Re: brenbot plugin needed
By: reborn on Sun, 31 January 2010 03:11
|
|
|
Re: brenbot plugin needed
By: Hex on Sun, 31 January 2010 05:21
|
|
|
Re: brenbot plugin needed
By: reborn on Sun, 31 January 2010 06:17
|
|
|
Re: brenbot plugin needed
By: Hex on Sun, 31 January 2010 06:44
|
|
|
Re: brenbot plugin needed
By: reborn on Sun, 31 January 2010 07:20
|
|
|
Re: brenbot plugin needed
By: raven on Mon, 01 February 2010 04:37
|
|
|
Re: brenbot plugin needed
By: reborn on Mon, 01 February 2010 04:43
|
|
|
Re: brenbot plugin needed
|
|
|
Re: brenbot plugin needed
By: reborn on Mon, 01 February 2010 14:06
|
|
|
Re: brenbot plugin needed
|
|
|
Re: brenbot plugin needed
|
|
|
Re: brenbot plugin needed
|
|
|
Re: brenbot plugin needed
By: reborn on Tue, 02 February 2010 00:57
|
|
|
Re: brenbot plugin needed
|
|
|
Re: brenbot plugin needed
By: reborn on Thu, 04 February 2010 23:43
|
|
|
Re: brenbot plugin needed
By: reborn on Tue, 09 February 2010 03:38
|
|
|
Re: brenbot plugin needed
|
Goto Forum:
Current Time: Fri Dec 27 20:01:45 MST 2024
Total time taken to generate the page: 0.00998 seconds
|