I made this script to show how many entities are currently and what is the maximun number of entities.
It's showing in logs using server_print and every 2 seconds.
I made this for debugging purposes.
Just compile, install in plugins.ini and when you want to start entity count debugging, issue a "rcon amx_debug_ent" command.
If you send this command again, it will stop debugging.
In my case, adding "-num_edicts xxxx" to hlds_run (in linux) worked fine.
Also you can play with "-heapsize" and "-zone" options to manage memory limits.
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#define DEBUG_PREFIX "[AMXX DEBUG]"
new gDebugEnt = 0
new iTaskEnt = 99921001
public plugin_init()
{
register_plugin("Test Plugin", "0.1", "Piegtas")
register_concmd("amx_debug_ent", "DebugEnt")
}
public DebugEnt()
{
if(gDebugEnt)
{
remove_task(iTaskEnt)
gDebugEnt = 0
return
}
gDebugEnt = 1
set_task(2.0, "ShowEntStats", iTaskEnt, "", 0, "b")
return
}
public ShowEntStats()
{
new iEntCount = entity_count()
new iEntMax = global_get(glb_maxEntities)
server_print("%s %d entities in world (%d max!)", DEBUG_PREFIX, iEntCount, iEntMax)
}