This is rather a HL SDK related coding discussion indeed...
What you say is possible, although a bit complicated perhaps. But definitely possible, and it has already been done. But if you're not of those who get discouraged by difficulty, there is already a metamod plugin that adds a weapon to all mods, and I think it comes with source code. I believe it's called "hook mod" or "grapple mod" or something like that. It adds an Opposing Force-style grapple hook to players.