Skip to content

Instantly share code, notes, and snippets.

@severedskullz
Created July 29, 2009 16:55
Show Gist options
  • Select an option

  • Save severedskullz/158260 to your computer and use it in GitHub Desktop.

Select an option

Save severedskullz/158260 to your computer and use it in GitHub Desktop.
function DropActiveWeapon(ply)
local ent = ply:GetActiveWeapon()
if not ValidEntity(ent) then return "" end
ply:DropWeapon(ply:GetActiveWeapon())
return ""
end
concommand.Add("DropActiveWeapon", DropActiveWeapon)
// The event function
function plychat( player, text, teamchat, alive )
print "it ran"
if (text == "/drop") then
DropActiveWeapon(player)
print "It dropped"
end
end
// Hook the event.
hook.Add( "OnPlayerChat", "plychat", plychat);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment