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

[TF2] Enhanced voice command spam unlimiter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Redeye 43
New Member
Join Date: Feb 2021
Old 02-25-2021 , 23:31   [TF2] Enhanced voice command spam unlimiter
Reply With Quote #1

A plugin used to exist to do the job and allow stuff like THIS but Valve implemented a hardcoded delay on using the voicemenu command that kinda ruins the fun.

Here's a link to a plugin that used to do it, but the last commit was three years ago, so... yeah. Help would be appreciated. A thread already exists, but I thought bumping it would be in poor taste.

EDIT: Problem solved. First post on page 2.

Last edited by Redeye 43; 02-27-2021 at 14:17.
Redeye 43 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-26-2021 , 01:13   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #2

So, this won't work ?
This remove lower bound from console variable. Use sm_cvar tf_max_voice_speak_delay -1 aftern plugin load.

PHP Code:
// tf_max_voice_speak_delay
// Use sm_cvar tf_max_voice_speak_delay -9999.0

public void OnPluginStart()
{

    
ConVar tf_max_voice_speak_delay FindConVar("tf_max_voice_speak_delay");

    if(
tf_max_voice_speak_delay == nullSetFailState("Can't find ConVar 'tf_max_voice_speak_delay'");

    
tf_max_voice_speak_delay.SetBounds(ConVarBound_Lowerfalse);
    
    
delete tf_max_voice_speak_delay;


__________________
Do not Private Message @me

Last edited by Bacardi; 02-26-2021 at 18:55. Reason: delete ConVar after unbound :/
Bacardi is offline
Teamkiller324
Senior Member
Join Date: Feb 2014
Location: Earth
Old 02-26-2021 , 02:10   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
So, this won't work ?
This remove lower bound from console variable. Use sm_cvar tf_max_voice_speak_delay -1 aftern plugin load.

PHP Code:
// tf_max_voice_speak_delay

ConVar tf_max_voice_speak_delay;

public 
void OnPluginStart()
{
    
tf_max_voice_speak_delay FindConVar("tf_max_voice_speak_delay");
    
    if(
tf_max_voice_speak_delay == nullSetFailState("Can't find ConVar 'tf_max_voice_speak_delay'");
    
    
tf_max_voice_speak_delay.SetBounds(ConVarBound_Lowerfalse);


FindConVar("tf_max_voice_speak_delay").SetInt (-1) is simply what you need.
__________________

Last edited by Teamkiller324; 02-26-2021 at 02:10.
Teamkiller324 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-26-2021 , 02:29   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #4

I wanted to know, does it work just by removing cvar lower bound. (I have not that game installed)

And I don't like when plugin change cvar values, I prefer that user change it from config file or typing in console.
It's problematic (in future) to start debug problems when random SM plugins do own things.
Bacardi is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 02-26-2021 , 03:10   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #5

the players have a anti-spam feature

Code:
bool CTFPlayer::CanSpeakVoiceCommand( void )
{
	return ( gpGlobals->curtime > m_flNextVoiceCommandTime );
}

void CTFPlayer::NoteSpokeVoiceCommand( const char *pszScenePlayed )
{
	Assert( pszScenePlayed );

	float flTimeSinceAllowedVoice = gpGlobals->curtime - m_flNextVoiceCommandTime;

	// if its longer than 5 seconds, reset the counter
	if ( flTimeSinceAllowedVoice > 5.0f )
	{
		m_iVoiceSpamCounter = 0;
	}
	// if its less than a second past the allowed time, player is spamming
	else if ( flTimeSinceAllowedVoice < 1.0f )
	{
		m_iVoiceSpamCounter++;
	}

	m_flNextVoiceCommandTime = gpGlobals->curtime + MIN( GetSceneDuration( pszScenePlayed ), tf_max_voice_speak_delay.GetFloat() );

	if ( m_iVoiceSpamCounter > 0 )
	{
		m_flNextVoiceCommandTime += m_iVoiceSpamCounter * 0.5f;
	}
}
even if you set tf_max_voice_speak_delay theres still m_iVoiceSpamCounter
one way to get around both restrictions is DHooking CTFPlayer::CanSpeakVoiceCommand
arthurdead is offline
Teamkiller324
Senior Member
Join Date: Feb 2014
Location: Earth
Old 02-26-2021 , 03:44   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #6

Quote:
Originally Posted by arthurdead View Post
the players have a anti-spam feature

Code:
bool CTFPlayer::CanSpeakVoiceCommand( void )
{
    return ( gpGlobals->curtime > m_flNextVoiceCommandTime );
}

void CTFPlayer::NoteSpokeVoiceCommand( const char *pszScenePlayed )
{
    Assert( pszScenePlayed );

    float flTimeSinceAllowedVoice = gpGlobals->curtime - m_flNextVoiceCommandTime;

    // if its longer than 5 seconds, reset the counter
    if ( flTimeSinceAllowedVoice > 5.0f )
    {
        m_iVoiceSpamCounter = 0;
    }
    // if its less than a second past the allowed time, player is spamming
    else if ( flTimeSinceAllowedVoice < 1.0f )
    {
        m_iVoiceSpamCounter++;
    }

    m_flNextVoiceCommandTime = gpGlobals->curtime + MIN( GetSceneDuration( pszScenePlayed ), tf_max_voice_speak_delay.GetFloat() );

    if ( m_iVoiceSpamCounter > 0 )
    {
        m_flNextVoiceCommandTime += m_iVoiceSpamCounter * 0.5f;
    }
}
even if you set tf_max_voice_speak_delay theres still m_iVoiceSpamCounter
one way to get around both restrictions is DHooking CTFPlayer::CanSpeakVoiceCommand
if someone actually would like to make it happen.
__________________

Last edited by Teamkiller324; 02-26-2021 at 03:45.
Teamkiller324 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-26-2021 , 05:37   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #7

Code:
bool CTFPlayer::CanSpeakVoiceCommand( void )

Signature Linux
Signature for _ZN9CTFPlayer20CanSpeakVoiceCommandEv:
A1 ? ? ? ? 55 89 E5 F3 0F 10 40 0C 8B 45 08 5D 0F 2F 80 74 11 00 00 
\xA1\x2A\x2A\x2A\x2A\x55\x89\xE5\xF3\x0F\x10\x40\x0C\x8B\x45\x08\x5D\x0F\x2F\x80\x74\x11\x00\x00

Virtual Table offset
465	CTFPlayer::CanSpeakVoiceCommand(void)




https://asherkin.github.io/vtable/
 L       W
466	465	CTFPlayer::CanSpeakVoiceCommand()
I would try first vtable offset (466, 465)
And Hook client, do all magic.

Need to go work.
__________________
Do not Private Message @me
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-26-2021 , 18:52   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #8

Ok, I made DHooks plugin but I noticed later, you not really need it. It works, but you not need it.

That extension from first post does right like my second post, removing console variable lower bound.
By default it is min. "0.1"

If you read this anti-spam code, you see m_flNextVoiceCommandTime is getting delay time from tf_max_voice_speak_delay
Quote:
Originally Posted by arthurdead View Post
the players have a anti-spam feature
Code:
bool CTFPlayer::CanSpeakVoiceCommand( void )
{
	return ( gpGlobals->curtime > m_flNextVoiceCommandTime );
}

void CTFPlayer::NoteSpokeVoiceCommand( const char *pszScenePlayed )
{
	Assert( pszScenePlayed );

	float flTimeSinceAllowedVoice = gpGlobals->curtime - m_flNextVoiceCommandTime;

	// if its longer than 5 seconds, reset the counter
	if ( flTimeSinceAllowedVoice > 5.0f )
	{
		m_iVoiceSpamCounter = 0;
	}
	// if its less than a second past the allowed time, player is spamming
	else if ( flTimeSinceAllowedVoice < 1.0f )
	{
		m_iVoiceSpamCounter++;
	}

	m_flNextVoiceCommandTime = gpGlobals->curtime + MIN( GetSceneDuration( pszScenePlayed ), tf_max_voice_speak_delay.GetFloat() );

	if ( m_iVoiceSpamCounter > 0 )
	{
		m_flNextVoiceCommandTime += m_iVoiceSpamCounter * 0.5f;
	}
}
even if you set tf_max_voice_speak_delay theres still m_iVoiceSpamCounter
one way to get around both restrictions is DHooking CTFPlayer::CanSpeakVoiceCommand
So, to bypass this, you set much lower value:
sm_cvar tf_max_voice_speak_delay -9999.0

__________________
Do not Private Message @me
Bacardi is offline
Redeye 43
New Member
Join Date: Feb 2021
Old 02-26-2021 , 20:28   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #9

We tried setting tf_max_voice_speak_delay very low (-9999) and it didn't work. The hardcoded delay seems to still be present. Any ideas why?
Redeye 43 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-26-2021 , 20:50   Re: [TF2] Enhanced voice command spam unlimiter
Reply With Quote #10

...
What cvar value you get after set?

sm_cvar tf_max_voice_speak_delay -9999.0
sm_cvar tf_max_voice_speak_delay


*edit
There is also another way, let plugin create and send VoiceSubtitle usermessages to players
__________________
Do not Private Message @me

Last edited by Bacardi; 02-27-2021 at 01:14.
Bacardi 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 00:17.


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