2007-01-29 20:36:02 +01:00
|
|
|
#include <sourcemod>
|
|
|
|
#include <textparse>
|
|
|
|
|
|
|
|
public Plugin:myinfo =
|
|
|
|
{
|
|
|
|
name = "Admin Base",
|
|
|
|
author = "AlliedModders LLC",
|
|
|
|
description = "Reads admin files",
|
|
|
|
version = "1.0.0.0",
|
|
|
|
url = "http://www.sourcemod.net/"
|
|
|
|
};
|
|
|
|
|
2007-02-07 00:30:50 +01:00
|
|
|
/** Various parsing globals */
|
2007-02-06 06:48:52 +01:00
|
|
|
new bool:g_FlagsSet[26]; /* Maps whether flags are set */
|
2007-01-29 20:36:02 +01:00
|
|
|
new AdminFlag:g_FlagLetters[26]; /* Maps the flag letters */
|
|
|
|
new bool:g_LoggedFileName = false; /* Whether or not the file name has been logged */
|
2007-02-07 00:30:50 +01:00
|
|
|
new g_ErrorCount = 0; /* Current error count */
|
|
|
|
new g_IgnoreLevel = 0; /* Nested ignored section count, so users can screw up files safely */
|
|
|
|
new String:g_Filename[PLATFORM_MAX_PATH]; /* Used for error messages */
|
2007-01-29 20:36:02 +01:00
|
|
|
|
2007-01-30 01:38:15 +01:00
|
|
|
#include "admin-levels.sp"
|
|
|
|
#include "admin-overrides.sp"
|
2007-01-30 07:43:34 +01:00
|
|
|
#include "admin-groups.sp"
|
2007-01-30 01:38:15 +01:00
|
|
|
|
2007-02-06 06:13:24 +01:00
|
|
|
public OnRebuildAdminCache(AdminCachePart:part)
|
2007-01-29 20:36:02 +01:00
|
|
|
{
|
|
|
|
RefreshLevels();
|
2007-02-06 06:13:24 +01:00
|
|
|
if (part == AdminCache_Overrides)
|
2007-01-30 00:54:04 +01:00
|
|
|
{
|
|
|
|
ReadOverrides();
|
2007-02-06 06:13:24 +01:00
|
|
|
} else if (part == AdminCache_Groups)
|
2007-01-30 07:43:34 +01:00
|
|
|
{
|
|
|
|
ReadGroups();
|
|
|
|
}
|
2007-01-29 20:36:02 +01:00
|
|
|
}
|
2007-02-07 00:30:50 +01:00
|
|
|
|
|
|
|
ParseError(const String:format[], {Handle,String,Float,_}:...)
|
|
|
|
{
|
|
|
|
decl String:buffer[512];
|
|
|
|
|
|
|
|
if (!g_LoggedFileName)
|
|
|
|
{
|
2007-02-07 00:39:25 +01:00
|
|
|
LogError("Error(s) detected parsing %s", g_Filename);
|
2007-02-07 00:30:50 +01:00
|
|
|
g_LoggedFileName = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
VFormat(buffer, sizeof(buffer), format, 2);
|
|
|
|
|
|
|
|
LogError(" (%d) %s", ++g_ErrorCount, buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
InitGlobalStates()
|
|
|
|
{
|
|
|
|
g_ErrorCount = 0;
|
|
|
|
g_IgnoreLevel = 0;
|
|
|
|
g_LoggedFileName = false;
|
|
|
|
}
|