Raised This Month: $ Target: $400
 0% 

[L4D2] Primary Weapon Low Reserve Automatic Regeneration v1.11.2 【2022-08-04】


Post New Thread Reply   
 
Thread Tools Display Modes
Author
little_froy
Senior Member
Join Date: May 2021
Plugin ID:
7961
Plugin Version:
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Old 02-10-2022 , 07:10   [L4D2] Primary Weapon Low Reserve Automatic Regeneration v1.11.2 【2022-08-04】
    Reply With Quote #1

    Description
    • Automatic regenerate reserve ammo of primary weapon, when sum of clip and ammo is lower than a value.
    • Press "reload" button to trigger regeneration.
    • Customizable for each weapon.

    Cvars
    PHP Code:
    // set to none-zero to enable debug(press IN_SPEED to clear primary weapon clip and ammo of everyone)
    // -
    // Default: "0"
    automatic_reserve_ammo_regeneration_debug "0"

    // set to none-zero to instantly regenerate ammo
    // -
    // Default: "0"
    automatic_reserve_ammo_regeneration_instantly "0" 
    Commands
    • all commands promise required ADMFLAG_RESERVATION.

      sm_arar_flush
      :flush to the original config data file.

      sm_arar_reload
      :load config data from file.

      sm_arar_list
      :show list of config of each weapon.

      sm_arar_query
      :show config of single weapon.

      sm_arar_change
      :add/change config of single weapon.

      sm_arar_remove
      :remove config of single weapon.

    Original configs

    a config data named "automatic_reserve_ammo_regeneration_weapons. cfg" will automatic spawn at sourcemod/data/.

    Spoiler


    Change log
    Spoiler
    Attached Files
    File Type: sp Get Plugin or Get Source (automatic_reserve_ammo_regeneration.sp - 0 views - 15.0 KB)

    Last edited by little_froy; 08-07-2022 at 16:13.
    little_froy is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 02-10-2022 , 14:32   Re: [L4D2] Primary Weapon Low Backup Ammo Automatic Regeneration v1.9.2 【2022-02-10】
    Reply With Quote #2

    PHP Code:
            int charger GetEntPropEnt(clientProp_Send"m_pummelAttacker");
            
    int charger2 GetEntPropEnt(clientProp_Send"m_carryAttacker");
            
    int hunter GetEntPropEnt(clientProp_Send"m_pounceAttacker");
            
    int joackey GetEntPropEnt(clientProp_Send"m_jockeyAttacker");
            return 
    charger || charger2 || hunter || joackey 0
    It's inefficient to pull all these values and then check them. Instead pull 1 and check etc. Also "joackey" should be "jockey".

    In "OnPlayerRunCmd" you pull data from the "G_kv" keyvalue... keyvalues are slow, I think it would be faster to pull the data into an Enum Struct on plugin start or something and query that. Especially considering that "OnPlayerRunCmd" runs for EVERY client connected many times per second.
    __________________

    Last edited by Silvers; 02-10-2022 at 14:32.
    Silvers 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 14:48.


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