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

[L4D2] Unlimited Chainsaw


Post New Thread Reply   
 
Thread Tools Display Modes
Author
bullet28
Member
Join Date: Apr 2012
Plugin ID:
6989
Plugin Version:
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Chainsaw fuel always at 100%
    Old 03-17-2020 , 14:37   [L4D2] Unlimited Chainsaw
    Reply With Quote #1

    Why?
    From my experience, the chainsaw is one of the least popular weapons in-game.
    In terms of weapon balance there is no reason for use-time (fuel) limitaion.

    No cvars.
    Attached Files
    File Type: sp Get Plugin or Get Source (lfd_both_chainsaw.sp - 1816 views - 1.2 KB)
    bullet28 is offline
    Jerry_21
    Member
    Join Date: Jun 2017
    Old 03-17-2020 , 16:37   Re: [L4D2] Unlimited Chainsaw
    Reply With Quote #2

    hello bullet28, first of all excuse me for my english, I use a translator. You have just commented on a good idea that would be why not make chainsaws appear with greater probability on the maps with a cvar that everyone modifies to the probability that this weapon appears between maps. Greetings.
    Jerry_21 is offline
    BloodyBlade
    Senior Member
    Join Date: Feb 2018
    Old 03-30-2024 , 14:35   Re: [L4D2] Unlimited Chainsaw
    Reply With Quote #3

    A shorter version:
    Attached Files
    File Type: sp Get Plugin or Get Source (lfd_both_chainsaw.sp - 14 views - 867 Bytes)

    Last edited by BloodyBlade; 03-31-2024 at 03:49. Reason: Updated based on comment #5
    BloodyBlade is offline
    little_froy
    Senior Member
    Join Date: May 2021
    Old 03-30-2024 , 14:37   Re: [L4D2] Unlimited Chainsaw
    Reply With Quote #4

    Quote:
    Originally Posted by BloodyBlade View Post
    A shorter version:
    it's not safe, you didn't check is the return value GetPlayerWeaponSlot(client, 1)valid and is a chainsaw.

    Last edited by little_froy; 03-30-2024 at 14:41.
    little_froy is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 03-30-2024 , 14:56   Re: [L4D2] Unlimited Chainsaw
    Reply With Quote #5

    char classname[32];

    could be

    char classname[16];

    since the classname itself is 15 chars long, no need for excessive bytes being nulled

    and to optimize further make it "static char".

    @BloodyBlade: checking if (event.GetInt("weaponid") == 20) { would optimize it further, just because it's shorter code doesn't make it more efficient.

    weapon_fire event is triggered constantly when holding down the fire button, so should be optimized as best as possible to prevent unnecessary checks.
    __________________
    Silvers is offline
    BloodyBlade
    Senior Member
    Join Date: Feb 2018
    Old 03-31-2024 , 03:45   Re: [L4D2] Unlimited Chainsaw
    Reply With Quote #6

    Quote:
    Originally Posted by little_froy View Post
    it's not safe, you didn't check is the return value GetPlayerWeaponSlot(client, 1)valid and is a chainsaw.
    If StrEqual(classname, "weapon_chainsaw") returns that the firing weapon is a chainsaw, then GetPlayerWeaponSlot(client, 1) returns a valid value. I have never received an error message with this code.
    BloodyBlade is offline
    BloodyBlade
    Senior Member
    Join Date: Feb 2018
    Old 03-31-2024 , 03:48   Re: [L4D2] Unlimited Chainsaw
    Reply With Quote #7

    Quote:
    Originally Posted by Silvers View Post
    char classname[32];

    could be

    char classname[16];

    since the classname itself is 15 chars long, no need for excessive bytes being nulled

    and to optimize further make it "static char".

    @BloodyBlade: checking if (event.GetInt("weaponid") == 20) { would optimize it further, just because it's shorter code doesn't make it more efficient.

    weapon_fire event is triggered constantly when holding down the fire button, so should be optimized as best as possible to prevent unnecessary checks.
    Updated based on your comment.
    BloodyBlade is offline
    little_froy
    Senior Member
    Join Date: May 2021
    Old 03-31-2024 , 09:13   Re: [L4D2] Unlimited Chainsaw
    Reply With Quote #8

    Quote:
    Originally Posted by BloodyBlade View Post
    If StrEqual(classname, "weapon_chainsaw") returns that the firing weapon is a chainsaw, then GetPlayerWeaponSlot(client, 1) returns a valid value. I have never received an error message with this code.
    weapon in which slot can be modified by addons, for example it can be in slot 0. and, other plugin can call api such as "SDKHooks_DropWeapon" to change current active weapon if the event hook earlier than you plugins.
    extreme situations should be considered.

    Last edited by little_froy; 03-31-2024 at 09:20.
    little_froy is offline
    BloodyBlade
    Senior Member
    Join Date: Feb 2018
    Old 04-01-2024 , 15:17   Re: [L4D2] Unlimited Chainsaw
    Reply With Quote #9

    Quote:
    Originally Posted by little_froy View Post
    weapon in which slot can be modified by addons, for example it can be in slot 0. and, other plugin can call api such as "SDKHooks_DropWeapon" to change current active weapon if the event hook earlier than you plugins.
    extreme situations should be considered.
    I highly doubt that the player will decide to drop the weapon while cutting zombies.
    If I see at least one error, I will change the code.
    BloodyBlade 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 12:16.


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