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 previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma:
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: scripts.dll 3.4.4 is out
Next Topic: BRenBot serial plugin
Goto Forum:
  


Current Time: Thu Nov 21 06:02:17 MST 2024

Total time taken to generate the page: 0.00883 seconds