AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting total ents? (https://forums.alliedmods.net/showthread.php?t=46470)

Drak 10-27-2006 12:48

Getting total ents?
 
Is there a way to get the total ents currently running on the server? Since I was wondering how much stuff was being precached.

schnitzelmaker 10-27-2006 13:07

Re: Getting total ents?
 
max ents can get with: get_global_int(GL_maxEntities)
Here a little script to get the current ents.
Code:
new maxents public plugin_init() {     maxents = get_global_int(GL_maxEntities)     register_concmd("amx_getcurrentents","get_currentents") }   public get_currentents(id) {     new currentents     for(new i;i<maxents;i++)         if(is_valid_ent(i))             currentents++     client_print(id,print_chat,"Current running %d ents of %d max ents",maxents,currentents) }

Silencer123 10-27-2006 13:09

Re: Getting total ents?
 
Code:
#include <fakemeta> new entities public plugin_precache() {     register_forward(FM_Spawn,"handle_spawn")     set_task(1.0,"tell_entities") } public handle_spawn() {     entities++ } public tell_entities() {     client_print(0,print_chat,"This Map has a Total of %i Entities inside!",entities) } // Note that also after the Map has loaded Entities can Spawn. // (Temporary Entities or Monsters from monstermakers etc.) // You maybe want to use remove_forward in tell_entities() // or make another Variable and do variable_new=entities // in tell_entities().  ;)

P34nut 10-27-2006 13:12

Re: Getting total ents?
 
wrong!
Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {     register_plugin("Test", "1.0", "P34nut")         register_concmd("amx_getcurrentents","get_currentents") } public get_currentents() {     new iNum = engfunc(EngFunc_NumberOfEntities)     new iMax = global_get(glb_maxEntities)         client_print(0, print_chat, "Max: %i, Num: %i", iMax, iNum) }

...

organizedKaoS 10-27-2006 13:19

Re: Getting total ents?
 
Quote:

Originally Posted by Silencer123 (Post 395851)
Code:
#include <fakemeta> new entities public plugin_precache() {     register_forward(FM_Spawn,"handle_spawn")     set_task(1.0,"tell_entities") } public handle_spawn() {     entities++ } public tell_entities() {     client_print(0,print_chat,"This Map has a Total of %i Entities inside!",entities) } // Note that also after the Map has loaded Entities can Spawn. // (Temporary Entities or Monsters from monstermakers etc.) // You maybe want to use remove_forward in tell_entities() // or make another Variable and do variable_new=entities // in tell_entities().  ;)

I didn't know you can use client print in precache....(Sarcasm intended).

Silencer123 10-27-2006 14:50

Re: Getting total ents?
 
Doh!

organizedKaoS 10-27-2006 15:00

Re: Getting total ents?
 
Quote:

Originally Posted by Silencer123 (Post 395881)
Doh!

LOL....must be the sleep eh...get more or you'll end up a zombie :P

Drak 10-27-2006 15:11

Re: Getting total ents?
 
Ah, thank you.


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

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