Raised This Month: $51 Target: $400
 12% 

[CS:GO] Edict Limiter (Prevent "no free edicts")


Post New Thread Reply   
 
Thread Tools Display Modes
Author
poggu
Junior Member
Join Date: Dec 2021
Plugin ID:
8332
Plugin Version:
2.0.0
Plugin Category:
Technical/Development
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Prevent "ED_Alloc: no free edicts" crash
    Old 12-21-2022 , 15:45   [CS:GO] Edict Limiter (Prevent "no free edicts")
    Reply With Quote #1

    Edict Limiter

    This plugin prevents the server from crashing because of no remaining free edicts, crash known as "ED_Alloc: no free edicts".
    When there's more edicts than ed_lowedict_threshold allows no further entities will be allowed to be created unless the edict count goes below such threshold.

    Note
    When there are no left edicts (2048 max) the plugins prevents the creation of any new entities.
    Improperly coded plugins will start throwing errors, as they won't check whether their newly created entity was actually created, I do not take any responsibility for such errors.

    Forwards

    PHP Code:
    forward void OnEntityLockdown(); // Fired when an edict limit is reached, only once per round. Use this to cleanup less useful entities. 
    Natives

    PHP Code:
    native int GetEdictCount(); // Returns current count of edicts, edicts are stored in a variable and changed in realtime. There should be no performance hit calling this native 
    ConVars

    PHP Code:
    ed_lowedict_action "1"
    // 0 - no action
    // 1 - only prevent entity spawns
    // 2 - attempt to restart the game, if applicable
    // 3 - restart the map
    // 4 - go to the next map in the map cycle
    // 5 - spew all edicts.

    ed_lowedict_threshold "8"
    // When only this many edicts are free, take the action specified by sv_lowedict_action. (0 - 1920)

    ed_lowedict_block_threshold "8"
    // When only this many edicts are free, prevent entity spawns. (0 - 1920)
    // Ideally keep the same as ed_lowedict_threshold
    // 0 Disables entity spawn prevention, rather than allowing 0 free edicts and keeping the server on thin ice

    ed_announce_once "1"
    // Whether OnEntityLockdown gets called only once per round, if false every attempt of spawning an entity over the limit will fire the forward 
    Commands
    PHP Code:
    sm_edictcount
    // ROOT ONLY
    // Shows current amount of free edicts
    // Example: GetEntityCount: 1974 | Used edicts: 1625 | Used edicts (Precise, expensive): 1625

    sm_spewedicts
    // ROOT ONLY
    // Dumps edict usage in server/client console
    // Example:
    // (Percent)       Count   Classname (Sorted by count)
    // -------------------------------------------------
    // (63.98%)        1043    prop_dynamic
    // (5.09%)         83      ambient_generic
    // ... 
    Requirements
    Attached Files
    File Type: zip EdictLimiter.zip (13.3 KB, 246 views)

    Last edited by poggu; 12-22-2022 at 07:56.
    poggu is offline
    eyal282
    Veteran Member
    Join Date: Aug 2011
    Old 12-22-2022 , 04:15   Re: [CS:GO] Edict Limiter (Prevent "no free edicts")
    Reply With Quote #2

    Hello, I have a RolePlay plugin that has droppable money. I think a solution to the ability to delete entities at a lower limit could benefit, so if the edict limit is being approached a bit too hard, I can delete on-ground money, and give it to the closest player.
    __________________
    I am available to make plugins for pay.

    Discord: Eyal282#1334
    eyal282 is offline
    Bacardi
    Veteran Member
    Join Date: Jan 2010
    Location: mom's basement
    Old 12-22-2022 , 04:58   Re: [CS:GO] Edict Limiter (Prevent "no free edicts")
    Reply With Quote #3

    OrangeBox games like TF2, CS:S, DOD:S etc. etc. have this
    sv_lowedict_action, sv_lowedict_threshold
    Code:
    "sv_lowedict_action" = "0" min. 0.000000 max. 5.000000
    FCVAR_NONE
    - 0 - no action, 1 - warn to log file, 2 - attempt to restart the game, if applicable, 3 - restart the map, 4 - go to the next map in the map cycle, 5 - spew all edicts.
    
    "sv_lowedict_threshold" = "8" min. 0.000000 max. 2048.000000
    FCVAR_NONE
    - When only this many edicts are free, take the action specified by sv_lowedict_action.
    Maybe you could add these kind features.
    __________________
    Do not Private Message @me
    Bacardi is offline
    poggu
    Junior Member
    Join Date: Dec 2021
    Old 12-22-2022 , 06:47   Re: [CS:GO] Edict Limiter (Prevent "no free edicts")
    Reply With Quote #4

    Quote:
    Originally Posted by Bacardi View Post
    OrangeBox games like TF2, CS:S, DOD:S etc. etc. have this
    sv_lowedict_action, sv_lowedict_threshold
    Code:
    "sv_lowedict_action" = "0" min. 0.000000 max. 5.000000
    FCVAR_NONE
    - 0 - no action, 1 - warn to log file, 2 - attempt to restart the game, if applicable, 3 - restart the map, 4 - go to the next map in the map cycle, 5 - spew all edicts.
    
    "sv_lowedict_threshold" = "8" min. 0.000000 max. 2048.000000
    FCVAR_NONE
    - When only this many edicts are free, take the action specified by sv_lowedict_action.
    Maybe you could add these kind features.
    working on it

    Last edited by poggu; 12-22-2022 at 06:47.
    poggu is offline
    poggu
    Junior Member
    Join Date: Dec 2021
    Old 12-22-2022 , 07:34   Re: [CS:GO] Edict Limiter (Prevent "no free edicts")
    Reply With Quote #5

    Added ed_lowedict_action, ed_lowedict_threshold, ed_lowedict_block_threshold, ed_announce_once as requested by Bacardi.
    poggu is offline
    ericek111
    New Member
    Join Date: Dec 2018
    Old 09-24-2023 , 12:02   Re: [CS:GO] Edict Limiter (Prevent "no free edicts")
    Reply With Quote #6

    New signature for CEntityFactoryDictionary::Create for Linux:

    \x55\x89\xE5\x53\x83\xEC\x0C\x8B\x45\x08\x8B\ x5D\x0C\x8B\x10\x53\x50\xFF\x52\x0C\x83\xC4\x 10\x85\xC0

    You need to replace the one in gamedata/edict_limiter.txt, otherwise the plugin doesn't load.
    ericek111 is offline
    Reply



    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 18:38.


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