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

All other Source.Python topics and issues.
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

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

Postby 8guawong » Tue Dec 02, 2014 11:14 am

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??
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Tue Dec 02, 2014 2:34 pm

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
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Tue Dec 02, 2014 2:55 pm

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
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Dec 02, 2014 3:12 pm

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.
Image
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Wed Dec 03, 2014 1:54 am

ah sorry didn't notice that i have current_map
looking foward to new build
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Wed Dec 03, 2014 8:49 am

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??
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Wed Dec 03, 2014 3:43 pm

You cannot precache a model unless a map is loaded on the server.
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Thu Dec 04, 2014 4:33 am

ohhhhh thx :cool:

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 41 guests