A pill normally has two states:
On - Set about a second after the SWEP is deployed.
Off - Set as soon as the SWEP is holstered.
It’s usually a good idea to make a prop_dynamic entity in place of the player when the pill is active. So setting the state to On will do two basic things: make the player invisible, and create the prop_dynamic. It will need to have a model and be parented and have matching position/angles too, but that’s pretty self-explanatory.
Then what you’ll need to do is look at what the player is doing and set the prop_dynamic’s animations accordingly. Walking, running, jumping, swimming, attacking, and idle are the main things to check for. Then you can add the code for when you attack in the SWEP’s PrimaryAttack and SecondaryAttack functions.
When setting the state to off you’ll need to make the player visible again, remove the prop_dynamic, and reset any other player values you changed.
The rest is all dependent on the pill you’re making. You may need to adjust the speed and jump power of the player. You may need to add some extra entities/effects for the attacking methods. At that point it’s about having the knowledge and creativity for it.
[editline]18th February 2011[/editline]
Oh, and a CalcView hook or camera entity so it can be in third person view.