Improved logging system.
Made generic flags for log event types. Made support for module filtering. Note: Manager for module filtering is not implemented. Don't enable filter when testing, otherwise nothing will be logged. Updated all log events.
This commit is contained in:
parent
db866c6f43
commit
4ce30ac002
@ -18,6 +18,9 @@
|
||||
|
||||
#define VERSION "3.0-dev"
|
||||
|
||||
// Header includes.
|
||||
#include "zr/log.h"
|
||||
|
||||
// Core includes.
|
||||
#include "zr/zombiereloaded"
|
||||
#include "zr/translation"
|
||||
|
@ -29,7 +29,7 @@ AccountOnOffsetsFound()
|
||||
g_iToolsAccount = FindSendPropInfo("CCSPlayer", "m_iAccount");
|
||||
if (g_iToolsAccount == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Account", "Offsets", "Offset \"CCSPlayer::m_iAccount\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Account, "Offsets", "Offset \"CCSPlayer::m_iAccount\" was not found.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ AntiStickOnOffsetsFound()
|
||||
g_iToolsCollisionGroup = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
|
||||
if (g_iToolsCollisionGroup == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBaseEntity::m_CollisionGroup\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Antistick, "Offsets", "Offset \"CBaseEntity::m_CollisionGroup\" was not found.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ ConfigLoad()
|
||||
ServerCommand("exec %s", mapconfig);
|
||||
|
||||
// Log action.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Config", "Map Configs", "Executed map config file: %s", path);
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Config, "Map Configs", "Executed map config file: %s", path);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -239,7 +239,7 @@ ConfigOnModulesLoaded()
|
||||
ServerCommand("exec %s", mapconfig);
|
||||
|
||||
// Log action.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Config", "Map Configs", "Executed post map config file: %s", path);
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Config, "Executed post map config file: %s", path);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -552,7 +552,7 @@ stock bool:ConfigReloadConfig(ConfigFile:config)
|
||||
ConfigGetConfigAlias(config, configalias, sizeof(configalias));
|
||||
|
||||
// Print reload failure to logs.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Config", "Reload Function", "Invalid reload function for config: \"%s\"", configalias);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Config, "Reload Function", "Invalid reload function for config: \"%s\"", configalias);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -26,14 +26,11 @@ enum CvarsList
|
||||
{
|
||||
Handle:CVAR_ENABLE,
|
||||
Handle:CVAR_LOG,
|
||||
Handle:CVAR_LOG_LOAD,
|
||||
Handle:CVAR_LOG_CORE,
|
||||
Handle:CVAR_LOG_FILTER_MODULES,
|
||||
Handle:CVAR_LOG_FILTER_DESCRIPTION,
|
||||
Handle:CVAR_LOG_FILTER_DEBUG,
|
||||
Handle:CVAR_LOG_FLAGS,
|
||||
Handle:CVAR_LOG_MODULE_FILTER,
|
||||
Handle:CVAR_LOG_IGNORE_CONSOLE,
|
||||
Handle:CVAR_LOG_PRINT_ADMINS,
|
||||
Handle:CVAR_LOG_PRINT_CHAT,
|
||||
Handle:CVAR_LOG_PRINT_CONSOLE,
|
||||
Handle:CVAR_CONFIG_PATH_MODELS,
|
||||
Handle:CVAR_CONFIG_PATH_DOWNLOADS,
|
||||
Handle:CVAR_CONFIG_PATH_CLASSES,
|
||||
@ -191,13 +188,12 @@ CvarsCreate()
|
||||
// ===========================
|
||||
// Log (core)
|
||||
// ===========================
|
||||
g_hCvarsList[CVAR_LOG] = CreateConVar("zr_log", "1", "Logs key actions performed by the plugin, including errors and debug.");
|
||||
g_hCvarsList[CVAR_LOG_FILTER_MODULES] = CreateConVar("zr_log_filter_modules", "", "If any log module name is within this string, log will be suppressed. [Dependency: zr_log]");
|
||||
g_hCvarsList[CVAR_LOG_FILTER_DESCRIPTION] = CreateConVar("zr_log_filter_description", "", "If any log description is within this string, log will be suppressed. [Dependency: zr_log]");
|
||||
g_hCvarsList[CVAR_LOG_FILTER_DEBUG] = CreateConVar("zr_log_filter_debug", "1", "Supresses debug messages. [Dependency: zr_log]");
|
||||
g_hCvarsList[CVAR_LOG_PRINT_ADMINS] = CreateConVar("zr_log_print_admins", "0", "Print all logs to currently connected admins. [Dependency: zr_log]");
|
||||
g_hCvarsList[CVAR_LOG_PRINT_CHAT] = CreateConVar("zr_log_print_chat", "1", "Print log to admin's chat area. [Dependency: zr_log & zr_log_print_admins]");
|
||||
g_hCvarsList[CVAR_LOG_PRINT_CONSOLE] = CreateConVar("zr_log_print_console", "1", "Print log to admin's console. [Dependency: zr_log & zr_log_print_admins]");
|
||||
g_hCvarsList[CVAR_LOG] = CreateConVar("zr_log", "1", "Enable logging of events in the plugin. Fatal errors are logged independent on this setting.");
|
||||
g_hCvarsList[CVAR_LOG_FLAGS] = CreateConVar("zr_log_flags", "3", "A bit field that specify what event types to log. See logging section (3.3) in manual for details.");
|
||||
g_hCvarsList[CVAR_LOG_MODULE_FILTER] = CreateConVar("zr_log_module_filter", "0", "Enable module filtering. Only log events from listed modules will be logged.");
|
||||
g_hCvarsList[CVAR_LOG_IGNORE_CONSOLE] = CreateConVar("zr_log_ignore_console", "1", "Don't log events triggered by console commands that are executed by the console itself, like commands in configs. Enable this command to avoid spamming logs with events like weapon restrictions.");
|
||||
g_hCvarsList[CVAR_LOG_PRINT_ADMINS] = CreateConVar("zr_log_print_admins", "0", "Print log events to admin chat in addition to the log file.");
|
||||
g_hCvarsList[CVAR_LOG_PRINT_CHAT] = CreateConVar("zr_log_print_chat", "0", "Print log events to public chat in addition to the log file.");
|
||||
|
||||
|
||||
// ===========================
|
||||
@ -531,7 +527,7 @@ public CvarsHookLocked(Handle:cvar, const String:oldvalue[], const String:newval
|
||||
SetConVarInt(g_hAutoTeamBalance, CVARS_AUTOTEAMBALANCE_LOCKED);
|
||||
|
||||
// If log flag check fails, then don't log.
|
||||
LogPrintToLog(_, "Cvars", "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".");
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Cvars, "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".");
|
||||
}
|
||||
// If cvar is mp_limitteams, then continue.
|
||||
else if (cvar == g_hLimitTeams)
|
||||
@ -546,7 +542,7 @@ public CvarsHookLocked(Handle:cvar, const String:oldvalue[], const String:newval
|
||||
SetConVarInt(g_hLimitTeams, CVARS_LIMITTEAMS_LOCKED);
|
||||
|
||||
// If log flag check fails, then don't log.
|
||||
LogPrintToLog(_, "Cvars", "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".");
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Cvars, "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".");
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,5 +570,5 @@ public CvarsHookRestartGame(Handle:cvar, const String:oldvalue[], const String:n
|
||||
RoundEndTerminateRound(delay);
|
||||
|
||||
// If log flag check fails, then don't log.
|
||||
LogPrintToLog(_, "Cvars", "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.");
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Cvars, "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.");
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public Action:DamageSuicideIntercept(client, argc)
|
||||
TranslationReplyToCommand(client, "Damage suicide intercept");
|
||||
|
||||
// Log suicide interception
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Damage", "Suicide Intercept", "\"%L\" attempted suicide.", client);
|
||||
LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client);
|
||||
|
||||
// Block command.
|
||||
return Plugin_Handled;
|
||||
|
@ -31,7 +31,7 @@ DownloadsLoad()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure and stop plugin.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Downloads", "Config Validation", "Fatal Error: Missing downloads file: \"%s\"", pathdownloads);
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Downloads, "Config Validation", "Missing downloads file: \"%s\"", pathdownloads);
|
||||
}
|
||||
|
||||
// Set the path to the config file.
|
||||
@ -43,7 +43,7 @@ DownloadsLoad()
|
||||
// Unexpected error, stop plugin.
|
||||
if (!success)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Downloads", "Config Validation", "Fatal Error: Unexpected error encountered loading: %s", pathdownloads);
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Downloads, "Config Validation", "Unexpected error encountered loading: %s", pathdownloads);
|
||||
}
|
||||
|
||||
new downloadcount;
|
||||
@ -71,7 +71,7 @@ DownloadsLoad()
|
||||
// Backtrack one index, because we deleted it out from under the loop.
|
||||
x--;
|
||||
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Missing file \"%s\"", downloadpath);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Downloads, "Config Validation", "Missing file \"%s\"", downloadpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ DownloadsLoad()
|
||||
}
|
||||
|
||||
// Log model validation info.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Downloads", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", downloadcount, downloadvalidcount, downloadcount - downloadvalidcount);
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Downloads, "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", downloadcount, downloadvalidcount, downloadcount - downloadvalidcount);
|
||||
|
||||
// Set config data.
|
||||
ConfigSetConfigLoaded(File_Downloads, true);
|
||||
|
@ -70,7 +70,7 @@ HitgroupsLoad()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Hitgroups", "Config Validation", "Missing hitgroups config file: %s", pathhitgroups);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Hitgroups, "Config Validation", "Missing hitgroups config file: %s", pathhitgroups);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -84,7 +84,7 @@ HitgroupsLoad()
|
||||
// Unexpected error, stop plugin.
|
||||
if (!success)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Hitgroups", "Config Validation", "Unexpected error encountered loading: %s", pathhitgroups);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Hitgroups, "Config Validation", "Unexpected error encountered loading: %s", pathhitgroups);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -93,7 +93,7 @@ HitgroupsLoad()
|
||||
new size = GetArraySize(arrayHitgroups);
|
||||
if (!size)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Hitgroups", "Config Validation", "No usable data found in hitgroups config file: %s", pathhitgroups);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Hitgroups, "Config Validation", "No usable data found in hitgroups config file: %s", pathhitgroups);
|
||||
}
|
||||
|
||||
// Now copy data to array structure.
|
||||
@ -120,7 +120,7 @@ HitgroupsCacheData()
|
||||
|
||||
if (!success)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Hitgroups", "Config Validation", "Unexpected error caching data from hitgroups config file: %s", pathhitgroups);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Hitgroups, "Config Validation", "Unexpected error caching data from hitgroups config file: %s", pathhitgroups);
|
||||
}
|
||||
|
||||
decl String:hitgroupname[HITGROUPS_MAX_LENGTH];
|
||||
@ -134,7 +134,7 @@ HitgroupsCacheData()
|
||||
KvRewind(kvHitgroups);
|
||||
if (!KvJumpToKey(kvHitgroups, hitgroupname))
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Hitgroups", "Config Validation", "Couldn't cache hitgroup data for: %s (check hitgroup config)", hitgroupname);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Hitgroups, "Config Validation", "Couldn't cache hitgroup data for: %s (check hitgroup config)", hitgroupname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
65
src/zr/log.h.inc
Normal file
65
src/zr/log.h.inc
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* ============================================================================
|
||||
*
|
||||
* Zombie:Reloaded
|
||||
*
|
||||
* File: log.h.inc
|
||||
* Type: Core
|
||||
* Description: Log header. Types an defines.
|
||||
*
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* @section Log message max lengths.
|
||||
*/
|
||||
#define LOG_MAX_LENGTH_FILE 2048
|
||||
#define LOG_MAX_LENGTH_CHAT 192
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
/**
|
||||
* @section Log flags.
|
||||
*/
|
||||
#define LOG_CORE_EVENTS (1 << 0) /** Log events from the plugin core like config validation and other messages. */
|
||||
#define LOG_GAME_EVENTS (1 << 1) /** Log admin commands, console commands, and game related events from modules like suicide attempts and weapon restrictions. */
|
||||
#define LOG_PLAYER_COMMANDS (1 << 2) /** Log events that are triggered by players, like chat triggers, teleporting and class change. */
|
||||
#define LOG_DEBUG (1 << 3) /** Log debug messages, if any. Usually only developers enable this log flag. */
|
||||
#define LOG_DEBUG_DETAIL (1 << 4) /** Log additional debug messages with more detail. May cause spam depending on filter settings. Usually only developers enable this log flag. */
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
/**
|
||||
* Log format types.
|
||||
*/
|
||||
enum LogTypes
|
||||
{
|
||||
LogType_Normal = 0, // Normal log message. Printed in SourceMod logs.
|
||||
LogType_Error, // Error message. Printed in SourceMod error logs.
|
||||
LogType_Fatal // Fatal error. Stops the plugin with the specified message.
|
||||
}
|
||||
|
||||
/**
|
||||
* List of modules that write log events. Add new modules if needed (in
|
||||
* alphabetical order).
|
||||
*/
|
||||
enum LogModules
|
||||
{
|
||||
bool:LogModule_Account,
|
||||
bool:LogModule_Antistick,
|
||||
bool:LogModule_Config,
|
||||
bool:LogModule_Cvars,
|
||||
bool:LogModule_Damage,
|
||||
bool:LogModule_Downloads,
|
||||
bool:LogModule_Hitgroups,
|
||||
bool:LogModule_Infect,
|
||||
bool:LogModule_Models,
|
||||
bool:LogModule_Playerclasses,
|
||||
bool:LogModule_Soundeffects,
|
||||
bool:LogModule_Tools,
|
||||
bool:LogModule_Volfetures,
|
||||
bool:LogModule_Weapons,
|
||||
bool:LogModule_Weaponrestrict
|
||||
}
|
254
src/zr/log.inc
254
src/zr/log.inc
@ -10,113 +10,225 @@
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* @section Log message max lengths.
|
||||
*/
|
||||
#define LOG_MAX_LENGTH_FILE 2048
|
||||
#define LOG_MAX_LENGTH_CHAT 192
|
||||
/**
|
||||
* @endsection
|
||||
/*
|
||||
* Note: See log.h.inc for header types and defines.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @section Log format types
|
||||
*/
|
||||
#define LOG_FORMAT_TYPE_NORMAL 1 /** Printed in normal log. */
|
||||
#define LOG_FORMAT_TYPE_DEBUG 2 /** Printed in normal log, flagged as debug. */
|
||||
#define LOG_FORMAT_TYPE_ERROR 3 /** Printed in error log. */
|
||||
#define LOG_FORMAT_TYPE_FATALERROR 4 /** Stops the plugin + LOG_FORMAT_TYPE_ERROR */
|
||||
/**
|
||||
* @endsection
|
||||
* Handle for dynamic string array for module filtering.
|
||||
*/
|
||||
new Handle:LogModuleFilter;
|
||||
|
||||
/**
|
||||
* Print a formatted message to logs or error logs.
|
||||
* Cache of current module filter settings. For fast and easy access.
|
||||
*/
|
||||
new LogModuleFilterCache[LogModules];
|
||||
|
||||
/**
|
||||
* Gets a module type as a human readable string.
|
||||
*
|
||||
* @param type (Optional) Logging type. (See LOG_FORMAT_TYPE_* defines)
|
||||
* @param module Module the log belongs to.
|
||||
* @param description Short descriptive phrase to group together similar logs.
|
||||
* @param text Text to print to log.
|
||||
* @param buffer Destination string buffer.
|
||||
* @param maxlen Size of destination buffer.
|
||||
* @param module Module type to convert.
|
||||
*
|
||||
* @return Number of cells written.
|
||||
*/
|
||||
LogGetModuleNameString(String:buffer[], maxlen, LogModules:module)
|
||||
{
|
||||
switch (module)
|
||||
{
|
||||
case LogModule_Antistick:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Anti-Stick");
|
||||
}
|
||||
case LogModule_Config:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Config");
|
||||
}
|
||||
case LogModule_Cvars:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "CVARs");
|
||||
}
|
||||
case LogModule_Damage:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Damage");
|
||||
}
|
||||
case LogModule_Downloads:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Downloads");
|
||||
}
|
||||
case LogModule_Hitgroups:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Hit Groups");
|
||||
}
|
||||
case LogModule_Infect:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Infect");
|
||||
}
|
||||
case LogModule_Models:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Models");
|
||||
}
|
||||
case LogModule_Playerclasses:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Player Classes");
|
||||
}
|
||||
case LogModule_Soundeffects:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Sound Effects");
|
||||
}
|
||||
case LogModule_Tools:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Tools");
|
||||
}
|
||||
case LogModule_Volfetures:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Volumetric Features");
|
||||
}
|
||||
case LogModule_Weapons:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Weapons");
|
||||
}
|
||||
case LogModule_Weaponrestrict:
|
||||
{
|
||||
return strcopy(buffer, maxlen, "Weapon Restrictions");
|
||||
}
|
||||
}
|
||||
|
||||
// Module mismatch.
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the specified log flag is set.
|
||||
*
|
||||
* @param eventType The log flag to check.
|
||||
* @return True if set, false otherwise.
|
||||
*/
|
||||
bool:LogCheckFlag(eventType)
|
||||
{
|
||||
// Check if eventType is set.
|
||||
if (GetConVarInt(g_hCvarsList[CVAR_LOG_FLAGS]) & eventType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the specified module is enabled in the log module filter cache.
|
||||
*
|
||||
* @param module Module to check.
|
||||
* @return True if enabled, false otherwise.
|
||||
*/
|
||||
bool:LogCheckModuleFilter(LogModules:module)
|
||||
{
|
||||
if (LogModuleFilterCache[module])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a formatted message to logs depending on log settings.
|
||||
*
|
||||
* @param isConsole Optional. Specifies whether the log event came from
|
||||
* client 0. Used in console commands, do not mix with
|
||||
* regular log events. Default is false.
|
||||
* @param logType Optional. Log type and action. Default is
|
||||
* LogType_Normal.
|
||||
* @param eventType Optional. A log flag describing What kind of log event
|
||||
* it is. Default is LOG_CORE_EVENTS.
|
||||
* @param module Module the log event were executed in.
|
||||
* @param description Event type or function name. A short descriptive phrase
|
||||
* to group together similar logs.
|
||||
* @param text Log message. Can be formatted.
|
||||
* @param ... Formatting parameters.
|
||||
*/
|
||||
LogPrintToLog(type = LOG_FORMAT_TYPE_NORMAL, const String:module[], const String:description[], const String:text[], any:...)
|
||||
LogEvent(bool:isConsole = false, LogTypes:logType = LogType_Normal, eventType = LOG_CORE_EVENTS, LogModules:module, const String:description[], const String:text[], any:...)
|
||||
{
|
||||
// If logging is disabled, then stop.
|
||||
new bool:log = GetConVarBool(g_hCvarsList[CVAR_LOG]);
|
||||
if (!log)
|
||||
// Only do filter and flag checks if the log type isn't a fatal error.
|
||||
if (logType != LogType_Fatal)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If module is filtered, then stop.
|
||||
decl String:filtermodules[256];
|
||||
GetConVarString(g_hCvarsList[CVAR_LOG_FILTER_MODULES], filtermodules, sizeof(filtermodules));
|
||||
|
||||
if (StrContains(filtermodules, module, false) > -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If description is filtered, then stop.
|
||||
decl String:filterdescription[256];
|
||||
GetConVarString(g_hCvarsList[CVAR_LOG_FILTER_DESCRIPTION], filterdescription, sizeof(filterdescription));
|
||||
|
||||
if (StrContains(filterdescription, description, false) > -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If debug is disabled, then stop.
|
||||
new bool:filterdebug = GetConVarBool(g_hCvarsList[CVAR_LOG_FILTER_DEBUG]);
|
||||
if (filterdebug && type == LOG_FORMAT_TYPE_DEBUG)
|
||||
{
|
||||
return;
|
||||
// Check if logging is disabled.
|
||||
if (!GetConVarBool(g_hCvarsList[CVAR_LOG]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if console is ignored.
|
||||
if (isConsole && GetConVarBool(g_hCvarsList[CVAR_LOG_IGNORE_CONSOLE]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check event type (log flag).
|
||||
if (!LogCheckFlag(eventType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if module filtering is enabled.
|
||||
if (GetConVarBool(g_hCvarsList[CVAR_LOG_MODULE_FILTER]))
|
||||
{
|
||||
// Check if the specified module is enabled.
|
||||
if (!LogCheckModuleFilter(module))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Format extra parameters into the log buffer.
|
||||
decl String:logbuffer[LOG_MAX_LENGTH_FILE];
|
||||
VFormat(logbuffer, sizeof(logbuffer), text, 5);
|
||||
|
||||
// Get human readable module name.
|
||||
new String:modulename[64];
|
||||
LogGetModuleNameString(modulename, sizeof(modulename), module);
|
||||
|
||||
// Format
|
||||
Format(logbuffer, sizeof(logbuffer), "[%s]|[%s]: %s", module, description, logbuffer);
|
||||
Format(logbuffer, sizeof(logbuffer), "[%s] - [%s]: %s", modulename, description, logbuffer);
|
||||
|
||||
// Format other parameters onto the log text.
|
||||
switch (type)
|
||||
switch (logType)
|
||||
{
|
||||
// Log type is normal.
|
||||
case LOG_FORMAT_TYPE_NORMAL:
|
||||
case LogType_Normal:
|
||||
{
|
||||
LogMessage(logbuffer);
|
||||
}
|
||||
// Log type is error.
|
||||
case LOG_FORMAT_TYPE_ERROR:
|
||||
case LogType_Error:
|
||||
{
|
||||
LogError(logbuffer);
|
||||
}
|
||||
// Log type is fatal error.
|
||||
case LOG_FORMAT_TYPE_FATALERROR:
|
||||
case LogType_Fatal:
|
||||
{
|
||||
SetFailState(logbuffer);
|
||||
}
|
||||
}
|
||||
|
||||
// If print to admin cvar is enabled, then print to all connect admins.
|
||||
new bool:printadmins = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_ADMINS]);
|
||||
if (printadmins)
|
||||
// Note: The phrase "Literal text" is a blank phrase to pass any string we want into it.
|
||||
|
||||
// Check if printing log events to admins is enabled.
|
||||
if (GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_ADMINS]))
|
||||
{
|
||||
// Print text to admins.
|
||||
// Note: The phrase "Literal text" is a blank phrase to pass any string we want into it.
|
||||
|
||||
new bool:printchat = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CHAT]);
|
||||
if (printchat)
|
||||
{
|
||||
TranslationPrintToChatAll(false, true, "Literal text", logbuffer);
|
||||
}
|
||||
|
||||
new bool:printconsole = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CONSOLE]);
|
||||
if (printconsole)
|
||||
{
|
||||
TranslationPrintToConsoleAll(false, true, "Literal text", logbuffer);
|
||||
}
|
||||
TranslationPrintToChatAll(false, true, "Literal text", logbuffer);
|
||||
}
|
||||
|
||||
// Check if printing log events to public chat is enabled.
|
||||
if (GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CHAT]))
|
||||
{
|
||||
TranslationPrintToChatAll(false, false, "Literal text", logbuffer);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ ModelsLoad()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure and stop plugin.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: Missing models file: \"%s\"", pathmodels);
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Models, "Config Validation", "Missing models file: \"%s\"", pathmodels);
|
||||
}
|
||||
|
||||
// Set the path to the config file.
|
||||
@ -53,7 +53,7 @@ ModelsLoad()
|
||||
// Unexpected error, stop plugin.
|
||||
if (!success)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: Unexpected error encountered loading: %s", pathmodels);
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Models, "Config Validation", "Unexpected error encountered loading: %s", pathmodels);
|
||||
}
|
||||
|
||||
new modelcount;
|
||||
@ -143,17 +143,17 @@ ModelsLoad()
|
||||
x--;
|
||||
|
||||
// Log missing model files.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Models", "Config Validation", "Missing model files on server (%s)", modelbase);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Models, "Config Validation", "Missing model files on server (%s)", modelbase);
|
||||
}
|
||||
}
|
||||
|
||||
// Log model validation info.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Models", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", modelcount, modelvalidcount, modelcount - modelvalidcount);
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Models, "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", modelcount, modelvalidcount, modelcount - modelvalidcount);
|
||||
|
||||
// If none of the model paths are valid, then log and fail.
|
||||
if (!modelvalidcount)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: No usable model paths in %s", pathmodels);
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Models, "Config Validation", "No usable model paths in %s", pathmodels);
|
||||
}
|
||||
|
||||
// Set config data.
|
||||
|
@ -737,13 +737,13 @@ stock ClassGetDefaultSpawnClass(teamid, cachetype = ZR_CLASS_CACHE_MODIFIED)
|
||||
// in the specified team, and log a warning.
|
||||
classindex = ClassGetFirstClass(teamid, _, cachetype);
|
||||
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Default Spawn Class", "Warning: Failed to set \"%s\" as default spawn class for team %d. The class doesn't exist or the team IDs doesn't match. Falling back to the first class in the team.", classname, teamid);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Default Spawn Class", "Warning: Failed to set \"%s\" as default spawn class for team %d. The class doesn't exist or the team IDs doesn't match. Falling back to the first class in the team.", classname, teamid);
|
||||
|
||||
// Validate the new index.
|
||||
if (ClassValidateIndex(classindex))
|
||||
{
|
||||
// Log a warning.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Default Spawn Class", "Warning: The default class name \"%s\" does not exist or matches the team ID.", classname);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Default Spawn Class", "Warning: The default class name \"%s\" does not exist or matches the team ID.", classname);
|
||||
return classindex;
|
||||
}
|
||||
else
|
||||
|
@ -338,12 +338,12 @@ ClassLoad()
|
||||
// If file doesn't exist, then log and stop.
|
||||
if (!exists)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: Missing playerclasses config file \"%s\"", pathclasses);
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Missing playerclasses config file \"%s\"", pathclasses);
|
||||
return;
|
||||
}
|
||||
|
||||
// Log what class file that is loaded.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Loading classes from file \"%s\".", pathclasses);
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Loading classes from file \"%s\".", pathclasses);
|
||||
|
||||
// Put file data into memory.
|
||||
FileToKeyValues(kvClassData, pathclasses);
|
||||
@ -352,7 +352,7 @@ ClassLoad()
|
||||
KvRewind(kvClassData);
|
||||
if (!KvGotoFirstSubKey(kvClassData))
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: Can't find any classes in \"%s\"", pathclasses);
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Can't find any classes in \"%s\"", pathclasses);
|
||||
}
|
||||
|
||||
decl String:name[64];
|
||||
@ -370,7 +370,7 @@ ClassLoad()
|
||||
if (ClassCount > ZR_CLASS_MAX)
|
||||
{
|
||||
// Maximum classes reached. Write a warning and exit the loop.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Warning: Maximum classes reached (%d). Skipping other classes.", ZR_CLASS_MAX + 1);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Maximum classes reached (%d). Skipping other classes.", ZR_CLASS_MAX + 1);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -431,7 +431,7 @@ ClassLoad()
|
||||
// There's one or more invalid class attributes. Disable the class
|
||||
// and log an error message.
|
||||
ClassData[ClassCount][class_enabled] = false;
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Classes", "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", ClassCount, ClassErrorFlags);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", ClassCount, ClassErrorFlags);
|
||||
|
||||
failedcount++;
|
||||
}
|
||||
@ -443,13 +443,13 @@ ClassLoad()
|
||||
// Validate team requirements.
|
||||
if (!ClassValidateTeamRequirements())
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: The class configuration doesn't match the team requirements.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "The class configuration doesn't match the team requirements.");
|
||||
}
|
||||
|
||||
// Validate team default requirements.
|
||||
if (!ClassValidateTeamDefaults())
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: Couldn't find a default class for one or more teams. At least one class per team must be marked as default.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Couldn't find a default class for one or more teams. At least one class per team must be marked as default.");
|
||||
}
|
||||
|
||||
// Cache class data.
|
||||
@ -459,7 +459,7 @@ ClassLoad()
|
||||
ClassValidated = true;
|
||||
|
||||
// Log summary.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", ClassCount, ClassCount - failedcount, failedcount);
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", ClassCount, ClassCount - failedcount, failedcount);
|
||||
|
||||
// Set config data.
|
||||
ConfigSetConfigLoaded(File_Classes, true);
|
||||
@ -657,7 +657,7 @@ ClassClientSetDefaultIndexes(client = -1)
|
||||
{
|
||||
// Invalid class index. Fall back to default class in class config and
|
||||
// log a warning.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Classes", "Set Default Indexes", "Warning: Failed to get default zombie class, falling back to default class in class config. Check spelling in \"zr_classes_default_zombie\".");
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Set Default Indexes", "Warning: Failed to get default zombie class, falling back to default class in class config. Check spelling in \"zr_classes_default_zombie\".");
|
||||
|
||||
// Use default class.
|
||||
zombieindex = ClassGetDefaultClass(ZR_CLASS_TEAM_ZOMBIES);
|
||||
@ -668,7 +668,7 @@ ClassClientSetDefaultIndexes(client = -1)
|
||||
{
|
||||
// Invalid class index. Fall back to default class in class config and
|
||||
// log a warning.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Classes", "Set Default Indexes", "Warning: Failed to get default human class, falling back to default class in class config. Check spelling in \"zr_classes_default_human\".");
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Set Default Indexes", "Warning: Failed to get default human class, falling back to default class in class config. Check spelling in \"zr_classes_default_human\".");
|
||||
|
||||
// Use default class.
|
||||
humanindex = ClassGetDefaultClass(ZR_CLASS_TEAM_HUMANS);
|
||||
|
@ -66,7 +66,7 @@ bool:AmbientSoundsValidateConfig()
|
||||
if (!FileExists(sound, true))
|
||||
{
|
||||
// Log invalid sound file error.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Invalid sound file specified in \"zr_ambientsounds_file\".");
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Soundeffects, "Config Validation", "Invalid sound file specified in \"zr_ambientsounds_file\": %s", sound);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ bool:AmbientSoundsValidateConfig()
|
||||
if (ambientvolume <= 0.0)
|
||||
{
|
||||
// Log invalid ambient sound volume error.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Ambient sound is either muted or invalid.");
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Soundeffects, "Config Validation", "Ambient sound volume specified in \"zr_ambientsounds_volume\"is either muted or invalid.");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -85,7 +85,7 @@ bool:AmbientSoundsValidateConfig()
|
||||
if (ambientlength <= 0.0)
|
||||
{
|
||||
// Log invalid ambient sound length error.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Specified ambient sound length is invalid.");
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Soundeffects, "Config Validation", "Ambient sound length specified in \"zr_ambientsounds_length\" is invalid.");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -59,42 +59,42 @@ ToolsFindOffsets()
|
||||
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
|
||||
if (g_iToolsVelocity == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecVelocity[0]\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBasePlayer::m_vecVelocity[0]\" was not found.");
|
||||
}
|
||||
|
||||
// If offset "m_vecBaseVelocity" can't be found, then stop the plugin.
|
||||
g_iToolsBaseVelocity = FindSendPropInfo("CBasePlayer", "m_vecBaseVelocity");
|
||||
if (g_iToolsBaseVelocity == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecBaseVelocity\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBasePlayer::m_vecBaseVelocity\" was not found.");
|
||||
}
|
||||
|
||||
// If offset "m_flLaggedMovementValue" can't be found, then stop the plugin.
|
||||
g_iToolsLMV = FindSendPropInfo("CCSPlayer", "m_flLaggedMovementValue");
|
||||
if (g_iToolsLMV == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_flLaggedMovementValue\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CCSPlayer::m_flLaggedMovementValue\" was not found.");
|
||||
}
|
||||
|
||||
// If offset "m_bHasNightVision" can't be found, then stop the plugin.
|
||||
g_iToolsHasNightVision = FindSendPropInfo("CCSPlayer", "m_bHasNightVision");
|
||||
if (g_iToolsHasNightVision == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bHasNightVision\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CCSPlayer::m_bHasNightVision\" was not found.");
|
||||
}
|
||||
|
||||
// If offset "m_bNightVisionOn" can't be found, then stop the plugin.
|
||||
g_iToolsNightVisionOn = FindSendPropInfo("CCSPlayer", "m_bNightVisionOn");
|
||||
if (g_iToolsNightVisionOn == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bNightVisionOn\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CCSPlayer::m_bNightVisionOn\" was not found.");
|
||||
}
|
||||
|
||||
// If offset "m_iDefaultFOV" can't be found, then stop the plugin.
|
||||
g_iToolsDefaultFOV = FindSendPropInfo("CBasePlayer", "m_iDefaultFOV");
|
||||
if (g_iToolsDefaultFOV == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_iDefaultFOV\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBasePlayer::m_iDefaultFOV\" was not found.");
|
||||
}
|
||||
|
||||
// Forward event to modules.
|
||||
@ -115,7 +115,7 @@ ToolsSetupGameData()
|
||||
// If gamedata file can't be loaded, then stop the plugin.
|
||||
if (g_hToolsGameConfig == INVALID_HANDLE)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Can't load game config file (plugin.zombiereloaded.txt) from the gamedata directory.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "GameData", "Can't load game config file (plugin.zombiereloaded.txt) from the gamedata directory.");
|
||||
}
|
||||
|
||||
// Prep the SDKCall for "EyeAngles."
|
||||
@ -127,7 +127,7 @@ ToolsSetupGameData()
|
||||
// If offset "EyeAngles" can't be found, then stop the plugin.
|
||||
if(g_hToolsEyeAngles == INVALID_HANDLE)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Offset \"EyeAngles\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "GameData", "Offset \"EyeAngles\" was not found.");
|
||||
}
|
||||
|
||||
// Prep the SDKCall for "TerminateRound."
|
||||
@ -140,7 +140,7 @@ ToolsSetupGameData()
|
||||
// If offset "TerminateRound" can't be found, then stop the plugin.
|
||||
if(g_hToolsTerminateRound == INVALID_HANDLE)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Signature \"CGameRules::TerminateRound\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "GameData", "Signature \"CGameRules::TerminateRound\" was not found.");
|
||||
}
|
||||
|
||||
// Prep the SDKCall for "CSWeaponDrop."
|
||||
@ -154,6 +154,6 @@ ToolsSetupGameData()
|
||||
// If offset "CSWeaponDrop" can't be found, then stop the plugin.
|
||||
if(g_hToolsCSWeaponDrop == INVALID_HANDLE)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Signature \"CBasePlaye::CSWeaponDrop\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "GameData", "Signature \"CBasePlaye::CSWeaponDrop\" was not found.");
|
||||
}
|
||||
}
|
||||
|
@ -28,14 +28,14 @@ WeaponAmmoOnOffsetsFound()
|
||||
g_iToolsClip1 = FindSendPropInfo("CBaseCombatWeapon", "m_iClip1");
|
||||
if (g_iToolsClip1 == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBaseCombatWeapon::m_iClip1\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Weapons, "Offsets", "Offset \"CBaseCombatWeapon::m_iClip1\" was not found.");
|
||||
}
|
||||
|
||||
// If offset "m_iClip2" can't be found, then stop the plugin.
|
||||
g_iToolsClip2 = FindSendPropInfo("CBaseCombatWeapon", "m_iClip2");
|
||||
if (g_iToolsClip2 == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBaseCombatWeapon::m_iClip2\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Weapons, "Offsets", "Offset \"CBaseCombatWeapon::m_iClip2\" was not found.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ WeaponsOnOffsetsFound()
|
||||
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
|
||||
if (g_iToolsActiveWeapon == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_hActiveWeapon\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Weapons, "Offsets", "Offset \"CBasePlayer::m_hActiveWeapon\" was not found.");
|
||||
}
|
||||
|
||||
// Forward event to sub-modules
|
||||
@ -126,7 +126,7 @@ WeaponsLoad()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure.
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "Missing weapons config file: %s", pathweapons);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Weapons, "Config Validation", "Missing weapons config file: %s", pathweapons);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -140,7 +140,7 @@ WeaponsLoad()
|
||||
// Unexpected error, stop plugin.
|
||||
if (!success)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "Unexpected error encountered loading: %s", pathweapons);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Weapons, "Config Validation", "Unexpected error encountered loading: %s", pathweapons);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -149,7 +149,7 @@ WeaponsLoad()
|
||||
new size = GetArraySize(arrayWeapons);
|
||||
if (!size)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "No usable data found in weapons config file: %s", pathweapons);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Weapons, "Config Validation", "No usable data found in weapons config file: %s", pathweapons);
|
||||
}
|
||||
|
||||
// Now copy data to array structure.
|
||||
@ -179,7 +179,7 @@ WeaponsCacheData()
|
||||
|
||||
if (!success)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "Unexpected error caching data from weapons config file: %s", pathweapons);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Weapons, "Config Validation", "Unexpected error caching data from weapons config file: %s", pathweapons);
|
||||
}
|
||||
|
||||
decl String:weaponname[WEAPONS_MAX_LENGTH];
|
||||
@ -192,7 +192,7 @@ WeaponsCacheData()
|
||||
KvRewind(kvWeapons);
|
||||
if (!KvJumpToKey(kvWeapons, weaponname))
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "Couldn't cache weapon data for: %s (check weapons config)", weaponname);
|
||||
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Weapons, "Config Validation", "Couldn't cache weapon data for: %s (check weapons config)", weaponname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ ZMarketOnOffsetsFound()
|
||||
g_iToolsInBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone");
|
||||
if (g_iToolsInBuyZone == -1)
|
||||
{
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.");
|
||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Weapons, "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user