Raised This Month: $32 Target: $400
 8% 

Solved Prevent round ending due to timer and remove timer with Orpheu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-06-2018 , 06:31   Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #1

How do I prevent round from ending when timer runs out of time? I was thinking of superceding SyncRoundTimer but it looks like it also deals with freezetime, it might cause problems.

Reference:
Code:
void CBasePlayer::SyncRoundTimer()
{
	float tmRemaining = 0;
	BOOL bFreezePeriod = g_pGameRules->IsFreezePeriod();

	if (g_pGameRules->IsMultiplayer())
	{
		tmRemaining = CSGameRules()->GetRoundRemainingTimeReal();

#ifdef REGAMEDLL_FIXES
		// hide timer HUD because it is useless.
		if (tmRemaining <= 0.0f && CSGameRules()->m_iRoundTime <= 0) {
			m_iHideHUD |= HIDEHUD_TIMER;
			return;
		}

		if (m_iHideHUD & HIDEHUD_TIMER)
		{
			m_iHideHUD &= ~HIDEHUD_TIMER;
			MESSAGE_BEGIN(MSG_ONE, gmsgShowTimer, nullptr, pev);
			MESSAGE_END();
		}
#endif
	}

	if (tmRemaining < 0)
		tmRemaining = 0;

	MESSAGE_BEGIN(MSG_ONE, gmsgRoundTime, nullptr, pev);
		WRITE_SHORT(int(tmRemaining));
	MESSAGE_END();

	if (!g_pGameRules->IsMultiplayer())
		return;

	if (bFreezePeriod && TheTutor && GetObserverMode() == OBS_NONE)
	{
		MESSAGE_BEGIN(MSG_ONE, gmsgBlinkAcct, nullptr, pev);
			WRITE_BYTE(MONEY_BLINK_AMOUNT);
		MESSAGE_END();
	}

	if (TheCareerTasks && CSGameRules()->IsCareer())
	{
		int remaining = 0;
		bool shouldCountDown = false;
		int fadeOutDelay = 0;

		if (tmRemaining != 0.0f)
		{
			remaining = TheCareerTasks->GetTaskTime() - (gpGlobals->time - CSGameRules()->m_fRoundStartTime);
		}

		if (remaining < 0)
			remaining = 0;

		if (bFreezePeriod)
			remaining = -1;

		if (TheCareerTasks->GetFinishedTaskTime())
			remaining = -TheCareerTasks->GetFinishedTaskTime();

		if (!bFreezePeriod && !TheCareerTasks->GetFinishedTaskTime())
		{
			shouldCountDown = true;
		}
		if (!bFreezePeriod)
		{
			if (TheCareerTasks->GetFinishedTaskTime() || (TheCareerTasks->GetTaskTime() <= TheCareerTasks->GetRoundElapsedTime()))
			{
				fadeOutDelay = 3;
			}
		}

		if (!TheCareerTasks->GetFinishedTaskTime() || TheCareerTasks->GetFinishedTaskRound() == CSGameRules()->m_iTotalRoundsPlayed)
		{
			MESSAGE_BEGIN(MSG_ONE, gmsgTaskTime, nullptr, pev);
				WRITE_SHORT(remaining);			// remaining of time, -1 the timer is disappears
				WRITE_BYTE(shouldCountDown);	// timer counts down
				WRITE_BYTE(fadeOutDelay); 		// fade in time, hide HUD timer after the expiration time
			MESSAGE_END();
		}
	}
}
Also, how do I get rid of the timer efficiently, with Orpheu? I know the way VEN does it by using HIDEHUD_TIMER, is there any other way?
__________________

Last edited by edon1337; 08-06-2018 at 13:51.
edon1337 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-06-2018 , 08:07   Re: Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #2

If Arkshine's Infinite Round isn't enough, you can take a look at this plugin I wrote years ago in which I did quite a bit of manipulation of the round timer.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-06-2018 , 08:10   Re: Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #3

Quote:
Originally Posted by hornet View Post
If Arkshine's Infinite Round isn't enough, you can take a look at this plugin I wrote years ago in which I did quite a bit of manipulation of the round timer.
The entire point is to get rid of Arkshine's Infinite Round, which requires CVAR Util module.
I'll check it, thanks.
__________________

Last edited by edon1337; 08-06-2018 at 08:10.
edon1337 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-06-2018 , 08:31   Re: Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #4

I think I can simply call this
PHP Code:
void CBasePlayer::HideTimer()
{
    
// HACK HACK, we need to hide only the timer.
    
MESSAGE_BEGIN(MSG_ONEgmsgBombDropnullptrpev);
        
WRITE_COORD(0);
        
WRITE_COORD(0);
        
WRITE_COORD(0);
        
WRITE_BYTE(BOMB_FLAG_PLANTED);
    
MESSAGE_END();

    
MESSAGE_BEGIN(MSG_ONEgmsgBombPickupnullptrpev);
    
MESSAGE_END();

__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-06-2018 , 08:36   Re: Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #5

Quote:
Originally Posted by edon1337 View Post
I think I can simply call this
PHP Code:
void CBasePlayer::HideTimer()
{
    
// HACK HACK, we need to hide only the timer.
    
MESSAGE_BEGIN(MSG_ONEgmsgBombDropnullptrpev);
        
WRITE_COORD(0);
        
WRITE_COORD(0);
        
WRITE_COORD(0);
        
WRITE_BYTE(BOMB_FLAG_PLANTED);
    
MESSAGE_END();

    
MESSAGE_BEGIN(MSG_ONEgmsgBombPickupnullptrpev);
    
MESSAGE_END();

You don't even need to bother hooking and calling this, you can redo it in pawn very easy.
__________________

Last edited by HamletEagle; 08-06-2018 at 08:36.
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-06-2018 , 08:37   Re: Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
You don't even need to bother hooking and calling this, you can redo it in pawn very easy.
You mean doing this but without Orpheu?
PHP Code:
    MESSAGE_BEGIN(MSG_ONEgmsgBombDropnullptrpev);
        
WRITE_COORD(0);
        
WRITE_COORD(0);
        
WRITE_COORD(0);
        
WRITE_BYTE(BOMB_FLAG_PLANTED);
    
MESSAGE_END();

    
MESSAGE_BEGIN(MSG_ONEgmsgBombPickupnullptrpev);
    
MESSAGE_END(); 
__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-06-2018 , 08:46   Re: Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #7

What is the point of using orpheu if you just want to send a message? Use orpheu only if you have to, it just adds unnedes complexity in this case.
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-06-2018 , 08:48   Re: Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
What is the point of using orpheu if you just want to send a message?
That's why I said without Orpheu. So sending these messages is enough? (Not using Orpheu, simply Message.inc)
PHP Code:
    MESSAGE_BEGIN(MSG_ONEgmsgBombDropnullptrpev); 
        
WRITE_COORD(0); 
        
WRITE_COORD(0); 
        
WRITE_COORD(0); 
        
WRITE_BYTE(BOMB_FLAG_PLANTED); 
    
MESSAGE_END(); 

    
MESSAGE_BEGIN(MSG_ONEgmsgBombPickupnullptrpev); 
    
MESSAGE_END(); 
__________________
edon1337 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-06-2018 , 18:44   Re: Prevent round ending due to timer and remove timer with Orpheu
Reply With Quote #9

Quote:
Originally Posted by edon1337 View Post
Also, how do I get rid of the timer efficiently, with Orpheu?
Actually ... That's why I suggested those things lol. But awesome, glad you got it.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 08-06-2018 at 18:46.
hornet is offline
Reply



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 18:37.


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