Skip to content

Instantly share code, notes, and snippets.

@samisalreadytaken
Created November 21, 2022 09:27
Show Gist options
  • Select an option

  • Save samisalreadytaken/5a1bc7ed7c147601bc49965688fd2b2e to your computer and use it in GitHub Desktop.

Select an option

Save samisalreadytaken/5a1bc7ed7c147601bc49965688fd2b2e to your computer and use it in GitHub Desktop.
//
// bind g drop
//
if ( SERVER_DLL )
{
Convars.RegisterCommand( "drop", function(...)
{
local player = Convars.GetCommandClient();
local weapon = player.GetActiveWeapon();
if ( weapon )
{
player.DropWeapon( weapon );
}
}, "", FCVAR_GAMEDLL );
Convars.RegisterCommand( "dropall", function(...)
{
local player = Convars.GetCommandClient();
player.DropAllWeapons( false );
}, "", FCVAR_GAMEDLL );
// hook phys_swap command by default (G)
Convars.RegisterCommand( "phys_swap", function(...) { SendToConsole("drop") }, "", FCVAR_GAMEDLL );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment