• Quick SWEP Hook help
    1 replies, posted
I'm having a difficult time getting my head around adding this function (or a function like it) to a SWEP. Essentially I want to create a weapon that when held (active) it allows only the player that is holding it to auto-hop [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]
you'd want to check [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetActiveWeapon]Player:GetActiveWeapon[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetClass]Entity:GetClass[/url] within the hook, provided your current code runs
Sorry, you need to Log In to post a reply to this thread.