Raised This Month: $51 Target: $400
 12% 

[CS:GO] [REQ] Block crouch/duck press inside trigger_push


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 12-20-2016 , 16:46   [CS:GO] [REQ] Block crouch/duck press inside trigger_push
Reply With Quote #1

Hey guys, I'm attempting to stop the possibility of "superboosting/crouchboosting" inside trigger_push's (commonly achieved by spamming crouch large sized trigger_push to achieve an unintended, very fast boost.

Could someone possibly write up a small plugin to block the crouch/duck button from being pressed while inside of a trigger_push, possibly with a cvar to enable/disable? I think it is important to preserve the player's current crouched/standing state. For example, if the player enters the trigger_push crouched, they wouldn't be forced back into a standing position for the duration of being inside the trigger_push. Would be much appreciated, thank you!
__________________

Last edited by sneaK; 12-22-2016 at 19:16.
sneaK is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 12-21-2016 , 02:07   Re: [CS:GO] [REQ] Block crouch/duck press inside trigger_push
Reply With Quote #2

Quote:
Originally Posted by blackhawk74 View Post
Hey guys, I'm attempting to stop the possibility of "superboosting/crouchboosting" inside trigger_push's (commonly achieved by spamming crouch large sized trigger_push to achieve an unintended, very fast boost.

Could someone possibly write up a small plugin to block the crouch/duck button from being pressed while inside of a trigger_push, possibly with a cvar to enable/disable? I think it is important to preserve the player's current crouched/standing state. For example, if the player enters the trigger_push crouched, they wouldn't be forced back into a standing position for the duration of being inside the trigger_push. Would be much appreciated, thank you!
I had some time, but this is completely untested. There's probably a more efficient way of doing this and I regret putting so much processing into OnPlayerRunCmd.

If it's not working then try increasing the distance, it doesn't uncrouch them though. It just sets their speed to nothing.

Also, add me on steam please
PHP Code:
-snip
Removed due to solution below. I removed the script to prevent people from using it (cpu demanding)

Last edited by headline; 12-21-2016 at 14:54.
headline is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 12-21-2016 , 11:54   Re: [CS:GO] [REQ] Block crouch/duck press inside trigger_push
Reply With Quote #3

Tested with the default distance, then 5, then 200 (just for good measure). Afterwards, realized this was getting spammed in the error logs:

Code:
L 12/21/2016 - 01:30:10: [SM] Exception reported: Invalid index -1 (count: 0)
L 12/21/2016 - 01:30:10: [SM] Blaming: hl_blockcrouchpush.smx
L 12/21/2016 - 01:30:10: [SM] Call stack trace:
L 12/21/2016 - 01:30:10: [SM]   [0] ArrayList.Erase
L 12/21/2016 - 01:30:10: [SM]   [1] Line 53, G:\sm1.8\scripting\hl_blockcrouchpush.sp::OnEntityDestroyed
Added!
__________________

Last edited by sneaK; 12-21-2016 at 11:54.
sneaK is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 12-21-2016 , 14:29   Re: [CS:GO] [REQ] Block crouch/duck press inside trigger_push
Reply With Quote #4

You can try this, although i'm not 100% sure it would work on CS:GO.

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

#pragma newdecls required
#define PLUGIN_VERSION "1.0"

ConVar g_cEnabled;
bool g_bIsTouching[MAXPLAYERS 1];

public 
Plugin myinfo 
{
    
name "Stop superboosting goddamit",
    
author "Tak (Chaosxk)",
    
description "You know what i mean!",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/showthread.php?t=291771"
};

public 
void OnPluginStart()
{
    
CreateConVar("sm_ssb_version"PLUGIN_VERSION"Version for this plugin."FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
g_cEnabled CreateConVar("sm_ssb_enable""1""Enable/Disable this plugin.");
    
HookEntityOutput("trigger_push""OnStartTouch"Hook_OnStartTouch);
    
HookEntityOutput("trigger_push""OnEndTouch"Hook_OnEndTouch);
}

public 
void OnClientDisconnect(int client)
{
    
//Not sure if this part is needed, but just incase
    
g_bIsTouching[client] = false;
}

public 
void Hook_OnStartTouch(const char[] outputint callerint activatorfloat delay)
{
    if (
<= activator <= MaxClients)
        
g_bIsTouching[activator] = true;
}

public 
void Hook_OnEndTouch(const char[] outputint callerint activatorfloat delay)
{
    if (
<= activator <= MaxClients)
        
g_bIsTouching[activator] = false;
}

public 
Action OnPlayerRunCmd(int clientint &buttonsint &impulsefloat vel[3], float angles[3], int &weaponint &subtypeint &cmdnumint &tickcountint &seedint mouse[2])
{
    if (!
g_cEnabled.BoolValue || !g_bIsTouching[client])
        return 
Plugin_Continue;
    
    if (
buttons IN_DUCK)
    {
        
buttons &= ~IN_DUCK;
        return 
Plugin_Changed;
    }
    
    return 
Plugin_Continue;

__________________

Last edited by Chaosxk; 12-21-2016 at 14:30.
Chaosxk is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 12-21-2016 , 18:45   Re: [CS:GO] [REQ] Block crouch/duck press inside trigger_push
Reply With Quote #5

Quote:
Originally Posted by Chaosxk View Post
You can try this, although i'm not 100% sure it would work on CS:GO.
As far as I can tell after trying to superboost a common spot for a solid 10 minutes I wasn't able to do it once. Unloaded the plugin and I was able to superboost again on first try.

Works wonderfully, thank you kind sir!
__________________
sneaK is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 12-22-2016 , 19:20   Re: [CS:GO] [REQ] Block crouch/duck press inside trigger_push
Reply With Quote #6

After having the plugin in my server for a day, I've been getting varying reports about strange crouch behavior - I experienced some of it myself, for example when midair, pressing crouch a few times causes me to "float" (if that makes sense). I could probably whip up a video if you'd like.
__________________
sneaK is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 12-25-2016 , 18:46   Re: [CS:GO] [REQ] Block crouch/duck press inside trigger_push
Reply With Quote #7

Try either of the 2, just replace the part of the code.

Code:
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
{
    if (!g_cEnabled.BoolValue || !g_bIsTouching[client])
        return Plugin_Continue;
    
    if (buttons & IN_DUCK && GetEntityFlags(client) & FL_ONGROUND)
    {
        buttons &= ~IN_DUCK;
        return Plugin_Changed;
    }
    
    return Plugin_Continue;
}
or

Code:
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
{
    if (!g_cEnabled.BoolValue || !g_bIsTouching[client])
        return Plugin_Continue;
    
    if (buttons & IN_DUCK)
    {
        return Plugin_Handled;
    }
    
    return Plugin_Continue;
}
First one, it will disable crouching if player is on ground. In air they can press they can crouch.
Second one should disable crouching completely but might have some client predictions.

If neither works, a video might be helpful me understand the issue.
__________________

Last edited by Chaosxk; 12-25-2016 at 18:47.
Chaosxk 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:45.


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