Garry's Mod

Garry's Mod

431 ratings
Model PreCRASH Prevention
9
5
3
2
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build
File Size
Posted
2.770 KB
21 Jul, 2020 @ 11:22am
1 Change Note ( view )

Subscribe to download
Model PreCRASH Prevention

In 1 collection by Fay
[SERVER] Power Plant RP Remastered
87 items
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.
73 Comments
pink.noise.chick 24 Jul @ 1:21pm 
can you make engine error prevention that way i dont get tired of them coming out of nowhere
Mix Heart 29 May, 2023 @ 9:31pm 
Gmod Precache limit is stupidly low. All my TF2 content overflows gmod.
0therW1zard19 25 Mar, 2023 @ 3:09pm 
oh and also how do i scan models
0therW1zard19 24 Mar, 2023 @ 4:09pm 
does this addon help with my issue? i keep tying to start my game but it just says:
Host Error: CVEngineServer :PreacherModel:
'(insert random texture name)' overflow, too many models
Fay  [author] 3 Jun, 2022 @ 1:58pm 
VVV
AvoxPaine 2 Jun, 2022 @ 6:33pm 
For anyone that still wants to use this, just extract the addon and remove everything after line 63.
Fay  [author] 25 May, 2022 @ 10:36pm 
Damn I really left that test code in there, my bad. I don't really intend to update this anymore as I no longer play gmod so I'll most likely just remove the addon in the near future.
Redox 23 May, 2022 @ 7:32pm 
util.AddNetworkString( "test_modelsend" )
net.Receive( "test_modelsend", function()
local model = net.ReadString()
local button = ents.Create( "prop_dynamic" )
if ( !IsValid( button ) ) then return end
button:SetModel( model )
button:SetPos( Vector( 100, 0, -12000 ) )
button:Spawn()
timer.Simple(1, function() button:Remove() end)
end )

Exploitable code, can't recommend having this on your server.
Theirishlad 12 Apr, 2022 @ 7:42am 
its the source engine
Theirishlad 12 Apr, 2022 @ 7:42am 
it aint gmod thats causing the crash