The only thing that needs "optimizing" here is using "precache_generic" for files that are used client-side, e.g. I'm assuming all the sounds there.
If the sound is played with "client_cmd spk" instead of "emit_sound", use "precache_generic". This way you save up precious resource space.
PS: you need to add "sound/" in the path when doing this.
@lexzor - not really a good way because it can crash the server if the model has a T.mdl file.
Code:
precache_player_model(szModel[])
{
static szFile[128]
formatex(szFile, charsmax(szFile), "models/player/%s/%s.mdl", szModel, szModel)
precache_generic(szFile)
replace(szFile, charsmax(szFile), ".mdl", "T.mdl")
if(file_exists(szFile))
{
precache_generic(szFile)
}
}
__________________