Another neat thing you can do is make the gun fire like another gun. Not the same speed but the same onFire function.
For example:
function GunImage::onFire(%t,%o,%s){ShotgunImage::onFire(%t,%o,%s);}
This will cause the gun to shoot like the shotgun, combine that with
GunImage.projectile = spearprojectile;
The gun will now shotgun out spears.
This doesn't work in all cases. Some people hardcode the projectile into their onfire code. And do be careful, as something like:
function GunImage::onFire(%t,%o,%s){ShotgunImage::onFire(%t,%o,%s);}
then:
function ShotgunImage::onFire(%t,%o,%s){GunImage::onFire(%t,%o,%s);}
will cause an infinite loop, crashing the game, when either of these are fired.
Another warning:
function GunImage::onFire(%t,%o,%s){GunImage::onFire(%t,%o,%s);}
Will not fix the gun. This will just cause another infinite loop.
exec("add-ons/weapon_gun/server.cs");
This will fix it. Just be sure not to exec things you didn't already enable. Could cause other players to crash.