Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Other Products » Brenbot Code Questions
Brenbot Code Questions [message #438876] Thu, 04 November 2010 14:11 Go to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Danpual would this be a bad way to constantly update players credits or could this lag the fds. Call the pinfo timer when bot starts. Then everyone's credits are consistently updated every 30 seconds. Would it be better to get it from ssgm log instead of the console.

modules::pinfotimer();	
#id,playername,score,team,ping,ip;port,kbps,0,0,0,credits,0
	if ( $line =~ /(\d+),(.+),\d+,(\d+),\d+,.+;\d+,\d+,\d+,\d+,\d+,(\d+),.+/ )
	{
		my $id = $1;
		my $name = $2;
		my $team = $3;
		my $credits = $4;
		my ( $result, %player ) = plugin::getPlayerData( $id );
		if ( $result == 1 )
		{
			# update credits
			playerData::setKeyValue ( $id, "credits", $credits );
		}	
	}
	
	
	
sub pinfotimer
{
	POE::Session->create
	(
		inline_states =>
		{
			_start => sub
			{
				RenRemCMD( "pinfo" );
				$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
				$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );
			},
			tick => sub
			{
				RenRemCMD( "pinfo" );
				$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
				$_[KERNEL]->alarm( restart => $_[HEAP]->{next_alarm_time} );			
			},
			restart => sub
			{
				RenRemCMD( "pinfo" );
				$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
				$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );			
			},
		}
	);
}


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

[Updated on: Thu, 02 December 2010 13:02]

Report message to a moderator

Re: Update pinfo [message #438879 is a reply to message #438876] Thu, 04 November 2010 15:46 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Gen_Blacky wrote on Thu, 04 November 2010 21:11


sub pinfotimer
{
	POE::Session->create
	(
		inline_states =>
		{
			_start => sub
			{
				RenRemCMD( "pinfo" );
				$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
				$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );
			},
			tick => sub
			{
				RenRemCMD( "pinfo" );
				$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
				$_[KERNEL]->alarm( restart => $_[HEAP]->{next_alarm_time} );			
			},
			restart => sub
			{
				RenRemCMD( "pinfo" );
				$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
				$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );			
			},
		}
	);
}




You can simplify this bit to

sub pinfotimer
{
	POE::Session->create
	(
		inline_states =>
		{
			_start => sub
			{
				$_[KERNEL]->yield('tick');
			},
			tick => sub
			{
				RenRemCMD( "pinfo" );
				$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
				$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );		
			}
		}
	);
}


To reduce code duplication. Also, unless you really need to store the alarm time on the heap, you can reduce

				$_[HEAP]->{next_alarm_time} = int( time() ) + 30;
				$_[KERNEL]->alarm( tick => $_[HEAP]->{next_alarm_time} );


To

				$_[KERNEL]->alarm( tick => int( time() ) + 30 );




As for lagging the FDS, highly unlikely, but since BRenBot calls gameinfo and playerinfo every 20 seconds I don't see the point of calling yet another function for effectively the same thing?


