mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
added UTIL_GetModulesNum function
This commit is contained in:
parent
e40daf1315
commit
cfb45c1302
@ -103,6 +103,12 @@ void UTIL_ShowMenu( edict_t* pEntity, int slots, int time, char *menu, int mlen
|
||||
void UTIL_MakeNewLogFile();
|
||||
void UTIL_Log(const char *fmt, ...);
|
||||
|
||||
#define UTIL_MODULES_RUNNING 0
|
||||
#define UTIL_MODULES_ALL 1
|
||||
#define UTIL_MODULES_STOPPED 2
|
||||
|
||||
int UTIL_GetModulesNum(int mode);
|
||||
|
||||
#define GET_PLAYER_POINTER(e) (&g_players[ENTINDEX(e)])
|
||||
//#define GET_PLAYER_POINTER(e) (&g_players[(((int)e-g_edict_point)/sizeof(edict_t ))])
|
||||
#define GET_PLAYER_POINTER_I(i) (&g_players[i])
|
||||
|
@ -330,3 +330,36 @@ void UTIL_Log(const char *fmt, ...)
|
||||
fclose(pF);
|
||||
print_srvconsole("L %s: %s\n", date, msg);
|
||||
}
|
||||
|
||||
// Get the number of running modules
|
||||
int UTIL_GetModulesNum(int mode)
|
||||
{
|
||||
CList<CModule>::iterator iter;
|
||||
int num;
|
||||
switch (mode)
|
||||
{
|
||||
case UTIL_MODULES_ALL:
|
||||
return g_modules.size();
|
||||
case UTIL_MODULES_RUNNING:
|
||||
iter = g_modules.begin();
|
||||
num = 0;
|
||||
while (iter)
|
||||
{
|
||||
if ((*iter).getStatusValue() == MODULE_LOADED)
|
||||
++num;
|
||||
++iter;
|
||||
}
|
||||
return num;
|
||||
case UTIL_MODULES_STOPPED:
|
||||
iter = g_modules.begin();
|
||||
num = 0;
|
||||
while (iter)
|
||||
{
|
||||
if ((*iter).getStatusValue() != MODULE_LOADED)
|
||||
++num;
|
||||
++iter;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user