For list of callbacks, see WEAPON Hooks
While some of the fields may be serverside or clientside only, it is recommended to provide them on both so addons could use their values.
Entity class name of the SWEP (file or folder name of your SWEP). This is set automatically
(Clientside) Category the SWEP is in
Whether this SWEP should be displayed in the Spawnemnu menu
Whether or not only admins can spawn the SWEP from their Spawnmenu menu
Nice name of the SWEP
Default: "Scripted Weapon"
The base weapon to derive from. This must be a Lua weapon
Multiplier of deploy speed
This is equivalent to
self in SWEP functions. This only exists for legacy code.
(Clientside) The author of the SWEP to be shown in weapon selection
Default: " "
(Clientside) The contacts of the SWEP creator to be shown in weapon selection
Default: " "
(Clientside) The purpose of the SWEP creator to be shown in weapon selection
Default: " "
(Clientside) How to use your weapon, to be shown in weapon selection
Default: " "
Path to the view model for your SWEP (what the wielder will see)
(Clientside) Should we flip the view model? This is needed for some CS:S view models
(Clientside) Same as ViewModelFlip, but for the second viewmodel
(Clientside) Same as ViewModelFlip, but for the third viewmodel
(Clientside) The angle of FOV used for the view model (Half-Life value is
90; Half-Life 2 is
54; Counter-Strike: Source is
74; Day of Defeat: Source is
The world model for your SWEP (what you will see in other players hands)
(Serverside) Whether this weapon can be autoswitched away from when the player runs out of ammo in this weapon or picks up another weapon or ammo
(Serverside) Whether this weapon can be autoswitched to when the player runs out of ammo in their current weapon or they pick this weapon up
(Serverside) Determines the priority of the weapon when autoswitching. The weapon being autoswitched from will attempt to switch to a weapon with the same weight that has ammo, but if none exists, it will prioritise higher weight weapons.
(Clientside) The scale of the viewmodel bob (viewmodel movement from left to right when walking around)
(Clientside) The scale of the viewmodel sway (viewmodel position lerp when looking around).
(Clientside) Should the weapon icon bounce in weapon selection?
(Clientside) Should draw the weapon selection info box, containing SWEP.Instructions, etc.
(Clientside) Should we draw the default HL2 ammo counter?
(Clientside) Should we draw the default crosshair?
(Clientside) The SWEP render group, see Enums/RENDERGROUP
Slot in the weapon selection menu, starts with
Position in the slot, should be in the range
(Clientside) Internal variable for drawing the info box in weapon selection
Default: surface.GetTextureID( 'gui/speech_lid' )
(Clientside) Should we use Counter-Strike muzzle flashes upon firing? This is required for DoD:S or CS:S view models to fix their muzzle flashes.
(Clientside) Use the X shape muzzle flash instead of the default Counter-Strike muzzle flash. Requires CSMuzzleFlashes to be set to true
Primary attack settings. The table contains these fields:
- string Ammo - Ammo type ("Pistol", "SMG1" etc)
- number ClipSize - The maximum amount of bullets one clip can hold. Setting it to
-1means weapon uses no clips, like a grenade or a rocket launch.
- number DefaultClip - Default ammo in the clip, making it higher than ClipSize will give player additional ammo on spawn
- boolean Automatic - If true makes the weapon shoot automatically as long as the player has primary attack button held down
Secondary attack settings, has same fields as Primary attack settings
(Clientside) Makes the player models hands bonemerged onto the view model
The folder from where the weapon was loaded. This should always be "weapons/weapon_myweapon", regardless whether your SWEP is stored as a file, or multiple files in a folder. It is set automatically on load
(Clientside) Makes the default SWEP crosshair be positioned in 3D space where your aim actually is (like on Jeep), instead of simply sitting in the middle of the screen at all times
Disable the ability for players to duplicate this SWEP
(Clientside) Sets the spawnmenu content icon type for the entity, used by spawnmenu in the Sandbox-derived gamemodes. See spawnmenu.AddContentType for more information.
If set to false, the weapon will not play the weapon pick up sound when picked up.
(Clientside)If set, overrides the icon path to be displayed in the Spawnmenu for this entity.