AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   orpheu precache counter (https://forums.alliedmods.net/showthread.php?t=238847)

Backstabnoob 04-17-2014 14:51

orpheu precache counter
 
Can anyone write a small orpheu plugin that prints the exact amount of precached models/sounds/generics on server startup to the console? If it's possible, please make it the way I'm saying instead of counting the models in FM_PrecacheModel and FM_PrecacheSound because as far as I remember they're not very accurate.

I think this would have plenty of use and would be worth releasing as a standalone plugin.

Thanks in advance.

Kia 04-18-2014 02:00

Re: orpheu precache counter
 
I think ConnorMcLeod made one, search in his threads / posts.

bibu 04-18-2014 02:45

Re: orpheu precache counter
 
Quote:

Originally Posted by Kia (Post 2126244)
I think ConnorMcLeod made one, search in his threads / posts.

Yes, but as the OP says, it wasn't accurate and it doesn't count custom precached files by plugins.

Kia 04-18-2014 02:48

Re: orpheu precache counter
 
Quote:

Originally Posted by bibu (Post 2126262)
Yes, but as the OP says, it wasn't accurate and it doesn't count custom precached files by plugins.

Not sure if it was Connors, but I used one once and it counts custom files by plugins too.

hornet 04-18-2014 03:41

Re: orpheu precache counter
 
1 Attachment(s)
Something like this?

Code:
#include <amxmodx> #include <orpheu> #include <orpheu_stocks> #define VERSION     "0.0.1" enum PrecacheData {     Sound,     Model,     Generic } new g_iPrecacheCount[ PrecacheData ]; public plugin_precache() {     OrpheuRegisterHook( OrpheuGetEngineFunction( "pfnPrecacheSound", "PrecacheSound" ), "PrecacheSound" );     OrpheuRegisterHook( OrpheuGetEngineFunction( "pfnPrecacheModel", "PrecacheModel" ), "PrecacheModel" );     OrpheuRegisterHook( OrpheuGetEngineFunction( "pfnPrecacheGeneric", "PrecacheGeneric" ), "PrecacheGeneric" ); } public PrecacheSound() {     g_iPrecacheCount[ Sound ] ++; } public PrecacheModel() {     g_iPrecacheCount[ Model ] ++; } public PrecacheGeneric() {     g_iPrecacheCount[ Generic ] ++; } public plugin_init() {     register_plugin( "Precache Counter", VERSION, "hornet" );         log_amx( "%i Sounds loaded, %i Models loaded, %i Generics loaded", g_iPrecacheCount[ Model ], g_iPrecacheCount[ Sound ], g_iPrecacheCount[ Generic ] ); }

Backstabnoob 04-18-2014 05:58

Re: orpheu precache counter
 
It told me 615 models. The problem is most likely that a file can be precached from more places (map, plugins) more than once and the function will always catch that. I tried changing PrecacheModel to PrecacheModel( const szModel[ ] ) and check if the model has already been precached but it now doesn't work at all, so I'm unsure whether the function parameter is supported.

Also, does this count in brush models? These are map entities with models such as *78, etc. (func_door, func_button, ...)

bibu 04-18-2014 06:36

Re: orpheu precache counter
 
Quote:

Originally Posted by Backstabnoob (Post 2126314)
Also, does this count in brush models? These are map entities with models such as *78, etc. (func_door, func_button, ...)

No it doesn't. And the name "model" doesn't really fit there, but I know some bsp viewers show them as "models". But this doesn't effect your precache limit or whatever. The only entity which I would think of would be env_sprite, ambient_generic and maybe some more (?) which really precaches the required files.

Backstabnoob 04-18-2014 07:11

Re: orpheu precache counter
 
Quote:

Originally Posted by bibu (Post 2126322)
No it doesn't. And the name "model" doesn't really fit there, but I know some bsp viewers show them as "models". But this doesn't effect your precache limit or whatever. The only entity which I would think of would be env_sprite, ambient_generic and maybe some more (?) which really precaches the required files.

That's incorrect.

Brush entities are entities which have a model generated in VHE, for example rotating doors. These models have an asterisk in front of them (as I noted).

Quote:

FATAL ERROR (shutting down): Host_Error: PF_precache_model_I: Model 'models/simivalley/furniture/bed1.mdl' failed to precache because the item count is over the 512 limit.
Reduce the number of brush models and/or regular models in the map to correct this.
Quote from valvedev:
Quote:

When a map is compiled VBSP converts brush faces that touch a visleaf to groups of polygons. The resulting 'brush models' are stored within the BSP file and can be claimed by entities (e.g. the world, or your brush entity). The original brushes are retained in the BSP, though the benefits of this are not clear.
Brush models indeed do count in towards the precache limit.

Jhob94 11-25-2014 10:35

Re: orpheu precache counter
 
Hornet, this makes my server crash. No errors in logs. When i disable the plugin server runs fine. Orpheu also seems to be loading fine and finds the functions correctly.

WaLkMaN 02-11-2023 06:05

Re: orpheu precache counter
 
Only for testing purpose. The info is not correct. Instead of that, there are two commands implemented in ReHLDS https://github.com/dreamstalker/rehlds#commands

Code:
#include <amxmodx> #include <reapi> #define VERSION  "0.0.1" enum PrecacheData {     Sound,     Model,     Generic } new g_iPrecacheCount[ PrecacheData ]; public plugin_precache() {     RegisterHookChain( RH_PF_precache_sound_I, "PrecacheSound" );     RegisterHookChain( RH_PF_precache_model_I, "PrecacheModel" );     RegisterHookChain( RH_PF_precache_generic_I, "PrecacheGeneric" ); } public PrecacheSound() {     g_iPrecacheCount[ Sound ] ++; } public PrecacheModel() {     g_iPrecacheCount[ Model ] ++; } public PrecacheGeneric() {     g_iPrecacheCount[ Generic ] ++; } public plugin_init() {     register_plugin( "Precache Counter", VERSION, "hornet" );         log_amx( "%i Sounds loaded, %i Models loaded, %i Generics loaded", g_iPrecacheCount[ Model ], g_iPrecacheCount[ Sound ], g_iPrecacheCount[ Generic ] ); }


All times are GMT -4. The time now is 04:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.