Raised This Month: $ Target: $400
 0% 

[L4D & L4D2] Late Model Precacher


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Plugin ID:
8026
Plugin Version:
1.0
Plugin Category:
Technical/Development
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    1198 
    Plugin Description:
    Catches unprecached models and tries to precache them to prevent crashes.
    Old 04-11-2022 , 17:32   [L4D & L4D2] Late Model Precacher
    Reply With Quote #1



    Rate this plugin

    Donate to Motivate

    Late Model Precacher

    Table of contents
    About

    Catches unprecached models and tries to precache them to prevent crashes.

    This plugin addresses the rare occurrence of a well-known UTIL_SetModel crash that has existed for as long as both L4D games have been around. The crash can occur even on completely vanilla servers, but can occur more frequently on modded servers that run plugins utilizing models.

    If a model cannot be precached, this plugin will block UTIL_SetModel and the entity will (probably) just be invisible or be a giant ERROR sign.

    Disclaimer: This plugin only helps prevent crashes related to unprecached models (UTIL_SetModel crashes). If this plugin is detecting a lot of unprecached models on your server on a regular basis, there may be severe underlying issues with your server that need to be addressed.

    Do not use this plugin as a "global precacher" for models. When a model is late-precached, players will experience a stutter (more obvious on low-end computers), so it's best to make sure that plugins utilizing models properly precache them inside OnMapStart().

    Example:
    PHP Code:
    L 04/11/2022 13:15:48SourceMod error session started
    L 04
    /11/2022 13:15:48Info (map "l4d_hospital03_sewers") (file "C:\l4d1ds\left4dead\addons\sourcemod\logs\errors_20220411.log")
    L 04/11/2022 13:15:48: [l4d_late_model_precacher.smxUTIL_SetModelModel models/props_unique/spawn_apartment/coffeeammo.mdl is not precachedPrecaching late
    Credits

    epz/epzminion - For the idea and solution.

    SourceMod Team - For continually updating/improving SourceMod.

    Requirements

    1. SourceMod 1.10 or higher
    2. DHooks 2.2.0-detours15 or higher
    3. Knowledge of installing SourceMod plugins.

    Notes

    1. I do not provide support for listen/local servers but the plugin should still work properly on them.
    2. I will not help you with installing or troubleshooting problems on your part.
    3. If you get errors from SourceMod itself, that is your problem, not mine.
    4. MAKE SURE YOU MEET ALL THE REQUIREMENTS AND FOLLOW THE INSTALLATION GUIDE PROPERLY.

    Features

    1. Precaches any model that is not precached prior to being used.
    2. Blocks the game from setting an entity's model if the model failed to be precached.

    Changelog

    Spoiler


    Installation

    1. Delete files from old versions of the plugin.
    2. Place "l4d_late_model_precacher.txt" in the "addons/sourcemod/gamedata" folder.
    3. Place "l4d_late_model_precacher.smx" in the "addons/sourcemod/plugins" folder.
    4. Place "l4d_late_model_precacher.sp" in the "addons/sourcemod/scripting" folder.

    Uninstalling/Upgrading to Newer Versions

    1. Delete "l4d_late_model_precacher.sp" from the "addons/sourcemod/scripting" folder.
    2. Delete "l4d_late_model_precacher.smx" from the "addons/sourcemod/plugins" folder.
    3. Delete "l4d_late_model_precacher.txt" from the "addons/sourcemod/gamedata" folder.
    4. Follow the Installation guide above. (Only for upgrading to newer versions.)

    Disabling

    1. Move "l4d_late_model_precacher.smx" to the "plugins/disabled" folder.
    2. Unload "Late Model Precacher" by typing "sm plugins unload l4d_late_model_precacher" in the server console.

    Third-party Revisions Notice

    If you would like to share your own revisions of this plugin, please rename the files so that there is no confusion for users.

    Download

    Source | Latest Version | All Official Releases
    __________________

    Last edited by Psyk0tik; 06-01-2022 at 13:49. Reason: Updated main post
    Psyk0tik is offline
    TypicalType
    Member
    Join Date: Mar 2020
    Location: Brazil
    Old 04-11-2022 , 18:18   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #2

    lol this is going to help to avoid the annoying crashes whenever im testing models using stripper:source
    TypicalType is offline
    CosmicD
    Senior Member
    Join Date: Dec 2009
    Location: Hasselt, Belgium
    Old 04-11-2022 , 19:20   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #3

    This cured the crashes I had over the weekend in combination with another plugin due to one model not precaching (found that out with accellerator).

    Using stripper to load the map diddn't help but this totally solved the crashes and now I see this in the error log:

    Code:
    L 04/12/2022 - 00:10:18: SourceMod error session started
    L 04/12/2022 - 00:10:18: Info (map "l4d_hospital03_sewers") (file "/usr/local/games/l4d/left4dead/addons/sourcemod/logs/errors_20220412.log")
    L 04/12/2022 - 00:10:18: [l4d_late_model_precacher.smx] UTIL_SetModel: Model models/props_unique/spawn_apartment/coffeeammo.mdl is not precached. Precaching late.
    L 04/12/2022 - 00:11:01: Error log file session closed.
    Lucky that the culprit remained with that one model
    __________________

    Last edited by CosmicD; 04-11-2022 at 19:21.
    CosmicD is offline
    Shao
    Senior Member
    Join Date: Jan 2015
    Old 04-11-2022 , 20:21   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #4

    What about sounds? As far as I know I always have had a crash randomly when oxygen tanks are spawned. (At least I assume so.)

    For me it always was "Late precache of PrecacheSound("physics/destruction/ExplosiveGasLeak.wav" that shows up.

    https://github.com/ValveSoftware/Sou...es/issues/3413 This is the topic where I took the assumptions from.
    Shao is offline
    Psyk0tik
    Veteran Member
    Join Date: May 2012
    Location: Homeless
    Old 04-11-2022 , 20:51   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #5

    Quote:
    Originally Posted by CosmicD View Post
    This cured the crashes I had over the weekend in combination with another plugin due to one model not precaching (found that out with accellerator).

    Using stripper to load the map diddn't help but this totally solved the crashes and now I see this in the error log:

    Code:
    L 04/12/2022 - 00:10:18: SourceMod error session started
    L 04/12/2022 - 00:10:18: Info (map "l4d_hospital03_sewers") (file "/usr/local/games/l4d/left4dead/addons/sourcemod/logs/errors_20220412.log")
    L 04/12/2022 - 00:10:18: [l4d_late_model_precacher.smx] UTIL_SetModel: Model models/props_unique/spawn_apartment/coffeeammo.mdl is not precached. Precaching late.
    L 04/12/2022 - 00:11:01: Error log file session closed.
    Lucky that the culprit remained with that one model
    Awesome!

    Quote:
    Originally Posted by Shao View Post
    What about sounds? As far as I know I always have had a crash randomly when oxygen tanks are spawned. (At least I assume so.)

    For me it always was "Late precache of PrecacheSound("physics/destruction/ExplosiveGasLeak.wav" that shows up.

    https://github.com/ValveSoftware/Sou...es/issues/3413 This is the topic where I took the assumptions from.
    The topic you linked is mostly related to the issue that this plugin addresses.

    I've never experienced a crash related to unprecached sound files. When sound files are unprecached, they just don't play, or they are late-precached and play after an insignificant delay.

    If you or anyone can provide an example of an unprecached/late-precached sound file causing a crash, then I can look into it.
    __________________
    Psyk0tik is offline
    sorallll
    Senior Member
    Join Date: Oct 2018
    Old 04-12-2022 , 07:23   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #6

    Can this plugin replace such plugins?
    sorallll is offline
    Psyk0tik
    Veteran Member
    Join Date: May 2012
    Location: Homeless
    Old 04-12-2022 , 12:50   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #7

    Quote:
    Originally Posted by sorallll View Post
    Can this plugin replace such plugins?
    You can use both. That plugin precaches specific files including sound files and melee weapon scripts. My plugin is just a failsafe for unprecached models that can crash servers.
    __________________
    Psyk0tik is offline
    sorallll
    Senior Member
    Join Date: Oct 2018
    Old 04-13-2022 , 01:15   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #8

    Quote:
    Originally Posted by Psyk0tik View Post
    You can use both. That plugin precaches specific files including sound files and melee weapon scripts. My plugin is just a failsafe for unprecached models that can crash servers.
    OK, thanks
    sorallll is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 04-15-2022 , 12:41   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #9

    Neat idea! Thanks Crasher!
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    ZBzibing
    Senior Member
    Join Date: Dec 2012
    Old 05-11-2022 , 03:43   Re: [L4D & L4D2] Late Model Precacher
    Reply With Quote #10

    Can this bug be fixed?
    Code:
    models/props/terror/ammo_stack.mdl (2) at -1.$ -1.$ -1.$ in contact with prop_static (2) at 312.4 -1.2 313.1, crash. dist = -1, minq = 100000002004087730000.000000
    __________________
    Please forgive, If I'm not describing it accurately. I use google translate
    Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:
    ZBzibing 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 13:05.


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