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

[L4D2] Charger Teleport Infinite CD fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author
luncheater
New Member
Join Date: Sep 2023
Plugin ID:
8553
Plugin Version:
Plugin Category:
All
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Fixes a bug especially seen in custom servers where while charging and pressing E to teleport causes infinite CD for next charge
    Old 09-28-2023 , 07:29   [L4D2] Charger Teleport Infinite CD fix
    Reply With Quote #1

    I have a server which has custom settings/plugins such as faster charging speed and I noticed while charging and pressing E (the prompt that tells you that you are too far away from survivors and can teleport to them as a ghost), the next charge will have infinite cooldown and can't charge.

    I don't know the exact cause of this bug but I have noticed it in my custom server and also a few other custom servers, and I haven't found any plugin relating to this.

    This plugin simply detects when a Charger is in the charging state and is able to press E to spawn to a random Survivor as a ghost, and then sets the cooldown to the value of convar z_charge_interval.

    This is my first plugin released, any feedback is appreciated
    Attached Files
    File Type: smx fixchargerteleportcooldownbug.smx (5.3 KB, 52 views)
    File Type: sp Get Plugin or Get Source (fixchargerteleportcooldownbug.sp - 57 views - 1.7 KB)

    Last edited by luncheater; 09-28-2023 at 07:39.
    luncheater is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 09-28-2023 , 08:06   Re: [L4D2] Charger Teleport Infinite CD fix
    Reply With Quote #2

    - You should note this requires left4dhooks plugin.
    - Should reset b_IsCharging in round_end event and OnMapEnd, otherwise it can be stuck set as true.
    - GetEntData(client, tooFarCanTeleport, 1) can probably be replaced with: GetEntProp(client, Prop_Send, "m_isCulling", 1) and then no need for FindSendPropInfo.
    - You could just call the GetEntProp instead of putting into a new function IsPlayerAbleToTeleport just for that 1 call.
    - The use of return Plugin_Handled seems wrong, I would that entire else statement.
    - You're also mixing new and old syntax.
    - You could copy the stocks from left4dhooks to not require the dependency, since you're only using the stocks and not any natives or forwards.

    Other than that, good job on fixing the bug. Thanks! Congrats on your first release!

    Edit: I've uploaded the changes I think should be good. No more left4dhooks requirement.
    Attached Files
    File Type: sp Get Plugin or Get Source (fixchargerteleportcooldownbug.sp - 97 views - 2.1 KB)
    __________________

    Last edited by Silvers; 09-28-2023 at 08:14.
    Silvers is offline
    luncheater
    New Member
    Join Date: Sep 2023
    Old 09-29-2023 , 03:18   Re: [L4D2] Charger Teleport Infinite CD fix
    Reply With Quote #3

    Thanks for the tips and feedback!
    luncheater is offline
    Forgetest
    Member
    Join Date: Aug 2020
    Old 09-29-2023 , 15:47   Re: [L4D2] Charger Teleport Infinite CD fix
    Reply With Quote #4

    The only possible cause of this in vanilla is that someone gets charged near obstacles and dies before the charger starts pounding. A hint for you if any chance you're still interested in improvements.
    Forgetest 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 17:37.


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