AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D1 & L4D2] Laser that never sucks (useful upgrades) (https://forums.alliedmods.net/showthread.php?t=314305)

Dragokas 02-12-2019 20:27

[L4D1 & L4D2] Laser that never sucks (useful upgrades)
 
Author:
Figa (fork by Dragokas)
Description:
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


Translations:
- English
- Russian
- Spanish
Credits:
- 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
Download is here.

Plugin is abandoned.

Dragokas 03-05-2019 00:48

Re: [L4D1] Laser that never sucks (useful upgrades)
 
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

BlackSabbarh 03-05-2019 12:45

Re: [L4D1] Laser that never sucks (useful upgrades)
 
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

Dragokas 03-05-2019 15:21

Re: [L4D1] Laser that never sucks (useful upgrades)
 
Is it a question?
Look how it is done in "Mutant zombies" plugin.

Dragokas 03-11-2019 04:13

Re: [L4D1] Laser that never sucks (useful upgrades)
 
1.5 (07-Mar-2019)
Added additional delay before activation the laser because sometimes player's netprops have no time to init.

Dragokas 03-22-2019 13:57

Re: [L4D1] Laser that never sucks (useful upgrades)
 
Anybody know, why that crash can happen? https://forums.alliedmods.net/showthread.php?t=315101

Alexmy 03-22-2019 16:02

Re: [L4D1] Laser that never sucks (useful upgrades)
 
Why do you check real players?
PHP Code:

public Action round_end(Event event, const char[] namebool dontBroadcast)
{
    for(
int i=1i<=MaxClientsi++)
    {
        if(
IsClientInGame(i) && !IsFakeClient(i)) DisableAllUpgrades(i);
    }


Only need a check on the game and everything.Further did not begin to look.

Dragokas 03-22-2019 18:31

Re: [L4D1] Laser that never sucks (useful upgrades)
 
Bots doesn't need upgrades.

Silvers 03-22-2019 18:43

Re: [L4D1] Laser that never sucks (useful upgrades)
 
Quote:

Originally Posted by Dragokas (Post 2644494)
Bots doesn't need upgrades.

What if someone uses upgrade and disconnects/AFK.. the bot carries the upgrades or not?

Dragokas 03-22-2019 19:06

Re: [L4D1] Laser that never sucks (useful upgrades)
 
Actually, I missed that. I even didn't think about that. Possibly, bot cares the upgrade. I have to check.
Thanks, SilverShot and Alexmy.


All times are GMT -4. The time now is 21:40.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.