How do i set a weapon type?

If i go to a rp server, after a little my gun will go all over a my screen. I open up my console it says SWEP : SetWeaponType - ActIndex ( ‘’ ‘’ ) and some other things, but my console wont come up unless im in a game, help?

also, tell me if this is a lua error, too if you can