http://steamsignature.com/card/1/76561197975867233.png
Re: Update pinfo [message #438893 is a reply to message #438879] Thu, 04 November 2010 23:02 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
okay but i made this so i can check player credits in the donate commands and it wouldn't work until i made the pinfo timer. When does brenbot update it every 20 seconds?

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Update pinfo [message #438898 is a reply to message #438876] Fri, 05 November 2010 02:19 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
BRenBot calls the gameinfo and playerinfo commands every 20 seconds so that it has an up to date record of the game status (map, scores etc) and player information.

Every version of BRenBot since 0.1 has done this, if it didn't then BRenBot wouldn't work at all as it would have no clue what was happening in the game.


http://steamsignature.com/card/1/76561197975867233.png
Re: Update pinfo [message #438914 is a reply to message #438898] Fri, 05 November 2010 10:55 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
danpaul88 wrote on Fri, 05 November 2010 09:19

BRenBot calls the gameinfo and playerinfo commands every 20 seconds so that it has an up to date record of the game status (map, scores etc) and player information.

Every version of BRenBot since 0.1 has done this, if it didn't then BRenBot wouldn't work at all as it would have no clue what was happening in the game.


yea i understand that brenbot would have no idea unless you did that. You didn't understand my second question i see you update player_info all the time but not pinfo. player_info and pinfo have different outputs pinfo provides more details. Does brenbot 1.52 ever update pinfo because i could not find it.


>player_info 1
Id Name Score Side Ping Address Kbits/s Time

1 genblacky 0 NOD 66 192.168.1.1;55936 19 000.14.38
Total current bandwidth usage for players is 19 kilobits per second

>pinfo
>Start PInfo output
1,genblacky,0,0,50,192.168.1.1;55936,20,1,0,0,4409,-1.000000
End PInfo output


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

[Updated on: Fri, 05 November 2010 11:08]

Report message to a moderator

Re: Update pinfo [message #438916 is a reply to message #438876] Fri, 05 November 2010 11:15 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
BRenBot does not use pinfo because it is not supported in all versions of scripts.dll and therefore would not work on 1.037 FDS installations.

http://steamsignature.com/card/1/76561197975867233.png
Re: Update pinfo [message #440642 is a reply to message #438916] Thu, 02 December 2010 12:51 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
im making a plugin that get peoples serial hashes from renlog

sub serial
{
	my ( $session, $heap, $args ) = @_[ SESSION, HEAP, ARG0 ];
	my $kernel = $_[KERNEL];
	my $line = $args->{line};
	my $name;
	my $serial;
	my $ip;
	my $port;
	my $verification;
	if ($line =~ m/^Serial\shash\sresponse\sfrom\s(.+)\s\-\>\s(.+)\./)
	{
		$name = $1;
		$serial = $2;
		
	}
	if ($line =~ m/^\[JOIN\]\s(.+)\s(.+)\s(.+)/)
	{
		$name = $1;
		$ip = $2;
		$serial = $3;
	}
	if ($line =~ m/^\[Serial\]\s(.+)\s(.+)/)
	{
		$name = $1;
		$serial = $2;
	}
	if ( $line =~ /\(Game\)\s(.+)/ )
	{
		my $text = $1;
		if ($text =~ m/Serial\sof\sclient\s\'(.+)\'\sis\s(.+)\./) 
		{
			$name = $1;
			$serial = $2;
			brIRC::ircmsg ( "in serial 1 $name $serial", "A" );
		}
		if ($text =~ m/Client\s\'(.+)\'\s\((.+)\:(.+)\)\sconnected\./) 
		{
			$name = $1;
			$ip = $2;
			$port = $3;
		}
	}
	if ($line =~ m/(\d+)\s\|\s(.+)\s\|\s(.+)\s\|\s(.+)/) 
	{
		$id = $1;
		$name = $2;
		$serial = $3;
		$verification = $4;
		brIRC::ircmsg ( "09[Serial] $name Verification $verification with serial $serial", "A" );
	}
	brIRC::ircmsg ( "serial $name $serial", "A" );
	serialupdate( $name, $serial );
}


What is the appropriate way to use the renlog hook in the .xml file. What i have currently works but is their an easy way when using the hook.

  <renlog_regex_hooks>
  <hook event="serial" regex="^\[Serial\]|^\[Join\]|^Serial\shash\s|^\(Game\)\s(.+)\sSerial|^\(Game\)\s(.+)\sClient|^\(Game\)\s(.+)\sClient|^(\d+)\s\|\s(.+)\s\|\s(.+)\s\|\s(.+)" />
  </renlog_regex_hooks>


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

[Updated on: Thu, 02 December 2010 12:52]

Report message to a moderator

Re: Brenbot Code Questions [message #440645 is a reply to message #438876] Thu, 02 December 2010 14:39 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Err... why do you need to get the serial 5 different ways? Surely it prints it out the same each time?

http://steamsignature.com/card/1/76561197975867233.png
Re: Brenbot Code Questions [message #440655 is a reply to message #440645] Thu, 02 December 2010 16:34 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
danpaul88 wrote on Thu, 02 December 2010 15:39

Err... why do you need to get the serial 5 different ways? Surely it prints it out the same each time?


support for my ssgm plugin, adads serial plugin, and resurrection.


http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Brenbot Code Questions [message #440680 is a reply to message #438876] Fri, 03 December 2010 01:59 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Surely your server can just rely on ONE source of serials? Or are none of them reliable?

Also, the value of having a serial hash is somewhat debatable since they can be spoofed anyway...


http://steamsignature.com/card/1/76561197975867233.png
Re: Brenbot Code Questions [message #440712 is a reply to message #438876] Fri, 03 December 2010 12:08 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
yes i could only have one source but if i ever released the plugin. People could have different server setups and it would still work. That was the whole point off adding multiple renlog lines. Like I use my ssgm plugin to get the serial but i know many people still use adads ssgm plugin. Having serials helps with security and helps identify spoofers even tho they can change their serial in 2 secs. If this serial doesn't match this name they are most likely not the right person.

Gen_Blacky wrote on Thu, 02 December 2010 13:51


What is the appropriate way to use the renlog hook in the .xml file. What i have currently works but is their an easy way when using the hook.

  <renlog_regex_hooks>
  <hook event="serial" regex="^\[Serial\]|^\[Join\]|^Serial\shash\s|^\(Game\)\s(.+)\sSerial|^\(Game\)\s(.+)\sClient|^\(Game\)\s(.+)\sClient|^(\d+)\s\|\s(.+)\s\|\s(.+)\s\|\s(.+)" />
  </renlog_regex_hooks>



When using multiple renlog lines in 1 event


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

[Updated on: Fri, 03 December 2010 12:35]

Report message to a moderator

Re: Brenbot Code Questions [message #440716 is a reply to message #440680] Fri, 03 December 2010 15:27 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)

danpaul88 wrote on Fri, 03 December 2010 02:59


Also, the value of having a serial hash is somewhat debatable since they can be spoofed anyway...

However, that particular "feature" is simply a line in a config file... you could check to ensure serials were the right length and didn't contain anything odd, because a vast amount of cheaters wouldn't even think to make sure it looked correct. But for his script, that's neither here nor there, so nevermind. Razz


-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 Code Questions [message #440717 is a reply to message #440716] Fri, 03 December 2010 16:07 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
serial hashes are always the same length no matter how long or short the players serial is.

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

[Updated on: Fri, 03 December 2010 16:09]

Report message to a moderator

Re: Brenbot Code Questions [message #440753 is a reply to message #440717] Sat, 04 December 2010 08:04 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)

Gen_Blacky wrote on Fri, 03 December 2010 17:07

serial hashes are always the same length no matter how long or short the players serial is.

You don't know what I'm talking about, do you? The thing I'm referring to reports a fake serial hash, it can (and has been seen) to be literally the text "LOL"


-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 Code Questions [message #440754 is a reply to message #440753] Sat, 04 December 2010 08:27 Go to previous message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
Doing anything with serial hashes is a complete waste of time, the player can change it at will, stop wasting your time

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
Previous Topic: scripts.dll 3.4.4 is out
Next Topic: BRenBot serial plugin
Goto Forum:
  


Current Time: Thu Nov 28 14:14:08 MST 2024

Total time taken to generate the page: 0.01740 seconds