Model PreCRASH Prevention

If you liked this item, please rate it up on Steam Workshop page.

Author: Fay

Last revision: 21 Jul, 2020 at 19:22 UTC

File size: 3.07 KB

On Steam Workshop

Description:
4096 is the current Garry’s Mod Model Precache Limit

A model is precached when it is spawned for the first time. When this limit is hit, the server will immediately crash without warning. This precache cannot be cleared using lua alone, so this addon aims to prevent players from hitting this limit and causing a crash, whether it was intentional or not.

The way it works is simple:
1. Scan all initial models when map is loaded
2. Scan models as they are spawned (props, vehicles, etc.)
3. If a player tries to spawn a prop, ragdoll, or vehicle, and the limit is hit, prevent it. Players will receive a notice saying "MPCache Overflow!"

Convars (all serverside)
– mpcache_enabled (default: 1) – (1 or 0) Whether the model precache should be monitored and protected
– mpcache_headroom (default: 512) – (0 to 4096) How far below the limit should the precache be protected from new models

NOTE: It is not recommended to ride up extremely close to the model precache limit, as lua addons cannot be prevented from spawning their own models. For that reason, I suggest not changing mpcache_headroom to anything below 512.