Raised This Month: $51 Target: $400
 12% 

orpheu precache counter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-17-2014 , 14:51   orpheu precache counter
Reply With Quote #1

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.
__________________
Currently busy working on a very large scale anime database project.

Last edited by Backstabnoob; 04-17-2014 at 14:57.
Backstabnoob is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 04-18-2014 , 02:00   Re: orpheu precache counter
Reply With Quote #2

I think ConnorMcLeod made one, search in his threads / posts.
__________________
Kia is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-18-2014 , 02:45   Re: orpheu precache counter
Reply With Quote #3

Quote:
Originally Posted by Kia View Post
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.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 04-18-2014 , 02:48   Re: orpheu precache counter
Reply With Quote #4

Quote:
Originally Posted by bibu View Post
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.
__________________
Kia is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-18-2014 , 03:41   Re: orpheu precache counter
Reply With Quote #5

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 ] ); }
Attached Files
File Type: zip functions.zip (781 Bytes, 175 views)
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 04-18-2014 at 03:42.
hornet is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-18-2014 , 05:58   Re: orpheu precache counter
Reply With Quote #6

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, ...)
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-18-2014 , 06:36   Re: orpheu precache counter
Reply With Quote #7

Quote:
Originally Posted by Backstabnoob View Post
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.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-18-2014 , 07:11   Re: orpheu precache counter
Reply With Quote #8

Quote:
Originally Posted by bibu View Post
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.
__________________
Currently busy working on a very large scale anime database project.

Last edited by Backstabnoob; 04-18-2014 at 07:12.
Backstabnoob is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-25-2014 , 10:35   Re: orpheu precache counter
Reply With Quote #9

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.
__________________
Jhob94 is offline
WaLkMaN
Senior Member
Join Date: Oct 2010
Location: Varna, Bulgaria
Old 02-11-2023 , 06:05   Re: orpheu precache counter
Reply With Quote #10

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 ] ); }
__________________

Last edited by WaLkMaN; 02-11-2023 at 06:06.
WaLkMaN is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:58.


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