Bhop Autojump

Well I have made a bhop server. I have everything set up except the autohop. I need a script that will allow everyone even the people who connect to the server for the first time, to be able to use autohop by just holding down space. Could someone please give me the code for it and tell me where to put it. I think you put it in garrysmod/lua/autorun/client but either way let me know.

What is the point of a bhop server if you just let everyone autohop? Doesn’t that defeat the purpose?

Anyway scripts are client side things you would need to code something into your gamemode that pretty much says

if ply:KeyDown(IN_JUMP) then
--do stuff


Here’s how I do auto-hop; clientside:

[lua]hook.Add( “CreateMove”, “BunnyHop:CreateMove”, function( input )
if ( !LocalPlayer( ):Alive( ) || !LocalPlayer( ).NextBunnyHop ) then return; end
if ( LocalPlayer( ).NextBunnyHop < CurTime( ) ) then return; end

if ( input:KeyDown( IN_JUMP ) ) then
	input:SetButtons( input:GetButtons( ) - IN_JUMP );

end );

hook.Add( “OnPlayerHitGround”, “BunnyHop:HotFeet”, function( _p, _inWater, _onFloater, _speed )
_p.NextBunnyHop = CurTime( );
end );[/lua]

I did this as an experiment. When bhopping using this, you are frictionless. You lose 0 speed in a straight line. All it does it when you hit the ground, it resets the timer which then causes the CreateMove to reset the jump button to simulate it being pressed again.

Huh, in the wiki OnPlayerHitGround is marked as server hook.
Can you confirm that it’s all shared?
Because I need to fix my bhop script up then. Although I don’t lose speed either this seems like a cleaner way than using IsOnGround.

So I just put it as autohop.lua and put it in garrysmod/lua/autorun/client

I’ll double-check. I have it in the client-folder, and unless my file-loader is screwing up it’ll only be executed on the client.

[546] = [CLIENT] :: gamemode/addons/anti_cheat/client/_debug.lua

Nope; it’s only run client-side. I’ll update the wiki to SHARED. Thanks!

[editline]5th January 2014[/editline]

And, yes! The only thing you may consider doing is modifying it to add convars so that it can be enabled / disabled depending on the user-preference.

I didn’t even know there was a OnPlayerHitGround hook.
How silly of me! >.<

how do i install or where do i put it? help plz!

[editline]15th July 2014[/editline]

thats a weird code man i tested it and u walk a little before u jump again can u fix this??

Doesn’t get better than this:

hook.Add( 'SetupMove', 'auto hop', function( ply, move )
    if not ply:IsOnGround() then
    move:SetButtons( move:GetButtons(), bit.bnot( IN_JUMP ) ) )
end )

It’s server sided.

edit: jesus that necro post…

how do i install? does this work for everyone in my server?

I’d chuck that in a shared file, but yes.

whats ur steam and ill add your so i can call you my steam is
™Space God

I just did a test on this. You do infact lose speed but I’m not sure if any method can avoid this.