Page 1 of 1

How to tell how much precache table has been used for csgo???

Posted: Tue Dec 02, 2014 11:14 am
by 8guawong
i got this error Host_Error: CVEngineServer::PrecacheModel: overflow, too many models

the code

Syntax: Select all

from listeners import LevelInit
from engines.server import engine_servert

models = ['models/player/tm_phoenix.mdl', 'models/player/tm_pirate.mdl']
model_index = {}
current_map = ''

@LevelInit
def my_level_init_function(mapname):
global current_map
current_map = mapname
for x in models:
model_index[x] = engine_server.precache_model(x)


only preaching the built-in model...

here is some information

http://csgo-servers.1073505.n5.nabble.com/CS-GO-Please-help-strengthen-the-modding-community-td8471.html

so i'm wondering how to tell how much precache table has been used???
so i know if i'm hitting the limit or not??

Posted: Tue Dec 02, 2014 2:34 pm
by Ayuto
This will tell you the current number of entries in the modelprecache string table.

Syntax: Select all

from stringtables import string_tables

print(len(string_tables.modelprecache))

But I would suggest you to use the Model class. http://forums.sourcepython.com/showthread.php?643-3-new-classes-%28Model-Decal-Generic%29

And to get the current map name I would use this. http://wiki.sourcepython.com/pages/core#map_name

Posted: Tue Dec 02, 2014 2:55 pm
by 8guawong
Ayuto wrote:This will tell you the current number of entries in the modelprecache string table.

Syntax: Select all

from stringtables import string_tables

print(len(string_tables.modelprecache))

But I would suggest you to use the Model class. http://forums.sourcepython.com/showthread.php?643-3-new-classes-%28Model-Decal-Generic%29

And to get the current map name I would use this. http://wiki.sourcepython.com/pages/core#map_name


hi i can't use the new model class b/c no new linux release is availabe for download
can i use the code on the current version that is available for download??

might as well get the mapname from map start since i'm precaching the models there :)

thanks

Posted: Tue Dec 02, 2014 3:12 pm
by satoon101
There is absolutely no point to storing a global variable with the mapname. That value is already stored and available via core.global_vars.map_name, as Ayuto pointed out. It is pointless to store that value yourself.

I was hoping to get the entities_changes done and merged before posting a new build, but there are a few things that people would probably like access to now that are not available in the current download. I will create a new build and post it shortly.

Posted: Wed Dec 03, 2014 1:54 am
by 8guawong
ah sorry didn't notice that i have current_map
looking foward to new build

Posted: Wed Dec 03, 2014 8:49 am
by 8guawong
quick question is stringtable freed up after map change???

i get different value on each map

test.py

Syntax: Select all

from listeners import LevelInit

models = ['models/player/tm_phoenix.mdl', 'models/player/tm_pirate.mdl']
model_index = {}

@LevelInit
def my_level_init_function(mapname):
for x in models:
model_index[x] = engine_server.precache_model(x)

def load():
for x in models:
model_index[x] = engine_server.precache_model(x)


test2.py

Syntax: Select all

from listeners import LevelInit

models = ['models/player/tm_phoenix.mdl', 'models/player/tm_pirate.mdl']
model_index = {}

@LevelInit
def my_level_init_function(mapname):
for x in models:
model_index[x] = engine_server.precache_model(x)


if i put test.py in autoexec.cfg i get

Code: Select all

Host_Error: CVEngineServer::PrecacheModel: 'models/player/tm_phoenix.mdl' overflow, too many models

Host_Error: CVEngineServer::PrecacheModel: 'models/player/tm_phoenix.mdl' overflow, too many models

Segmentation fault (core dumped)


but if i use test2.py server loads fine

any idea??

Posted: Wed Dec 03, 2014 3:43 pm
by L'In20Cible
You cannot precache a model unless a map is loaded on the server.

Posted: Thu Dec 04, 2014 4:33 am
by 8guawong
ohhhhh thx :cool: