Can I use the same topic for another simple suggestion? Yes? Thanks.
Add a bool in the
precache_model function to set whether the model being precached is a player model or anything else. If the bool is set to true, the function will check if a player model with a T.mdl file exists and will automatically precache that file if found. Also, if the string doesn't contain ".mdl" and the bool is set to true, it will automatically form the proper player model path, so the function can be used in three different ways:
PHP Code:
precache_model("models/some_model.mdl") // for regular models
precache_model("models/player/McDonalds/McDonalds.mdl", true) // for player models (with path)
precache_model("McDonalds", true) // for player models (without path)
Not precaching T.mdl files can lead to server crash and most coders seem to forget about this when changing player models in plugins. Another variant can be adding a separate
precache_player_model function. This is what I use:
PHP Code:
precache_player_model(szModel[])
{
static szFile[128]
formatex(szFile, charsmax(szFile), "models/player/%s/%s.mdl", szModel, szModel)
precache_model(szFile)
replace(szFile, charsmax(szFile), ".mdl", "T.mdl")
if(file_exists(szFile))
precache_model(szFile)
}
__________________