# HL2 Bunnyhop restriction

**URL:** <https://forums.sourceruns.org/t/hl2-bunnyhop-restriction/2845>\
**Category:** Half-Life 2\
**Created:** [April 22, 2016, 8:40am UTC](https://forums.sourceruns.org/t/hl2-bunnyhop-restriction/2845 "2016-04-22T08:40:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xdcy](https://b-cdn.sourceruns.org/user_avatar/forums.sourceruns.org/xdcy/32/132_2.png) [@xdcy](https://forums.sourceruns.org/u/xdcy)\
**Post date:** [April 22, 2016, 8:40am UTC](https://forums.sourceruns.org/t/hl2-bunnyhop-restriction/2845/1 "2016-04-22T08:40:09Z")

</div>

Hello. A moment of your time to help a new coder, please.

I am trying to create a convar to remove the bunnyhop speed limiter imposed by the HL2 update, which will be “cl\_enable\_bunnyhop” and setting it to 1 will cause this change.  
I am using the Source SDK 2013 master files along with Visual Studio 2013 Community.  
I edit the following block inside of the gamemovement.cpp

```cpp
         // We give a certain percentage of the current forward movement as a bonus to the jump speed. That bonus is clipped 

         // to not accumulate over time. 
         float flSpeedBoostPerc = ( !pMoveData->m_bIsSprinting && !player->m_Local.m_bDucked ) ? 0.5f : 0.1f; 
         float flSpeedAddition = fabs( mv->m_flForwardMove * flSpeedBoostPerc ); 
         float flMaxSpeed = mv->m_flMaxSpeed + ( mv->m_flMaxSpeed * flSpeedBoostPerc ); 
         float flNewSpeed = ( flSpeedAddition + mv->m_vecVelocity.Length2D() ); 
         // If we're over the maximum, we want to only boost as much as will get us to the goal speed 
         if ( flNewSpeed > flMaxSpeed ) 
         { 
         flSpeedAddition -= flNewSpeed - flMaxSpeed; 
         } 
         if ( mv->m_flForwardMove < 0.0f ) 
         flSpeedAddition *= -1.0f; 
         // Add it on 
         VectorAdd( (vecForward*flSpeedAddition), mv->m_vecVelocity, mv->m_vecVelocity );

```

To look like this:

```cpp
      if(cl_enable_bunnyhop.GetInt() == 0)
      {
         // We give a certain percentage of the current forward movement as a bonus to the jump speed. That bonus is clipped
         // to not accumulate over time.
         float flSpeedBoostPerc = ( !pMoveData->m_bIsSprinting && !player->m_Local.m_bDucked ) ? 0.5f : 0.1f;
         float flSpeedAddition = fabs( mv->m_flForwardMove * flSpeedBoostPerc );
         float flMaxSpeed = mv->m_flMaxSpeed + ( mv->m_flMaxSpeed * flSpeedBoostPerc );
         float flNewSpeed = ( flSpeedAddition + mv->m_vecVelocity.Length2D() ); 
         // If we're over the maximum, we want to only boost as much as will get us to the goal speed 
         if ( flNewSpeed > flMaxSpeed )
         { 
         flSpeedAddition -= flNewSpeed - flMaxSpeed;
         } 
         if ( mv->m_flForwardMove < 0.0f )
            flSpeedAddition *= -1.0f; 
         // Add it on 
         VectorAdd( (vecForward*flSpeedAddition), mv->m_vecVelocity, mv->m_vecVelocity );
      }
      else
      { 
         if ( !pMoveData->m_bIsSprinting && !player->m_Local.m_bDucked )
         {
            for ( int iAxis = 0; iAxis < 2 ; ++iAxis )
            {
               vecForward[iAxis] *= ( mv->m_flForwardMove * 0.5f );
            }
         }
         else
         {
            for ( int iAxis = 0; iAxis < 2 ; ++iAxis )
            {
               vecForward[iAxis] *= ( mv->m_flForwardMove * 0.1f );
            }
         }
         VectorAdd( vecForward, mv->m_vecVelocity, mv->m_vecVelocity );
      }

```

Then I find the limit jump convar line:

```cpp
#if defined( HL2_DLL ) || defined( HL2_CLIENT_DLL )
ConVar player_limit_jump_speed( "player_limit_jump_speed", "1", FCVAR_REPLICATED );
#endif

```

And add this after it so it reads:

```cpp
#if defined( HL2_DLL ) || defined( HL2_CLIENT_DLL )
ConVar player_limit_jump_speed( "player_limit_jump_speed", "1", FCVAR_REPLICATED );
#endif
ConVar cl_enable_bunnyhop( "cl_enable_bunnyhop", "0", FCVAR_ARCHIVE );

```

I have tried compiling as a client.dll and when I load it into HL2 I get past the logo but when I hit the main screen it pauses for a few seconds and then crashes to desktop with no asserts or errors.

I have even tried removing the bits that clip jump speed, as well as the convar add, and tried only using the other half, and still I get the near instant CTD once I hit the menu.

One thing to note: HL2 has a client.dll there by default, and I have to overwrite it with my modded one. Could this be causing incompatibility issues?

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![YaLTeR](https://b-cdn.sourceruns.org/user_avatar/forums.sourceruns.org/yalter/32/553_2.png) [@YaLTeR](https://forums.sourceruns.org/u/YaLTeR)\
**Post date:** [April 22, 2016, 11:18am UTC](https://forums.sourceruns.org/t/hl2-bunnyhop-restriction/2845/2 "2016-04-22T11:18:11Z")

</div>

Use the beta version of the 2013 ssdk base.

---

<div class="post-metadata">

**Author:** ![xdcy](https://b-cdn.sourceruns.org/user_avatar/forums.sourceruns.org/xdcy/32/132_2.png) [@xdcy](https://forums.sourceruns.org/u/xdcy)\
**Post date:** [April 22, 2016, 8:37pm UTC](https://forums.sourceruns.org/t/hl2-bunnyhop-restriction/2845/3 "2016-04-22T20:37:21Z")

</div>

> [@YaLTeR](#):
>
> Use the beta version of the 2013 ssdk base.

Will give that a try. Thanks!

---

<div class="post-metadata">

**Author:** ![xdcy](https://b-cdn.sourceruns.org/user_avatar/forums.sourceruns.org/xdcy/32/132_2.png) [@xdcy](https://forums.sourceruns.org/u/xdcy)\
**Post date:** [April 22, 2016, 9:12pm UTC](https://forums.sourceruns.org/t/hl2-bunnyhop-restriction/2845/4 "2016-04-22T21:12:26Z")

</div>

> [@YaLTeR](#):
>
> Use the beta version of the 2013 ssdk base.

When I download the steam version of the Source SDK 2013 and opt into the ‘upcoming’ beta;

then navigate to D:\Steam\steamapps\common\Source SDK Base 2013 Multiplayer, I can’t find the mp or sp folder, neither can I find the createprojects.bat to create a games.sln.

Do I need to compile the SDK files first to aquire these? And if so, how?

Sorry, I’m still pretty fresh to this. :o

---

<div class="post-metadata">

**Author:** ![YaLTeR](https://b-cdn.sourceruns.org/user_avatar/forums.sourceruns.org/yalter/32/553_2.png) [@YaLTeR](https://forums.sourceruns.org/u/YaLTeR)\
**Post date:** [April 23, 2016, 8:31am UTC](https://forums.sourceruns.org/t/hl2-bunnyhop-restriction/2845/5 "2016-04-23T08:31:08Z")

</div>

DL the SSDK base 2013, opt into the beta, then launch both at least once. Then in the Source SDK tool you create a mod on the 2013 engine, this will both give you the source code and put a folder into steamapps\sourcemods for your mod, where you will need to place your client and server DLLs. After you restart steam afterwards, it will also put your mod into the game list, this is how you will launch it.
