Called when a player switches their weapon.
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.
The weapon the player switched to. Will be NULL if the player is switching to nothing.
This can be NULL on the client if the weapon hasn't been created over the network yet.
Issue Tracker: #2922
The players weapon information will be printed when the player switched weapons.
function GM:PlayerSwitchWeapon(ply, oldWeapon, newWeapon) //GetClass() will return the weapons class as a string. MsgN("You switched weapons! Your old weapon is " .. oldWeapon:GetClass() ..".") MsgN("Your new weapon is " .. newWeapon:GetClass() .. "."); end
You switched weapons! Your old weapon is gmod_camera. Your new weapon is weapon_crossbow.