Raised This Month: $100 Target: $400
 25% 

Timer Controller v0.0.2 [ April 5th 2014 ]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands        Approver:   Backstabnoob (8)
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-03-2014 , 07:15   Timer Controller v0.0.2 [ April 5th 2014 ]
Reply With Quote #1

.:Timer Controller:.
Version 0.0.2
By hornet

.:Description:.

At the moment, this is a plugin with very basic functionality for pausing and unpausing the round timer and extending / reducing the timer between round end and the next round start.
Also includes some API for scripters to use.

To do list:
  • Add cvar to block event based map objectives whilst round is paused

.:CVARS:.
  • tc_roundendtime
-Sets the amount of time between round end and the start of the next round
.:Commands:.
  • roundpause
-Pauses / Unpauses the round timer [ Admin CVAR access required ]
and displays a pause message
.:Custom Modules Required:.

.:Installation:.
  • Have Orpheu Module installed ( see link in Required Modules ).
  • Extract archive inside cstrike folder.

.:API:.

This plugin's functionality is accessible from other plugins. Will be more useful once more features are added.

The following natives exist:
  • native RoundTimerPause()
-Pauses / Unpauses the round timer
  • native bool:IsRoundTimerPaused()
-Returns if the round timer is paused or not
.:Change Log:.

Spoiler
Attached Files
File Type: sma Get Plugin or Get Source (timer_controller.sma - 913 views - 4.6 KB)
File Type: zip cstrike.zip (9.3 KB, 217 views)
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 04-05-2014 at 02:22.
hornet is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 04-03-2014 , 08:50   Re: Timer Controller [ April 3rd 2014 ]
Reply With Quote #2

Good job.
__________________
Kia is offline
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 04-03-2014 , 09:59   Re: Timer Controller [ April 3rd 2014 ]
Reply With Quote #3

realy cool ! ; +karma !
swapped is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-03-2014 , 12:38   Re: Timer Controller [ April 3rd 2014 ]
Reply With Quote #4

Really good job.

I always wanted to know how to change the time there:

Quote:
Sets the amount of time between round end and the start of the next round
EDIT:

I still wonder how you found out, that it was related to the m_fTeamCount offset. Oo

EDIT2:

register_native( "RoundTimerPause", "_RoundTime_Pause" );

->

register_native( "RoundTimerPause", "_RoundTimerPause" );
__________________
Accepting paid work for clans and communities. !Plugins & Models!
Don't hesitate to contact me.

Last edited by bibu; 04-03-2014 at 14:57.
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-04-2014 , 09:52   Re: Timer Controller [ April 3rd 2014 ]
Reply With Quote #5

All is about checking game binary. With IDA for example. Don't if looked to CSSDK or not, but when you look at CheckWinConditions, you see round are ended this way :

Code:
inline void TerminateRound( float tmDelay, int iWinStatus )
{
      m_iRoundWinStatus   = iWinStatus;
      m_bRoundTerminating = true;
      m_fTeamCount        = gpGlobals->time + tmDelay;
}
With 5 seconds as default value, like : TerminateRound( 5, WinStatus_CT );
__________________

Last edited by Arkshine; 04-04-2014 at 09:53.
Arkshine is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-04-2014 , 22:05   Re: Timer Controller [ April 5th 2014 ]
Reply With Quote #6

Yep, the good old CSSDK tells all

Thanks Bibu, the API was a last second addon cheers for pointing that out haha. Fixed and updated.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 04-04-2014 at 22:06.
hornet is offline
FR0NTLINE
AlliedModders Donor
Join Date: Apr 2006
Location: Riverside Cali
Old 04-05-2014 , 00:19   Re: Timer Controller [ April 5th 2014 ]
Reply With Quote #7

Thanks dudes.
__________________
FR0NTLINE is offline
Send a message via AIM to FR0NTLINE Send a message via MSN to FR0NTLINE Send a message via Yahoo to FR0NTLINE
souvikdas95
Senior Member
Join Date: Mar 2012
Old 04-05-2014 , 05:30   Re: Timer Controller [ April 5th 2014 ]
Reply With Quote #8

@hornet - Really sad... no credits... nothing? xD
souvikdas95 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-05-2014 , 05:45   Re: Timer Controller [ April 5th 2014 ]
Reply With Quote #9

Quote:
Originally Posted by souvikdas95 View Post
@hornet - Really sad... no credits... nothing? xD
Credits for what?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 04-05-2014 , 05:49   Re: Timer Controller [ April 5th 2014 ]
Reply With Quote #10

That timer setting component and pausing? I mean before I posted my Steal C4, no1 actually brought up the idea The logic
Tell me if I am wrong. I would be ready to apologise

FYI - it's not the same ofcourse. But the similarity can be witnessed unless if you deny even that

In your Plugin

EDIT:
Code:
		if( !IsTimerPaused )
		{
			_CGameRules_Think = OrpheuRegisterHook( __CGameRules_Think, "CGameRules_Think" );
			
			set_task( 0.25, "Task_PauseMsg", TASK_PAUSEMSG, _, _, "b" );
			
			g_flRoundPaused = ( get_pcvar_float( g_pRoundTime ) * 60 ) - ( get_gametime() - g_flRoundStart ) + g_flTotalPauseTime;
			
			IsTimerPaused = true;
		}
		else
		{
			OrpheuUnregisterHook( _CGameRules_Think );
			_CGameRules_Think = OrpheuHook:0;
			
			remove_task( TASK_PAUSEMSG );
			
			MemorySet( "m_iRoundTimeSecs", floatround( g_flRoundPaused ) );
			MemorySet( "m_fRoundCount", get_gametime() );
			
			message_begin( MSG_BROADCAST, g_msgRoundTime );
			write_short( floatround( g_flRoundPaused ) );
			message_end();
			
			IsTimerPaused = false;
		}
:
:

public Task_PauseMsg()
{
	g_flTotalPauseTime += 0.25;
	
	set_hudmessage( 0, 255, 0, -1.0, 0.9, 0, 0.0, 0.25, 0.5, 0.5 );
	show_hudmessage( 0, "-ROUND TIMER PAUSED-" );
	
	message_begin( MSG_BROADCAST, g_msgRoundTime );
	write_short( floatround( g_flRoundPaused ) );	
	message_end();
}
In my Plugin :

Code:
	// Time Control
	static time_elapsed, countdown_filter_value;
	countdown_filter_value = floatround ( countdown_value * ( cs_get_user_defuse ( id ) ? 1.0 : multiplier_value ) );
	time_elapsed = floatround ( GameTime - round_timestart );
	round_timeleft = get_mp_pdata ( "m_iRoundTimeSecs" ) - time_elapsed;
	set_mp_pdata ( "m_iRoundTimeSecs" , countdown_filter_value + time_elapsed );
	message_begin ( MSG_BROADCAST, rt_msgid );
	write_short ( countdown_filter_value + 1 );
	message_end ( );

Last edited by souvikdas95; 04-05-2014 at 06:11.
souvikdas95 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:39.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode