AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Timer Controller v0.0.2 [ April 5th 2014 ] (https://forums.alliedmods.net/showthread.php?t=238042)

hornet 04-03-2014 06:15

Timer Controller v0.0.2 [ April 5th 2014 ]
 
2 Attachment(s)
.: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

Kia 04-03-2014 07:50

Re: Timer Controller [ April 3rd 2014 ]
 
Good job.

swapped 04-03-2014 08:59

Re: Timer Controller [ April 3rd 2014 ]
 
realy cool ! ; +karma !

bibu 04-03-2014 11:38

Re: Timer Controller [ April 3rd 2014 ]
 
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" );

Arkshine 04-04-2014 08:52

Re: Timer Controller [ April 3rd 2014 ]
 
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 );

hornet 04-04-2014 21:05

Re: Timer Controller [ April 5th 2014 ]
 
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.

FR0NTLINE 04-04-2014 23:19

Re: Timer Controller [ April 5th 2014 ]
 
Thanks dudes.

souvikdas95 04-05-2014 04:30

Re: Timer Controller [ April 5th 2014 ]
 
@hornet - Really sad... no credits... nothing? xD

hornet 04-05-2014 04:45

Re: Timer Controller [ April 5th 2014 ]
 
Quote:

Originally Posted by souvikdas95 (Post 2120372)
@hornet - Really sad... no credits... nothing? xD

Credits for what?

souvikdas95 04-05-2014 04:49

Re: Timer Controller [ April 5th 2014 ]
 
That timer setting component and pausing? I mean before I posted my Steal C4, no1 actually brought up the idea :P The logic :P
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 :P

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 ( );



All times are GMT -4. The time now is 00:22.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.