AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Prevent round ending due to timer and remove timer with Orpheu (https://forums.alliedmods.net/showthread.php?t=309759)

edon1337 08-06-2018 06:31

Prevent round ending due to timer and remove timer with Orpheu
 
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?

hornet 08-06-2018 08:07

Re: Prevent round ending due to timer and remove timer with Orpheu
 
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.

edon1337 08-06-2018 08:10

Re: Prevent round ending due to timer and remove timer with Orpheu
 
Quote:

Originally Posted by hornet (Post 2608540)
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.

edon1337 08-06-2018 08:31

Re: Prevent round ending due to timer and remove timer with Orpheu
 
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();



HamletEagle 08-06-2018 08:36

Re: Prevent round ending due to timer and remove timer with Orpheu
 
Quote:

Originally Posted by edon1337 (Post 2608558)
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.

edon1337 08-06-2018 08:37

Re: Prevent round ending due to timer and remove timer with Orpheu
 
Quote:

Originally Posted by HamletEagle (Post 2608560)
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(); 


HamletEagle 08-06-2018 08:46

Re: Prevent round ending due to timer and remove timer with Orpheu
 
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.

edon1337 08-06-2018 08:48

Re: Prevent round ending due to timer and remove timer with Orpheu
 
Quote:

Originally Posted by HamletEagle (Post 2608565)
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(); 


hornet 08-06-2018 18:44

Re: Prevent round ending due to timer and remove timer with Orpheu
 
Quote:

Originally Posted by edon1337 (Post 2608518)
Also, how do I get rid of the timer efficiently, with Orpheu?

Actually ... :wink: That's why I suggested those things lol. But awesome, glad you got it.


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

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