Raised This Month: $32 Target: $400
 8% 

[L4D2] Throwable Melee Weapons (1.21) [05-Jul-2022]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
6916
Plugin Version:
1.21
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    13 
    Plugin Description:
    Allows players to throw melee weapons.
    Old 01-22-2020 , 05:32   [L4D2] Throwable Melee Weapons (1.21) [05-Jul-2022]
    Reply With Quote #1

    Related Plugins:


    About:
    • Allows players to throw melee weapons. Press the Scope / Zoom button to throw (MMB - middle mouse button).
    • Various ways to set damage, depending on weapon type and target.
    • Video demonstration - Thanks to "sonic155" for recording.



    Thanks:
    • Sev - For the request.
    • Ethan Max - For also requesting and reminding me.
    • Lux - Because why not.



    Admin Commands: (requires "z" flag)

    PHP Code:
    sm_throwable_reload // Reloads the weapons damage data config. 


    Cvars:

    Saved to l4d2_throwable_melee.cfg in your servers \cfg\sourcemod\ folder.

    PHP Code:
    // 0=Plugin off, 1=Plugin on.
    l4d2_throwable_allow "1"

    // Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).
    l4d2_throwable_modes ""

    // Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).
    l4d2_throwable_modes_off ""

    // Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.
    l4d2_throwable_modes_tog "0"

    // 0=Off. 1=Notify of usage on first melee equip. 2=Notify on Survivor hit. 4=Notify on Special Infected Death. 8=Notify on Witch and Common Infected death. 16=Print to all, else print to client. Add numbers together.
    l4d2_throwable_notify "7"

    // 0=Off. 1=Changes the thrown melee weapon into a boomerang returning to the thrower when it hits something.
    l4d2_throwable_return "1"

    // Minimum speed. How fast to throw a melee weapon, affects range
    l4d2_throwable_speed "500"

    // Maximum speed. How fast to throw a melee weapon, affects range
    l4d2_throwable_speed_max "1000"

    // 0.0=Off, instant throw. Max time to get max speed. The longer players hold Zoom/Scope (MMB - middle mouse button) the faster they throw.
    l4d2_throwable_speed_time "1.0"

    // 0=Off. 1=Spin top over. 2=Spin sideways. 3=Both randomly selected. Requires gamedata.
    l4d2_throwable_spin "3"

    // Which melee weapons can be thrown: 1=Baseball Bat, 2=Cricket Bat, 4=Crowbar, 8=Frying Pan, 16=Guitar, 32=Fireaxe, 64=Golfclub, 128=Katana, 256=Knife, 512=Machete, 1024=Tonfa, 2048=Shield, 4096=Generic, 8192=Pitchfork, 16384=Shovel, 32767=All. Add numbers together.
    l4d2_throwable_types "32767"

    // 0=Off. 1=Play throw animation in first person view - causes screen tilt bug.
    l4d2_throwable_view "1"

    // Throwable Melee Weapons plugin version.
    l4d2_throwable_version 


    Changes:
    Code:
    1.21 (05-Jul-2022)
        - Fixed melee weapons glowing when equipped by players. Thanks to "BystanderZK" for reporting.
        - Fixed the "l4d2_throwable_types" cvar from following the wrong settings. Thanks to "moschinovac" for reporting.
        - Glow now enables 1 second after throwing to show the melee weapon can be picked up.
        - Thanks to "Marttt" for help testing and fixing.
    
        - Plugin is now compiled with SourceMod 1.11.
    
    1.20 (16-Jun-2022)
        - Added notifications and translations when equipping melee weapons or hitting Survivors or killing Special Infected. Requested by "Voevoda".
        - Added cvar "l4d2_throwable_notify" to control notifications.
        - Added Russian translations, thanks to "Voevoda" for providing.
    
    1.19 (06-Jan-2022)
        - Added each weapon types damage flags for slash and club. Requested by "Shao".
    
    1.18 (01-Nov-2021)
        - Added cvar "l4d2_throwable_view" to enable/disable the throw animation in first person view that causes screen tilt bug.
        - Blocked throwing melee weapons if they that was their only held weapon/item. Thanks to "swiftswing1" for reporting.
        - Blocked throwing melee weapons if pinned or incapacitated.
    
    1.17 (21-Sep-2021)
        - Fixed errors. Thanks to "Sev" for reporting.
    
    1.16 (19-Sep-2021)
        - Fixed potentially blocking throwing on map changes.
    
    1.15 (19-Sep-2021)
        - Now plays a throwing animation. Requested by "Sev".
        - Now removes the weapon glow when thrown (most of the time).
        - Now delays the throw slightly to hide the weapon being frozen when thrown.
    
    1.14 (17-Sep-2021)
        - Fixed 1 line of code blocking unknown (generic) melee weapons from being used. Thanks to "swiftswing1" for reporting.
    
    1.13 (20-Jun-2021)
        - Changed "SDKHook_WeaponSwitchPost" to read the "m_hActiveWeapon" netprop instead of using "weapon" from the callback.
        - When climbing ladders or being pinned "SDKHook_WeaponSwitchPost" returns the wrong weapon.
        - This should fix various issues such as not being able to throw after pinned or throwing after climbing while primary weapon is active.
        - Thanks to "SDArt" for reporting various issues.
    
    1.12 (01-Oct-2020)
        - Fixed not verifying weapon reference and causing errors. Thanks to "SDArt" for reporting.
    
    1.11 (30-Sep-2020)
        - Fixed compile errors on SM 1.11.
        - Fixed being able to throw while using something or climbing ladders.
        - To enable the new melee weapons, change cvar "l4d2_throwable_types" value adding the new ones.
    
    1.10 (24-Sep-2020)
        - Compatibility update for L4D2's "The Last Stand" update.
        - Added support for the 2 new melee weapons.
        - Changed cvar "l4d2_throwable_types" to support the new types.
        - Updated data config "data/l4d2_throwable_melee.cfg" updated with the new Melee weapons.
    
    1.9 (15-May-2020)
        - Replaced "point_hurt" entity with "SDKHooks_TakeDamage" function.
    
    1.8 (10-May-2020)
        - Extra checks to prevent "IsAllowedGameMode" throwing errors.
        - Various changes to tidy up code.
    
    1.7 (01-Apr-2020)
        - Fixed "IsAllowedGameMode" from throwing errors when the "_tog" cvar was changed before MapStart.
    
    1.6 (29-Feb-2020)
        - Fixed throwing the melee weapon after switching weapon and back to melee. Thanks to "moschinovac" for reporting.
    
    1.5 (26-Jan-2020)
        - To fix the Tonfa not working change "l4d2_throwable_types" value to "2047".
    
        - New feature: Throw distance - the longer you hold Zoom before releasing the further you throw. Requested by "MasterMind420".
        - Added cvar "l4d2_throwable_speed_max" to set a maximum throwing speed when holding MMB. Minimum speed set by "l4d2_throwable_speed".
        - Added cvar "l4d2_throwable_speed_time" to scale the throwing speed, how long the key must be held to reach maximum speed when letting go.
        - Changed cvar "l4d2_throwable_types" value to "2047" to include the missing Frying Pan option.
        - Boomerang type now verifies the players weapon slot is empty before equipping.
        - Optimized throwing event CPU cycles by validating weapon in WeaponSwitch.
        - Removed all commented out reference code.
    
    1.4 (25-Jan-2020)
        - Fixed incorrect Linux gamedata signature causing crashing.
        - Fixed the "l4d2_throwable_types" cvar using the wrong index.
        - Fixed the Baseball Bat not working.
        - Fixed the Golfclub not playing any sounds.
        - Fixed the Tank not taking damage.
        - Fixed truncating damage values with 4 numbers to 3.
        - Fixed hitting when the melee is not moving or potentially not always hitting.
        - Fixed hitting yourself.
        - Removed TraceRay.
    
    1.3 (24-Jan-2020)
        - Added cvar "l4d2_throwable_return" to enable a boomerang effect and return the weapon to thrower.
        - Added support for "Riot Shield" melee type and "Generic" - any 3rd party melee weapon.
        - Riot Shield requires extra scripts to enable, I do not support. You're on your own.
        - Data config changed to add the new types.
        - Changed from using max health cvars to reading the entities "m_iMaxHealth" value.
        - Fixed incorrect percentage calculation when using the "hits" damage type.
        - Replaced index numbers with enums for easier source readability.
    
    1.2 (24-Jan-2020)
        - Added TraceRay to hit zombies directly in front of player. Thanks to "Lux" for suggesting.
        - Replaced optional VPhysics extension with gamedata method. Thanks to "BHaType" for suggesting.
        - Cvar "l4d2_throwable_spin" uses this method and requires the optional gamedata file.
        - Fixed damage not crediting the owner.
    
    1.1 (22-Jan-2020)
        - Added correct data config.
        - Changed plugin to point to correct config.
        - Changed plugin to remove VPhysics extension for now, since optional is not working.
    
    1.0 (22-Jan-2019)
        - Initial release.


    Installation:
    1. Download the .zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder.


    Updating from 1.19 or older:
    • New cvars have been added: use the Cvar Configs Updater, or delete the old cvars config or manually add them.


    Updating from 1.19 or older:
    • Optional translations have been added.

    Current Translations: English (en), Russian (ru).
    Attached Files
    File Type: zip l4d2_throwable_melee.zip (35.5 KB, 715 views)
    __________________

    Last edited by Silvers; 07-04-2022 at 23:06.
    Silvers is offline
    login101
    Senior Member
    Join Date: Sep 2017
    Old 01-22-2020 , 06:48   Re: [L4D2] Throwable Melee Weapons (1.0) [22-Jan-2020]
    Reply With Quote #2

    good!!!
    login101 is offline
    login101
    Senior Member
    Join Date: Sep 2017
    Old 01-22-2020 , 07:06   Re: [L4D2] Throwable Melee Weapons (1.0) [22-Jan-2020]
    Reply With Quote #3

    It doesn't work bug?
    login101 is offline
    xZk
    Senior Member
    Join Date: Nov 2017
    Location: cl
    Old 01-22-2020 , 10:51   Re: [L4D2] Throwable Melee Weapons (1.0) [22-Jan-2020]
    Reply With Quote #4

    Nice idea!, but for the moment i think this is only works with the extension VPhysics Extension.
    pd: "l4d_throwable_melee.cfg" is missing
    xZk is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 01-22-2020 , 13:56   Re: [L4D2] Throwable Melee Weapons (1.0) [22-Jan-2020]
    Reply With Quote #5

    Quote:
    Originally Posted by login101 View Post
    good!!!
    Quote:
    Originally Posted by login101 View Post
    It doesn't work bug?
    Please use edit button instead of spamming threads with replies.

    Quote:
    Originally Posted by xZk View Post
    Nice idea!, but for the moment i think this is only works with the extension VPhysics Extension.
    pd: "l4d_throwable_melee.cfg" is missing
    Oops yeah uploaded correct config, removed VPhysics for now because nothing I try makes it optional or work.
    __________________
    Silvers is offline
    BHaType
    Great Tester of Whatever
    Join Date: Jun 2018
    Old 01-22-2020 , 21:01   Re: [L4D2] Throwable Melee Weapons (1.1) [22-Jan-2020]
    Reply With Quote #6

    You can use signature to change angular velocity (melee spin)

    PHP Code:
    CBaseEntity::ApplyLocalAngularVelocityImpulse(CBaseEntity *this, const Vector *)
    @
    _ZN11CBaseEntity32ApplyLocalAngularVelocityImpulseERK6Vector 
    __________________
    cry
    BHaType is offline
    Send a message via AIM to BHaType
    AK978
    Senior Member
    Join Date: Jun 2018
    Old 01-22-2020 , 22:07   Re: [L4D2] Throwable Melee Weapons (1.1) [22-Jan-2020]
    Reply With Quote #7

    Need to perform configuration to start?
    Weapon does not spin on attack.
    Is it possible to strengthen offensive capabilities?
    Whether to kill all zombies on the attack line.

    Last edited by AK978; 01-22-2020 at 22:09.
    AK978 is offline
    Spirit_12
    Veteran Member
    Join Date: Dec 2012
    Location: Toronto, CA
    Old 01-22-2020 , 22:59   Re: [L4D2] Throwable Melee Weapons (1.1) [22-Jan-2020]
    Reply With Quote #8

    Quote:
    Originally Posted by Silvers View Post
    Cvars:

    Saved to l4d_tongue_damage.cfg in your servers \cfg\sourcemod\ folder.
    PHP Code:
    AutoExecConfig(true,                "l4d2_throwable_melee"); 
    Kids this is why you shouldn't drink when you are scripting plugins.
    __________________
    Spirit_12 is offline
    mathilde
    Member
    Join Date: Jan 2020
    Location: samedi et dimanche
    Old 01-23-2020 , 07:23   Re: [L4D2] Throwable Melee Weapons (1.1) [22-Jan-2020]
    Reply With Quote #9

    Can I throw the shield? Cuz it's crap in game
    (Edit: Throwable shields that decapitate.)

    Last edited by mathilde; 01-23-2020 at 07:26.
    mathilde is offline
    Ruthless1
    AlliedModders Donor
    Join Date: Oct 2019
    Old 01-23-2020 , 09:04   Re: [L4D2] Throwable Melee Weapons (1.1) [22-Jan-2020]
    Reply With Quote #10

    Is there a possibility for the melee to automatically return back to the player after a short time after it had been thrown? Like a boomerang.
    Ruthless1 is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 19:43.


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