• Bhop Autojump
    12 replies, posted
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 [CODE]if ply:KeyDown(IN_JUMP) then --do stuff end[/CODE]
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 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 [URL="http://wiki.garrysmod.com/page/GM/OnPlayerHitGround"]OnPlayerHitGround[/URL] is marked as server hook. Can you confirm that it's all shared? Because I need to fix [URL="https://github.com/LennyPenny/Lennys/blob/master/lua/Lenny/advbhop.lua"]my[/URL] 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
[QUOTE=LennyPenny;43421224]Huh, in the wiki [URL="http://wiki.garrysmod.com/page/GM/OnPlayerHitGround"]OnPlayerHitGround[/URL] is marked as server hook. Can you confirm that it's all shared? Because I need to fix [URL="https://github.com/LennyPenny/Lennys/blob/master/lua/Lenny/advbhop.lua"]my[/URL] bhop script up then. Although I don't lose speed either this seems like a cleaner way than using IsOnGround.[/QUOTE] 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] [QUOTE='[FG] Pot;43421795']So I just put it as autohop.lua and put it in garrysmod/lua/autorun/client[/QUOTE] 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! >.<
[QUOTE=Acecool;43420680]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 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.[/QUOTE] how do i install or where do i put it? help plz! [editline]15th July 2014[/editline] [QUOTE=Acecool;43420680]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 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.[/QUOTE] 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: [CODE] hook.Add( 'SetupMove', 'auto hop', function( ply, move ) if not ply:IsOnGround() then move:SetButtons( bit.band( move:GetButtons(), bit.bnot( IN_JUMP ) ) ) end end ) [/CODE] It's server sided. edit: jesus that necro post...
[QUOTE=Newbrict;45402826]Doesn't get better than this: [CODE] hook.Add( 'SetupMove', 'auto hop', function( ply, move ) if not ply:IsOnGround() then move:SetButtons( bit.band( move:GetButtons(), bit.bnot( IN_JUMP ) ) ) end end ) [/CODE] It's server sided. edit: jesus that necro post...[/QUOTE] how do i install? does this work for everyone in my server?
[QUOTE=Newbrict;45402826]Doesn't get better than this: [CODE] hook.Add( 'SetupMove', 'auto hop', function( ply, move ) if not ply:IsOnGround() then move:SetButtons( bit.band( move:GetButtons(), bit.bnot( IN_JUMP ) ) ) end end ) [/CODE] It's server sided. edit: jesus that necro post...[/QUOTE] I'd chuck that in a shared file, but yes.
[QUOTE=Newbrict;45402826]Doesn't get better than this: [CODE] hook.Add( 'SetupMove', 'auto hop', function( ply, move ) if not ply:IsOnGround() then move:SetButtons( bit.band( move:GetButtons(), bit.bnot( IN_JUMP ) ) ) end end ) [/CODE] It's server sided. edit: jesus that necro post...[/QUOTE] whats ur steam and ill add your so i can call you my steam is ™Space God
[QUOTE=Acecool;43420680]I did this as an experiment. When bhopping using this, you are frictionless. You lose 0 speed in a straight line.[/QUOTE] I just did a test on this. You do infact lose speed but I'm not sure if any method can avoid this.
Sorry, you need to Log In to post a reply to this thread.