These are 4 upgrades any client can manually enable/disable at any time:
- Laser Sight
- Night Vision
- Silencer (L4D1 only)
- Fast Reload (L4D1 only)
All upgrades are made permanently per-client, not per-weapon (and saved to cookies, loaded on client re-join).
Why one more plugin?
- Most plugins for laser in L4D1 cause clients to crash on some servers. This fork uses SDK-method that works fine all the time.
Restrictions:
- for L4D2 only Laser & Night Vision are available at the moment.
- for L4D2 it is impossible to remove crosshair due to the protected client-side command "crosshair 0". I also tried to change the different hud properties of the client, but they don't have the desired effect.
Specific:
- Plugin is blocking perk sound automatically when you equip the upgrade.
- atm, plugin cannot block the secondary sound (in L4D2) and game hint (on-screen message and sound) (L4D2) when you equip/re-equip weapon with upgrade. Need help.
Commands:
sm_laser - Toggle Laser Sight
sm_laseron - Turn on the laser
sm_laseroff - Turn off the laser
sm_night - Toggle Night Vision
sm_silent - Toggle Silencer (L4D1 only)
sm_silencer - same
sm_reload - Toggle Fast Reload (L4D1 only)
Settings (ConVars):
- cfg/sourcemod/l4d_useful_upgrades.cfg:
l4d_enable_silencer - def.: 1 - Enable Toggle Silencer Upgrade; 0 - Disable This Upgrade
l4d_enable_laser_sight - def.: 1 - Enable Toggle Laser Sight Upgrade; 0 - Disable This Upgrade
l4d_enable_night_vision - def.: 1 - Enable Toggle Night Vision Upgrade; 0 - Disable This Upgrade
l4d_enable_fast_reload - def.: 1 - Enable Toggle Fast Reload Upgrade; 0 - Disable This Upgrade
l4d_force_spawn_silencer - def.: 0 - Force Silencer Upgrade on spawn (0 - No, 1 - Yes)
l4d_force_spawn_laser_sight - def.: 0 - Force Laser Sight Upgrade on spawn (0 - No, 1 - Yes)
l4d_force_spawn_night_vision - def.: 0 - Force Night Vision Upgrade on spawn (0 - No, 1 - Yes)
l4d_force_spawn_fast_reload - def.: 1 - Force Fast Reload Upgrade on spawn (0 - No, 1 - Yes)
l4d_force_join_silencer - def.: 1 - Force Silencer Upgrade on first join (0 - No, 1 - Yes)
l4d_force_join_laser_sight - def.: 1 - Force Laser Sight Upgrade on first join (0 - No, 1 - Yes)
l4d_force_join_night_vision - def.: 0 - Force Night Vision Upgrade on first join (0 - No, 1 - Yes)
l4d_force_join_fast_reload - def.: 1 - Force Fast Reload Upgrade on first join (0 - No, 1 - Yes)
l4d_upgrades_remove_dropped_laser - def.: 1 - Auto switch off laser on the dropped weapon (0 - No, 1 - Yes) (L4D2 only)
- cfg/server.cfg (L4D1)
sm_cvar survivor_upgrade_reload_shotgun_duration "0.6" // default value - control shotgun reload speed if upgrade is enabled
sm_cvar survivor_upgrade_reload_duration "1" // default value - control other weapons reload animation speed if upgrade is enabled
Natives & Forwards
Spoiler
PHP Code:
forward void OnUpgradeChanged(int iClient, int iUpgrade);
native int UU_GetUpgrades(int iClient);
native int UU_SetUpgrades(int iClient, int iUpgradeBits);
public void UU_AddUpgrade(int iClient, int iUpgradeBits)
public void UU_RemoveUpgrade(int iClient, int iUpgradeBits)
For details, see: include/useful_upgrades.inc file.
- Figa - original author
- Whosat - for SDK-method of laser activation
- AlexMy - helping with crash fix
- SilverShot - helping with crash fix and for patch example
- Krivous Anatolii (The Trick) - resolving Windows crash in NOP patch
- dcx2 - for code to manipulate laser on the weapon in L4D2.
TODO:
- disable annoying instructor hints in L4d2.
- find a method to enable laser for any weapon in L4d2.
Donate
Donates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
- Patreon (Paypal)
- BitCoin
- Ю.Money
Plugin is rewritten on the basis of my alternative fork branch.
Quote:
1.4 (01-Mar-2019)
- Converted to a new syntax and methodmaps
- Added sdk method to enable laser
- Added more reliable managing the cookies
- Added "l4d_useful_upgrades" config file.
- Added "l4d_force_silencer" ConVar to force Silencer Upgrade on spawn
- Added "l4d_force_laser_sight" ConVar to force Laser Sight Upgrade on spawn
- Added "l4d_force_night_vision" ConVar to force Night Vision Upgrade on spawn
- Added "l4d_force_fast_reload" ConVar to force Fast Reload Upgrade on spawn
- Added checking for game requirements (L4D1 only).
1.3 (private)
- Removed laser, because it crash my server
1.2 (based on alternate fork branch)
- Added saving upgrades state to the cookies
- Added some safe checkings
I could create a plugin that uses the night vision but it can be used to decorate an event such as a car alarm or a horde or a spawn tank, activated only when an event happens, or with a timer. would create a good atmosphere