Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » brenbot plugin needed
brenbot plugin needed [message #418863] Sat, 30 January 2010 07:41 Go to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I've recently released a plugin that allows for additional console commands. One of those console commands is the ability to attach scripts. See here for more details.

I am hoping someone is willing to write a very small plug-in for brenbot (or some other bot) that makes the bot send the following console command when the moderator !auth's themselves (or is authenticated as a mod in anyway from the bot):
attach <playerid> auth_script

If you do this in a timely manor, then it will allow me to write another plugin that relies on both the br plugin and the console command plugin I just released, but when used in conjunction with these will allow for proper in-game moderator authentification when using in-game mod chat hooks and the like...

All I need is for something to write this very small br plugin, and then when people write there mod commands, such as:
!kill, !setnextmap, !teleport, !spec etc etc
it will no longer have to use the nick name conditional check.

I believe the only publicly made check was one that checked that the players name was in the mod list text file. Meaning people could easily spoof the nick name and use mod commands.
This system would eliminate that and use the bots authentification system to properly enforce in-game mod commands.

Unfortunately I have never really looked at the regulators source code, nor have I ever used the languages they are written in. So if someone finds this interesting or would like to see it happen, then I will need someone to write the bot part.



Re: brenbot plugin needed [message #418878 is a reply to message #418863] Sat, 30 January 2010 11:17 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I've just finished writing the auth system plug-in, and added a few moderator commands (!kill <playername>, !spec/!spec <playername>, !forceteamchange <playername>, !setnextmap and some other stuff).
This plugin would be a good basis for others to use where they need a conditional to check if a player is an authenticated mod or not before the command is executed. However, I now need someone to write the regulator plugin for it. There's little point this being released otherwise.
It certainly opens the door for safe to use in-game mod commands. Relying on the nick names only is un-safe.



Re: brenbot plugin needed [message #418879 is a reply to message #418863] Sat, 30 January 2010 11:48 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
BrenBot has those commands already and a force auth option

goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: brenbot plugin needed [message #418896 is a reply to message #418863] Sat, 30 January 2010 18:52 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
What do you mean? Brenbot already has the option to attach a script to a player when they !auth?


Re: brenbot plugin needed [message #418928 is a reply to message #418863] Sun, 31 January 2010 03:00 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Yea brenbot has the option to force auth people. so people have to use the !auth in irc or a couple of other ways. You would just have to make a simple brenbot plugin to use the console commands. example here is the main part of a spectate plugin that uses a console command.

sub spectate
{
	my %args = %{@_[ ARG0 ]};

	if ( !$args{arg1} )
	{
		my $syntaxvalue = $args{settings}->{syntax}->{value};
		$message = "Usage: $syntaxvalue";
		return;
	}

	my ( $result, %player ) = plugin::getPlayerData( $args{'arg1'} );
	if ( $result == 1 )
	{
		# Player found, spectate them
		plugin::RenRemCMD("r_spec $player{id}"); #console command
		plugin::ircmsg ("10[Spectate] Player $player{name} is now in spectate mode.",'A');
	}
	else
	{
		if ( $args{nicktype} == 1 ) { plugin::ircmsg ( "Player $args{arg1} not found ingame", $args{'ircChannelCode'} ); }
		else { plugin::pagePlayer ( $args{'nick'}, "Player $args{arg1} not found ingame" ); }
	}
}


if you where going to use your console command plugin that uses the txt file it would work differently. You have to make the plugin make and print into a file when a mod uses a comamnd.

open (ConsoleCommand, '>>C:\Westwood\RenegadeFDS\Server\ConsoleCommand.txt');
print ConsoleCommand "command flymode ObjectID\n";
close (ConsoleCommand);


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

[Updated on: Sun, 31 January 2010 03:07]

Report message to a moderator

Re: brenbot plugin needed [message #418929 is a reply to message #418863] Sun, 31 January 2010 03:11 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
This is not opening a text file, it is directly sending a console command to the FDS.
If you can make the br plugin, that would be excellent. Smile



Re: brenbot plugin needed [message #418933 is a reply to message #418863] Sun, 31 January 2010 05:21 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
Why would you want to attach a 'auth script' to a mod?

All commands can be set by player status


goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: brenbot plugin needed [message #418937 is a reply to message #418863] Sun, 31 January 2010 06:17 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
The auth_script adds their playerID to a vector, this makes it possible to check whether or not the player is in that vector when they use a chat command. For example:


bool AuthCheck(int ID) {
		for (unsigned int i = 0; i < AuthedPlayers.size(); i++) {
			if (AuthedPlayers[i].AuthedPlayerName == Get_Player_Name_By_ID(ID)) {
				return true;
			}
		}
	return false;
}



class setmapChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		if(AuthCheck(ID) != false){
			if (!Text[1].empty()) {
				int number = 0;
				std::string mapname2 = Text[1].c_str();
				int numberofmaps = 0;
				for(;*The_Game()->MapList[numberofmaps] != 0; numberofmaps++);
				int z = 0;
				for (int i = 0; i < numberofmaps; i++) {
					if ((stristr(The_Game()->MapList[i],mapname2.c_str()))){
						number++;
						z = i;
					}
				}
				if (number == 1){
					The_Game()->MapNumber = z-1;
					mapname = The_Game()->MapList[z];
					mapnameannounce();
					Console_Input(StrFormat("msg Moderator %s has changed the next map!",Get_Player_Name_By_ID(ID)).c_str());
				}
				else if(number < 1){
					Console_Input(StrFormat("ppage %d Nothing was found at all, are you sure that map is even in rotation?",ID).c_str());
				}
				else if(number > 1){
					for (int i = 0; i < numberofmaps; i++) {
						if ((strcmp(The_Game()->MapList[i],mapname2.c_str()))==0) {
							The_Game()->MapNumber = i-1;
							mapname = The_Game()->MapList[i];
							mapnameannounce();
							Console_Input(StrFormat("msg Moderator %s has changed the next map!",Get_Player_Name_By_ID(ID)).c_str());
							break;
						}
					}
				}
			}
		}
		else {
			Console_Input(StrFormat("ppage %d You're not a mod, you need to authenticate to use this command.",ID).c_str());
		}
	}
};
ChatCommandRegistrant<setmapChatCommand> setmapChatCommandReg("!setnextmap;!SETNEXTMAP;!Setnextmap;!SetNextMap;!snm;!SNM;!set;!SET;!SETNEXT;!setnext;!SetNext",CHATTYPE_ALL,1,GAMEMODE_ALL);



It just allows people to write chat commands for moderators safely, without relying solely on the nick name being the same (easily spoofed if the server allows direct connect).



Re: brenbot plugin needed [message #418939 is a reply to message #418863] Sun, 31 January 2010 06:44 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
All in all, the whole way you're doing it is bad

Brenbots auth system is not only for mods anyone can use it as long as they have registered their name with the bot so even basing it on the auth command is a bad move, ot even going in to the bugs that the bot had/has with its player leaving/joining/failing to dtm temp mods ect


goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: brenbot plugin needed [message #418941 is a reply to message #418939] Sun, 31 January 2010 07:20 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Hex wrote on Sun, 31 January 2010 08:44

All in all, the whole way you're doing it is bad

Brenbots auth system is not only for mods anyone can use it as long as they have registered their name with the bot so even basing it on the auth command is a bad move, ot even going in to the bugs that the bot had/has with its player leaving/joining/failing to dtm temp mods ect


What I mean is only when a moderator !auth themselves, obviously not just any player. I should of made that clear though.

Whether the bot has or had bugs with noticing players leaving or joining is irrelevant. When an "authed" player leaves the server, the player leave hook catched this and removes them from the vector:
	DLLEXPORT void SSGM_Player_Leave_Hook(int ID) {
		if (AuthCheck(ID) == true) {
		AuthClearPlayer(ID);
		}
	}

void AuthClearPlayer(int ID) {
	for (unsigned int i = 0; i < AuthedPlayers.size(); i++) {
			if (AuthedPlayers[i].AuthedPlayerName == Get_Player_Name_By_ID(ID)) {
				AuthedPlayers.erase(AuthedPlayers.begin() + i);

			}
		}
}


I disagree that it's a bad way of doing it really, it would allow for more moderator in-game chat commands to made and used safely.
If nothing else, at least it's another option out there.



Re: brenbot plugin needed [message #418996 is a reply to message #418941] Mon, 01 February 2010 04:37 Go to previous messageGo to next message
raven
Messages: 595
Registered: January 2007
Location: Toronto, Ontario
Karma: 0
Colonel
reborn wrote on Sun, 31 January 2010 08:20


What I mean is only when a moderator !auth themselves, obviously not just any player. I should of made that clear though.



How will you differentiate between a mod !auth'ing themselves and a regular user !auth'ing themselves? Both can register their nicks via BR and auth themselves


-Jelly Administrator
-Exodus Administrator
Re: brenbot plugin needed [message #418997 is a reply to message #418863] Mon, 01 February 2010 04:43 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I have no idea, I don't really know how the bot works. I know that on my APB server we have brenbot, and that moderators need to authenticate themselves. Therefore somewhere there must be a check that says something like if (player == mod)insistonauth(player);
I assumed that if this is what's happening, then it must also be possible to do something similar, but check when they have !auth'ed if they are a mod, or something...

I know that in my APB server, Oxi wrote something like this. I just know too little about br/other regs.



Re: brenbot plugin needed [message #419013 is a reply to message #418863] Mon, 01 February 2010 13:57 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
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



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.


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

[Updated on: Mon, 01 February 2010 14:20]

Report message to a moderator

Re: brenbot plugin needed [message #419014 is a reply to message #418863] Mon, 01 February 2010 14:06 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
That's what I'm talking about, nice one Dan, you're the man!


Re: brenbot plugin needed [message #419015 is a reply to message #418863] Mon, 01 February 2010 14:11 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Whoops, just noticed a bug in the code I posted earlier, it actually calls the console command for UNauthenticated moderators only due to a != instead of a == check.

Updated copy attached.


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

[Updated on: Mon, 01 February 2010 14:12]

Report message to a moderator

Re: brenbot plugin needed [message #419017 is a reply to message #418863] Mon, 01 February 2010 15:19 Go to previous messageGo to next message
Sladewill is currently offline  Sladewill
Messages: 291
Registered: January 2009
Location: United Kingdom
Karma: 0
Recruit

not much time, yet u have to time to look over it lol

FT-Owners - Sladewill,Snazy2007,Willdy
http://FT-Gaming.com for more info...
Re: brenbot plugin needed [message #419026 is a reply to message #419017] Mon, 01 February 2010 17:51 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Sladewill wrote on Mon, 01 February 2010 22:19

not much time, yet u have to time to look over it lol


I just happened to notice it as it was still open on my second monitor while I was working on something else... sometimes these things just jump out at you without really looking. It still might not work properly since it was just thrown together quickly, will have to wait for feedback from reborn on that.


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

[Updated on: Mon, 01 February 2010 17:51]

Report message to a moderator

Re: brenbot plugin needed [message #419043 is a reply to message #418863] Tue, 02 February 2010 00:57 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Really aprpeciate it Dan, will report back soon (hopefully with good news).


Re: brenbot plugin needed [message #419227 is a reply to message #418863] Thu, 04 February 2010 22:36 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 made a br plugin for most of your commands, its not done yet. I was wondering why you need to make another auth system.

Brenbot has a decent auth system that allows users to auth themselves from irc or wol. The user has to register their name with brenbot to be able to auth themselves. If they don't auth the player will be kicked. Brenbot has different permission powers that you can set. You could make a auth system that uses the password that you used to register your name with brenbot or you could do it in your plugin.

Also most of these command will probably never be used in actual game environment. They are good for testing and stuff like that. You should make some commands that server owners will actually use in their everyday game. Although You can easily use a combination of different console commands to perform a certain action.


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

[Updated on: Thu, 04 February 2010 23:03]

Report message to a moderator

Re: brenbot plugin needed [message #419228 is a reply to message #419227] Thu, 04 February 2010 23:43 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Gen_Blacky wrote on Fri, 05 February 2010 00:36

I made a br plugin for most of your commands, its not done yet. I was wondering why you need to make another auth system.

Brenbot has a decent auth system that allows users to auth themselves from irc or wol. The user has to register their name with brenbot to be able to auth themselves. If they don't auth the player will be kicked. Brenbot has different permission powers that you can set. You could make a auth system that uses the password that you used to register your name with brenbot or you could do it in your plugin.

Also most of these command will probably never be used in actual game environment. They are good for testing and stuff like that. You should make some commands that server owners will actually use in their everyday game. Although You can easily use a combination of different console commands to perform a certain action.



I like that you've made a BR plug-in for the additional console commands. All I really wanted was what DP posted, but the plugin you've written/writing also sounds nice for anyone else using the console commands system too.

I didn't want to make an auth system different to br, I know it has a decent enough system already. Infact, that's why I wanted to use it... I am merely piggybacking the system.
Currently, if someone wants to make a chat hook for renegade inside SSGM or a plug-in for it, then they can.
However, there is no real safe way to make that plug-in only used by a moderator. There was some code posted once that made a check on the players name. For instance, when the chat hook was used, before the rest of the code was executed, there was a conditional. That conditional checked that the player's in-game name matched a name contained in a file called mods.txt on the server (the server owner would put all the moderators names in the mods.txt file).
However, if the server allows direct connect, players can easily use a name that they know is in the mods.txt file to gain those powers (even if it is only briefly).
With DanPaul's plug-in for BR, and the auth system I release (which is merely an extension of BR's existing system to use safe mod commands written in SSGM/SSGM Plug-ins), it will be possible to very safely release and use these commands on your server, and also for server owners to extend the plug-in themseles and migrate over any in-game mod commands they currently have to be safer.

I understand that the console commands I implemented will mainly not be used, but having the additional option is always nice. Plus, that attach script console command is more important than you might think at first glance.
Plus, with the examples in that plug-in, it will be easy for other people to extend on it and add their own that they deffinately will use, but never had before because they didn't know how to add them.



Re: brenbot plugin needed [message #419487 is a reply to message #418863] Tue, 09 February 2010 03:38 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
DanPaul,

Apparantly the console commands plugin, and auth plugin for SSGM work together fine, but the bot plugin renders the !auth command inert.
It was tested and here's what happened:
(you can see that the manual !fds attach 1 auth_script made ti work, but still the brenbot auth system wasn't responding to !auth.

Quote:


[03:42:50] <brenbot> Page sent to {AW}Dommo --> {AW}Dommo is a protected nickname. Please authenticate yourself within 60 seconds, or you will be kicked.
[03:42:51] <brenbot> Host: {AW}Dommo is not ranked yet.
[03:42:52] <@{AW}Dommo> !auth {AW}Dommo
[03:42:57] <brenbot> Host: {AW}Dommo is NOT running RenGuard, and COULD be cheating.
[03:43:04] <brenbot> {AW}Dommo: !auth {AW}Dommo
[03:43:10] <brenbot> Page sent to {AW}Dommo --> {AW}Dommo is a protected nickname. Please authenticate yourself within 40 seconds, or you will be kicked.
[03:43:11] <@{AW}Dommo> !fds attach 1 auth_script
[03:43:14] <brenbot> Host: {AW}Dommo is now authenticated as an in-game server moderator
[03:43:30] <brenbot> Page sent to {AW}Dommo --> {AW}Dommo is a protected nickname. Please authenticate yourself within 20 seconds, or you will be kicked.
[03:43:37] <brenbot> {AW}Dommo: !snm comp
[03:43:37] <brenbot> Host: The next map will be RA_Complex.mix
[03:43:37] <brenbot> Host: Moderator {AW}Dommo has changed the next map!



I erally know embarassingly little about bots, perhaps there is something else that needs to happen on the bot side for the command to work?
{AW}Dommo insisted the bot plugin was loaded.



Re: brenbot plugin needed [message #419654 is a reply to message #418863] Wed, 10 February 2010 23:16 Go to previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)


never mind


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

[Updated on: Wed, 10 February 2010 23:22]

Report message to a moderator

Previous Topic: muzzleflash
Next Topic: Nod Arty sfx skew
Goto Forum:
  


Current Time: Thu May 23 10:21:14 MST 2024

Total time taken to generate the page: 3.93814 seconds