1515 * along with this program. If not, see <https://www.gnu.org/licenses/>.
1616 */
1717
18+ #pragma semicolon 1
19+ #pragma newdecls required
20+
1821#include <sourcemod>
1922#include <sdktools>
2023#include <sdkhooks>
2326#include <tf2attributes>
2427#include <sourcescramble>
2528
26- #pragma semicolon 1
27- #pragma newdecls required
28-
29- #define PLUGIN_VERSION " 1.8.2"
29+ #define PLUGIN_VERSION " 1.9.0"
3030
3131enum
3232{
@@ -49,6 +49,7 @@ Cookie g_hCookieAutoJumpDisabled;
4949Handle g_hSDKCallCanAirDash ;
5050
5151ConVar sm_bhop_enabled ;
52+ ConVar sm_bhop_enablebunnyhopping ;
5253ConVar sm_bhop_autojump ;
5354ConVar sm_bhop_autojump_falldamage ;
5455ConVar sm_bhop_duckjump ;
@@ -76,14 +77,17 @@ public void OnPluginStart()
7677
7778 g_hMemoryPatches = new ArrayList (sizeof (MemoryPatchData ));
7879
79- sm_bhop_enabled = CreateConVar (" sm_bhop_enabled" , " 1" , " When set, allows player speed to exceed maximum running speed." );
80+ CreateConVar (" sm_bhop_version" , PLUGIN_VERSION , " The plugin version." , FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY | FCVAR_DONTRECORD );
81+ sm_bhop_enabled = CreateConVar (" sm_bhop_enabled" , " 1" , " Whether to enable the plugin." );
8082 sm_bhop_enabled .AddChangeHook (OnConVarChanged_EnablePlugin );
83+ sm_bhop_enablebunnyhopping = CreateConVar (" sm_bhop_enablebunnyhopping" , " 1" , " When set, allows player speed to exceed maximum running speed." );
84+ sm_bhop_enablebunnyhopping .AddChangeHook (OnConVarChanged_EnableMemoryPatch );
8185 sm_bhop_autojump = CreateConVar (" sm_bhop_autojump" , " 1" , " When set, players automatically re-jump while holding the jump button." );
8286 sm_bhop_autojump_falldamage = CreateConVar (" sm_bhop_autojump_falldamage" , " 0" , " When set, players will take fall damage while auto-bunnyhopping." );
8387 sm_bhop_duckjump = CreateConVar (" sm_bhop_duckjump" , " 1" , " When set, allows jumping while ducked." );
8488 sm_bhop_duckjump .AddChangeHook (OnConVarChanged_EnableMemoryPatch );
8589
86- g_hCookieAutoJumpDisabled = new Cookie (" autobunnyhopping_disabled " , " Do not automatically re-jump while holding jump button" , CookieAccess_Protected );
90+ g_hCookieAutoJumpDisabled = new Cookie (" bhop_autojump_disable " , " Do not automatically re-jump while holding jump button" , CookieAccess_Protected );
8791
8892 RegConsoleCmd (" sm_bhop" , ConCmd_ToggleAutoBunnyhopping , " Toggle auto-bunnyhopping preference" );
8993
@@ -104,13 +108,13 @@ public void OnPluginStart()
104108 SetFailState (" Failed to find signature for function 'CTFPlayer::CanAirDash'" );
105109 }
106110
107- char platform [64 ];
111+ char platform [16 ];
108112 if (gameconf .GetKeyValue (" Platform" , platform , sizeof (platform )))
109113 {
110114 if (StrEqual (platform , " linux" ))
111- CreateMemoryPatch (gameconf , " CTFGameMovement::PreventBunnyJumping::AllowBunnyJumping_Linux" , sm_bhop_enabled );
115+ CreateMemoryPatch (gameconf , " CTFGameMovement::PreventBunnyJumping::AllowBunnyJumping_Linux" , sm_bhop_enablebunnyhopping );
112116 else if (StrEqual (platform , " windows" ))
113- CreateMemoryPatch (gameconf , " CTFGameMovement::PreventBunnyJumping::AllowBunnyJumping_Windows" , sm_bhop_enabled );
117+ CreateMemoryPatch (gameconf , " CTFGameMovement::PreventBunnyJumping::AllowBunnyJumping_Windows" , sm_bhop_enablebunnyhopping );
114118 else
115119 SetFailState (" Unknown or unsupported platform '%s '" , platform );
116120 }
@@ -253,7 +257,7 @@ Action OnClientTakeDamage(int victim, int &attacker, int &inflictor, float &dama
253257
254258bool HitTrigger (int entity )
255259{
256- char classname [16 ];
260+ char classname [13 ];
257261 if (GetEntityClassname (entity , classname , sizeof (classname )) && StrEqual (classname , " trigger_push" ))
258262 {
259263 float pushDir [3 ];
@@ -320,7 +324,7 @@ bool CanBunnyhop(int client)
320324{
321325 return ! g_bDisabledAutoBhop [client ]
322326 && ! g_bInJumpRelease [client ]
323- && GetEntPropEnt (client , Prop_Send , " m_hVehicle" ) == - 1
327+ && GetEntPropEnt (client , Prop_Data , " m_hVehicle" ) == - 1
324328 && GetEntProp (client , Prop_Data , " m_nWaterLevel" ) < WL_Waist
325329 && GetEntityMoveType (client ) != MOVETYPE_NONE
326330 && ! TF2_IsPlayerInCondition (client , TFCond_HalloweenGhostMode )
@@ -329,10 +333,10 @@ bool CanBunnyhop(int client)
329333
330334bool CanAirDash (int client )
331335{
332- return g_hSDKCallCanAirDash ? SDKCall (g_hSDKCallCanAirDash , client ) : false ;
336+ return SDKCall (g_hSDKCallCanAirDash , client );
333337}
334338
335339bool CanDeployParachute (int client )
336340{
337- return TF2Attrib_HookValueInt (0 , " parachute_attribute" , client ) ? ! TF2Attrib_HookValueInt ( 0 , " parachute_disabled " , client ) : false ;
341+ return TF2Attrib_HookValueInt (0 , " parachute_attribute" , client ) != 0 ;
338342}
0 commit comments