View Single Post
Author Message
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 04-01-2010 , 13:33   [CSS] Weapon Mod
Reply With Quote #1

Requires SourceMod 1.5 or later

Note: This is for CSS not CSGO, i don't support CSGO so any replies asking for help with CSGO will be ignored

Description
Allows you to modify weapon recoil, fire rate, inaccuracy spread and damage to hitgroups via multipliers. You can also add a fully automatic mode to pistols, add a burst mode to smgs, enable infinite ammo and enable quick switch. There are some issues with client prediction noted below.

Server Command, Cvar and Menu
weaponmod <weapon> <attribute> <value>

e.g weaponmod ak47 recoil 2, this would double the ak47's recoil

this command can be typed into server console, used via rcon or added into config files.

if you make any mistakes you will get a message in the console (client console if rcon is used else server console).

Attributes and Values
RecoilType1/RecoilType2 -- min 0.0 - max 10.0 - multiplier - default 1.0 -- Modifies a weapons recoil, 0.0 gives no recoil. recoil is also capped not to go above 90 degrees.
FireRate -- min 0.0 - max 10.0 - value - default -1.0 -- Modifies a weapons fire rate, value is in seconds, 0.0 will set the fire rate to maximum possible.
HeadDamage -- min 0.0 - max 1000.0 - multiplier - default 1.0 -- Modifies damage done to the head hitgroup. 0.0 stops the damage.
TorsoDamage -- min 0.0 - max 1000.0 - multiplier - default 1.0 -- Modifies damage done to the chest nan stomach hitgroups. 0.0 stops the damage.
LimbDamage -- min 0.0 - max 1000.0 - multiplier - default 1.0 -- Modifies damage done to both arm and both leg hitgroups. 0.0 stops the damage.
GenericDamage -- min 0.0 - max 1000.0 - multiplier - default 1.0 -- Modifies damage done to the generic hitgroup. 0.0 stops the damage. This hitgroup is used by knife, grenade explosion and flashbang/smoke projectile physics damage.
InfiniteAmmo -- min 0 - max 1 - value - default 0 -- Enables infinite ammo. Also works for all projectile weapons.
QuickSwitch -- min 0 - max 1 - value - default 0 -- Enables quick switch. This allows you to use your weapon immediately after switching to it instead of waiting for the deploy animation to end.
RagdollForce -- min 5.0 - max 10000.0 - multiplier - default 5.0 -- Modify force applied to ragdolls(player bodies).
StandSpread -- min 0.0 - max 1.0 - value - default -1.0 -- Modify the inaccuracy spread when standing, 0.0 will use base spread not no spread.
MoveSpread -- min 0.0 - max 1.0 - value - default -1.0 -- Modify the inaccuracy spread when moving, 0.0 will use base spread not no spread.
CrouchSpread -- min 0.0 - max 1.0 - value - default -1.0 -- Modify the inaccuracy spread when crouching, 0.0 will use base spread not no spread.
MiscSpread -- min 0.0 - max 1.0 - value - default -1.0 -- Modify the inaccuracy spread when jumping, swimming, on ladders and anything else. 0.0 will use base spread not no spread.
AutoMode -- min 0 - max 1 - value - default 0 -- Only available on pistols. Usp and glock will lose their default secondary modes.
BurstMode -- min 0 - max 1 - value - default 0 -- Enables burst mode. Only available on smgs.
ModeFireRate -- min 0.0 - max 10.0 - value - default -1.0 -- Modifies a pistols auto mode fire rate and burst modes delay between bursts, value is in seconds 0.0 will set the fire rate to maximum possible.

Setting a value of -1.0 will disable the attribute.

Weapons and Valid Attributes
check out the attached image below.

Cvar
weaponmod_disablenotifications - 0 show all notifications (default), 1 disable weapon equip notifications, 2 disable weapon menu.
This cvar is bitwise so if you want to remove multiple notifications just add their values together e.g 3(1+2) will remove all.

Menu
In chat/teamchat type !weaponmod for a menu that shows you each weapons settings.

Clientside Prediction Issues
Recoil
-- When you use 0.0 for no recoil clients will still see a small amount of recoil but all shots will travel with no recoil.
-- Smgs, machinegun and rifles (not including snipers) have a capped recoil compared to other weapons. modifying recoil will cause the clients view to flicker between the capped recoil and the modified recoil.
Fire Rate
-- Setting the fire rate really high will result in clients not seeing all the bullet decals or hearing all the weapon fire sounds.
Secondary Modes
-- Auto and burst mode using a high fire rate will have the same issue as above.
Quick Switch
-- Clients viewmodel may begin to play the deploy animation, they can still use the weapon immediately though.

All these issues can be fixed by using sv_client_predict 0 but this will cause other issues.
These issues only affect clients when using their own weapons i.e you see others firing weapons fine. The higher the clients ping the worse the mentioned effects are.

Changelog
1.8
-- Some minor changes to fix console errors (make sure you also have sm 1.5).

1.7
-- Combined arms and leg damage strributes into limb damage.
-- Combines the chest and stomach damage attributes into torso damage.
-- Removed run speed attribute as i doubt its going to be fixed.
-- Removed chat notifications when an attribute is changed and modified the cvar.
-- Added RagdollForce attribute check out the attribute and values section above.
-- Added StandSpread atrribute check out the attribute and values section above.
-- Added MoveSpread atrribute check out the attribute and values section above.
-- Added CrouchSpread atrribute check out the attribute and values section above.
-- Added MiscSpread atrribute check out the attribute and values section above.
-- Various optimisations to try and improve performance further.
-- Added a check to stop spam in console for invalid indexes.
-- You can give glock recoil by setting the recoil modifier to a value other than -1.0
-- Changed the way ModeFireRate works, it is now the delay between each burst rather than each shot in the burst.
-- ModeFireRate works on glock and famas burstmodes.


1.6
-- SM 1.4 is now needed, changed some code to use newer features.
-- Added the ability to block the menu via the cvar, see above.

1.5
-- Uncommented runspeed code even though it still doesn't work, who knows when it will be fixed, i may not be around then.
-- Added a menu to show weapon settings see above.
-- Added a modefirerate attribute to change fire rate for burst and automatic modes see above.
-- Added a cvar to disable notifications see above.

1.4
-- Commented out runspeed code to avoid crash problems.

1.3
-- Fixed usp/m4a1 always showing silencer when quickswitching even if you don't have it on.
-- Moved code around to make it a bit easier to read.

1.2
-- Added a new quickswitch attribute, check out the attribute and values section above.

1.1
-- Fixed error when pressing attack with no weapon.
-- Fixed float issue when printing value changes to chat.

1.0
-- Initial release.
Attached Thumbnails
Click image for larger version

Name:	weaponmod.jpg
Views:	3605
Size:	95.1 KB
ID:	110992  
Attached Files
File Type: sp Get Plugin or Get Source (weaponmod.sp - 5947 views - 62.7 KB)
File Type: smx weaponmod.smx (22.9 KB, 2002 views)

Last edited by blodia; 09-29-2013 at 17:38.
blodia is offline