@@ -27,6 +27,7 @@ static bool s_IsEnabled[MAXPLAYERS + 1] = { EXTRAJUMP_DEFAULT_STATE, ... };
2727static bool s_IsDoingExtraJump [MAXPLAYERS + 1 ] = { false , ... };
2828
2929static bool s_AllowedToMultiJump [MAXPLAYERS + 1 ];
30+ static bool s_AllowedToBH [MAXPLAYERS + 1 ];
3031static int s_MaxMultiJumps [MAXPLAYERS + 1 ];
3132static float s_JumpHeight [MAXPLAYERS + 1 ];
3233
@@ -117,6 +118,15 @@ void ExtraJump_OnClientPostAdminCheck(int client, Service svc)
117118 s_JumpHeight [client ] = svc .BonusJumpHeight ;
118119}
119120
121+ void BunnyHop_OnClientPostAdminCheck (int client , Service svc )
122+ {
123+ if (svc == null )
124+ {
125+ s_AllowedToBH [client ] = false ;
126+ return ;
127+ }
128+ }
129+
120130void ExtraJump_OnPlayerSpawn (int client , Service svc )
121131{
122132 s_AllowedToMultiJump [client ] = false ;
@@ -139,6 +149,25 @@ void ExtraJump_OnPlayerSpawn(int client, Service svc)
139149 s_AllowedToMultiJump [client ] = true ;
140150}
141151
152+ void BunnyHop_OnPlayerSpawn (int client , Service svc )
153+ {
154+ s_AllowedToBH [client ] = false ;
155+
156+ if (svc == null )
157+ return ;
158+
159+ if (! svc .BonusBunnyHop )
160+ return ;
161+
162+ if (! IsPlayerAlive (client ))
163+ return ;
164+
165+ if (! IsRoundAllowed (svc , svc .BonusBunnyHopRound ))
166+ return ;
167+
168+ s_AllowedToBH [client ] = true ;
169+ }
170+
142171void ExtraJump_OnPlayerDeath (int client )
143172{
144173 s_AllowedToMultiJump [client ] = false ;
@@ -153,6 +182,11 @@ void ExtraJump_OnClientDisconect(int client)
153182 s_IsDoingExtraJump [client ] = false ;
154183}
155184
185+ void BunnyHop_OnClientDisconnect (int client )
186+ {
187+ s_AllowedToBH [client ] = false ;
188+ }
189+
156190static void FakeJump (int client , float jumpHeight = EXTRAJUMP_DEFAULT_HEIGHT )
157191{
158192 float velocity [3 ];
@@ -197,3 +231,18 @@ static bool CanJumpAgain(int client, int &jumpCount)
197231 // That makes s_MaxMultiJumps 1-indexed (so use <=)
198232 return jumpCount > 0 && jumpCount <= s_MaxMultiJumps [client ];
199233}
234+
235+ void BunnyHop_OnPlayerRunCmd (int client , int &buttons )
236+ {
237+ if (! s_AllowedToBH [client ])
238+ return ;
239+
240+ if (IsPlayerAlive (client ))
241+ {
242+ if ((buttons & IN_JUMP ) > 0 && GetEntityMoveType (client ) == MOVETYPE_WALK && GetEntProp (client , Prop_Send , " m_nWaterLevel" ) <= 1 )
243+ {
244+ int iOldButtons = GetEntProp (client , Prop_Data , " m_nOldButtons" );
245+ SetEntProp (client , Prop_Data , " m_nOldButtons" , iOldButtons & ~ IN_JUMP );
246+ }
247+ }
248+ }
0 commit comments