Began adding cvar descriptions, recoded logging module, fixed zmenu display bug, removed include line for anticamp until recoded.
This commit is contained in:
parent
ef5dd66890
commit
055e89d64a
@ -22,6 +22,13 @@
|
|||||||
|
|
||||||
// General
|
// General
|
||||||
|
|
||||||
|
"Literal text"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "{1}"
|
||||||
|
}
|
||||||
|
// Set string to "{1}" for all languages.
|
||||||
|
|
||||||
"Feature is disabled"
|
"Feature is disabled"
|
||||||
{
|
{
|
||||||
"en" "This feature is currently disabled by the server host."
|
"en" "This feature is currently disabled by the server host."
|
||||||
@ -173,31 +180,37 @@
|
|||||||
|
|
||||||
"Menu main zadmin"
|
"Menu main zadmin"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZAdmin ({1}) - Open admin menu."
|
"en" "ZAdmin ({1}) - Open admin menu."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main zclass"
|
"Menu main zclass"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZClass ({1}) - Configure your class settings."
|
"en" "ZClass ({1}) - Configure your class settings."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main zspawn"
|
"Menu main zspawn"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZSpawn ({1}) - Join late? Use this to spawn."
|
"en" "ZSpawn ({1}) - Join late? Use this to spawn."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main ztele"
|
"Menu main ztele"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZTele ({1}) - Teleport back to your spawn location."
|
"en" "ZTele ({1}) - Teleport back to your spawn location."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main zhp"
|
"Menu main zhp"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZHP ({1}) - Toggle real HP display when infected."
|
"en" "ZHP ({1}) - Toggle real HP display when infected."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Menu main zmarket"
|
"Menu main zmarket"
|
||||||
{
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
"en" "ZMarket ({1}) - Need a weapon? Buy them here."
|
"en" "ZMarket ({1}) - Need a weapon? Buy them here."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
// Core includes.
|
// Core includes.
|
||||||
#include "zr/zombiereloaded"
|
#include "zr/zombiereloaded"
|
||||||
#include "zr/log"
|
#include "zr/translation"
|
||||||
#include "zr/cvars"
|
#include "zr/cvars"
|
||||||
|
#include "zr/log"
|
||||||
#include "zr/config"
|
#include "zr/config"
|
||||||
#include "zr/serial"
|
#include "zr/serial"
|
||||||
#include "zr/translation"
|
|
||||||
#include "zr/sayhooks"
|
#include "zr/sayhooks"
|
||||||
#include "zr/tools"
|
#include "zr/tools"
|
||||||
#include "zr/models"
|
#include "zr/models"
|
||||||
@ -57,7 +57,7 @@
|
|||||||
#include "zr/ztele"
|
#include "zr/ztele"
|
||||||
#include "zr/zhp"
|
#include "zr/zhp"
|
||||||
#include "zr/jumpboost"
|
#include "zr/jumpboost"
|
||||||
#include "zr/anticamp"
|
//#include "zr/anticamp"
|
||||||
|
|
||||||
// Almost replaced! :)
|
// Almost replaced! :)
|
||||||
#include "zr/zombie"
|
#include "zr/zombie"
|
||||||
@ -95,36 +95,15 @@ public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
|
|||||||
*/
|
*/
|
||||||
public OnPluginStart()
|
public OnPluginStart()
|
||||||
{
|
{
|
||||||
// Load translations phrases used by plugin.
|
// Forward event to modules.
|
||||||
LoadTranslations("common.phrases.txt");
|
TranslationInit();
|
||||||
LoadTranslations("zombiereloaded.phrases.txt");
|
|
||||||
|
|
||||||
// Log
|
|
||||||
LogInit();
|
|
||||||
|
|
||||||
// Cvars
|
|
||||||
CvarsInit();
|
CvarsInit();
|
||||||
|
|
||||||
// Tools
|
|
||||||
ToolsInit();
|
ToolsInit();
|
||||||
|
|
||||||
// Commands
|
|
||||||
CommandsInit();
|
CommandsInit();
|
||||||
|
|
||||||
// Weapons
|
|
||||||
WeaponsInit();
|
WeaponsInit();
|
||||||
|
|
||||||
// Say Hooks
|
|
||||||
SayHooksInit();
|
SayHooksInit();
|
||||||
|
|
||||||
// Event
|
|
||||||
EventInit();
|
EventInit();
|
||||||
|
MarketInit();
|
||||||
// Set market variable to true if market is installed.
|
|
||||||
g_bMarket = LibraryExists("market");
|
|
||||||
|
|
||||||
// Create public cvar for tracking.
|
|
||||||
CreateConVar("gs_zombiereloaded_version", VERSION, "[ZR] Current version of this plugin", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,7 +147,6 @@ public OnMapStart()
|
|||||||
SEffectsOnMapStart();
|
SEffectsOnMapStart();
|
||||||
AntiStickOnMapStart();
|
AntiStickOnMapStart();
|
||||||
ZSpawnOnMapStart();
|
ZSpawnOnMapStart();
|
||||||
Anticamp_Startup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -177,7 +155,6 @@ public OnMapStart()
|
|||||||
public OnMapEnd()
|
public OnMapEnd()
|
||||||
{
|
{
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
Anticamp_Disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -352,7 +352,7 @@ HurtPlayersInVolume(volume_index)
|
|||||||
{
|
{
|
||||||
if (IsPlayerInVolume(x, volume_index))
|
if (IsPlayerInVolume(x, volume_index))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(x, "Unfair camping");
|
TranslationPrintToChat(x, "Unfair camping");
|
||||||
client_health = GetClientHealth(x) - volumes[volume_index][volume_damage];
|
client_health = GetClientHealth(x) - volumes[volume_index][volume_damage];
|
||||||
if (client_health > 0)
|
if (client_health > 0)
|
||||||
{
|
{
|
||||||
|
@ -89,10 +89,7 @@ ConfigLoad()
|
|||||||
ServerCommand("exec %s", mapconfig);
|
ServerCommand("exec %s", mapconfig);
|
||||||
|
|
||||||
// Log action.
|
// Log action.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS))
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Config", "Map Configs", "Executed map config file: %s", path);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "", "", "Executed map config file: %s.", LOG_FORMAT_TYPE_SIMPLE, mapconfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +103,6 @@ ConfigOnModulesLoaded()
|
|||||||
decl String:mapname[256];
|
decl String:mapname[256];
|
||||||
decl String:mapconfig[PLATFORM_MAX_PATH];
|
decl String:mapconfig[PLATFORM_MAX_PATH];
|
||||||
decl String:path[PLATFORM_MAX_PATH];
|
decl String:path[PLATFORM_MAX_PATH];
|
||||||
new bool:cfgexists;
|
|
||||||
|
|
||||||
// Get map name and format into config path.
|
// Get map name and format into config path.
|
||||||
GetCurrentMap(mapname, sizeof(mapname));
|
GetCurrentMap(mapname, sizeof(mapname));
|
||||||
@ -120,7 +116,7 @@ ConfigOnModulesLoaded()
|
|||||||
// boolean first works.
|
// boolean first works.
|
||||||
|
|
||||||
// Check if the file exist.
|
// Check if the file exist.
|
||||||
cfgexists = FileExists(path);
|
new bool:cfgexists = FileExists(path);
|
||||||
if (!cfgexists)
|
if (!cfgexists)
|
||||||
{
|
{
|
||||||
// File doesn't exist, then stop.
|
// File doesn't exist, then stop.
|
||||||
@ -131,10 +127,7 @@ ConfigOnModulesLoaded()
|
|||||||
ServerCommand("exec %s", mapconfig);
|
ServerCommand("exec %s", mapconfig);
|
||||||
|
|
||||||
// Log action.
|
// Log action.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS))
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Config", "Map Configs", "Executed post map config file: %s", path);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "", "", "Executed post map config file: %s.", LOG_FORMAT_TYPE_SIMPLE, mapconfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,7 +148,6 @@ bool:ConfigGetFilePath(CvarsList:cvar, String:path[])
|
|||||||
return FileExists(path);
|
return FileExists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates, deletes, sets, or gets any key/setting of any ZR config keyvalue file in memory.
|
* Creates, deletes, sets, or gets any key/setting of any ZR config keyvalue file in memory.
|
||||||
* Only use when interacting with a command or manipulating single keys/values,
|
* Only use when interacting with a command or manipulating single keys/values,
|
||||||
|
@ -25,6 +25,15 @@
|
|||||||
enum CvarsList
|
enum CvarsList
|
||||||
{
|
{
|
||||||
Handle:CVAR_ENABLE,
|
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_PRINT_ADMINS,
|
||||||
|
Handle:CVAR_LOG_PRINT_CHAT,
|
||||||
|
Handle:CVAR_LOG_PRINT_CONSOLE,
|
||||||
Handle:CVAR_CONFIG_PATH_MODELS,
|
Handle:CVAR_CONFIG_PATH_MODELS,
|
||||||
Handle:CVAR_CONFIG_PATH_DOWNLOADS,
|
Handle:CVAR_CONFIG_PATH_DOWNLOADS,
|
||||||
Handle:CVAR_CONFIG_PATH_PLAYERCLASSES,
|
Handle:CVAR_CONFIG_PATH_PLAYERCLASSES,
|
||||||
@ -157,6 +166,11 @@ CvarsInit()
|
|||||||
// Hook cvars.
|
// Hook cvars.
|
||||||
CvarsHook();
|
CvarsHook();
|
||||||
|
|
||||||
|
// Create public cvar for tracking.
|
||||||
|
decl String:description[64];
|
||||||
|
Format(description, sizeof(description), "%s Current version of this plugin", TRANSLATION_PHRASE_PREFIX);
|
||||||
|
CreateConVar("gs_zombiereloaded_version", VERSION, description, FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
VEffectsOnCvarInit();
|
VEffectsOnCvarInit();
|
||||||
}
|
}
|
||||||
@ -191,7 +205,13 @@ CvarsCreate()
|
|||||||
// Log (core)
|
// Log (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
// Cvars created in log.inc, because of compilation problems when creating them here.
|
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 withinin this string, log will be suppressed.");
|
||||||
|
g_hCvarsList[CVAR_LOG_FILTER_DESCRIPTION] = CreateConVar("zr_log_filter_description", "", "If any log description is within this string, log will be suppressed.");
|
||||||
|
g_hCvarsList[CVAR_LOG_FILTER_DEBUG] = CreateConVar("zr_log_filter_debug", "1", "Supresses debug messages.");
|
||||||
|
g_hCvarsList[CVAR_LOG_PRINT_ADMINS] = CreateConVar("zr_log_print_admins", "0", "Print all logs to currently connected admins.");
|
||||||
|
g_hCvarsList[CVAR_LOG_PRINT_CHAT] = CreateConVar("zr_log_print_chat", "1", "Print log to admin's chat area.");
|
||||||
|
g_hCvarsList[CVAR_LOG_PRINT_CONSOLE] = CreateConVar("zr_log_print_console", "1", "Print log to admin's console.");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Translations (core)
|
// Translations (core)
|
||||||
@ -203,12 +223,12 @@ CvarsCreate()
|
|||||||
// Config (core)
|
// Config (core)
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_MODELS] = CreateConVar("zr_config_path_models", "configs/zr/models.txt", "");
|
g_hCvarsList[CVAR_CONFIG_PATH_MODELS] = CreateConVar("zr_config_path_models", "configs/zr/models.txt", "Path to models config file. [Relative to root sourcemod directory]");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_DOWNLOADS] = CreateConVar("zr_config_path_downloads", "configs/zr/downloads.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_DOWNLOADS] = CreateConVar("zr_config_path_downloads", "configs/zr/downloads.txt", "Path to downloads file. [Relative to root sourcemod directory]");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_PLAYERCLASSES] = CreateConVar("zr_config_path_playerclasses", "configs/zr/playerclasses.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_PLAYERCLASSES] = CreateConVar("zr_config_path_playerclasses", "configs/zr/playerclasses.txt", "Path to playerclasses config file. [Relative to root sourcemod directory]");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONS] = CreateConVar("zr_config_path_weapons", "configs/zr/weapons/weapons.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONS] = CreateConVar("zr_config_path_weapons", "configs/zr/weapons/weapons.txt", "Path to weapons config file. [Relative to root sourcemod directory]");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONGROUPS] = CreateConVar("zr_config_path_weapongroups", "configs/zr/weapons/weapongroups.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONGROUPS] = CreateConVar("zr_config_path_weapongroups", "configs/zr/weapons/weapongroups.txt", "Path to weapongroups config file. [Relative to root sourcemod directory]");
|
||||||
g_hCvarsList[CVAR_CONFIG_PATH_HITGROUPS] = CreateConVar("zr_config_path_hitgroups", "configs/zr/hitgroups.txt");
|
g_hCvarsList[CVAR_CONFIG_PATH_HITGROUPS] = CreateConVar("zr_config_path_hitgroups", "configs/zr/hitgroups.txt", "Path to hitgroups config file. [Relative to root sourcemod directory]");
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Tools (core)
|
// Tools (core)
|
||||||
@ -228,24 +248,17 @@ CvarsCreate()
|
|||||||
|
|
||||||
// General
|
// General
|
||||||
|
|
||||||
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "");
|
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "Re-display class selection menu every spawn.");
|
||||||
// Old Desc: Classmenu is re-displayed every spawn (0: Disable)
|
g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "Player is assigned a random class every spawn [Override: zr_classes_spawn & zr_classes_default_*]");
|
||||||
g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "");
|
g_hCvarsList[CVAR_CLASSES_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "Zombie class assigned to players on connect ['random' = Random class | '""' = Class config default]");
|
||||||
// Old Desc: A random class is assigned to each player every round. Overrides zr_classes_spawn and default classes. (0: Disable)
|
g_hCvarsList[CVAR_CLASSES_DEFAULT_HUMAN] = CreateConVar("zr_classes_default_human", "random", "Human class assigned to players on connect ['random' = Random class | '""' = Class config default]");");
|
||||||
g_hCvarsList[CVAR_CLASSES_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "");
|
g_hCvarsList[CVAR_CLASSES_DEFAULT_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "Admin class assigned to admins on connect ['random' = Random class | '""' = Class config default]");");
|
||||||
// Old Desc: Default zombie class selected for all players when they connect. Use \"random\" to select a random class, or blank to use class config defaults.
|
|
||||||
g_hCvarsList[CVAR_CLASSES_DEFAULT_HUMAN] = CreateConVar("zr_classes_default_human", "random", "");
|
|
||||||
// Old Desc:
|
|
||||||
g_hCvarsList[CVAR_CLASSES_DEFAULT_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "");
|
|
||||||
// Old Desc: Default admin-only class selected for admins when they connect. Use \"random\" to select a random class, or blank to use class config defaults.
|
|
||||||
|
|
||||||
// Overlays
|
// Overlays
|
||||||
|
|
||||||
g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE] = CreateConVar("zr_classes_overlay_toggle", "1", "");
|
g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE] = CreateConVar("zr_classes_overlay_toggle", "1", "Allow players to toggle class overlay.");
|
||||||
// Desc: Allow clients to toggle class overlay, zr_classes_overlay_default will be applied on connect.
|
g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS] = CreateConVar("zr_classes_overlay_togglecmds", "nightvision", "List of commands to hook that players can use to toggle class overlay. [Reliance: zr_classes_overlay_toggle | Delimited by \", \"]");
|
||||||
g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS] = CreateConVar("zr_classes_overlay_togglecmds", "nightvision", "");
|
g_hCvarsList[CVAR_CLASSES_OVERLAY_DEFAULT] = CreateConVar("zr_classes_overlay_default", "0", "Default class overlay toggle state [Reliance: zr_classes_overlay_toggle]");
|
||||||
g_hCvarsList[CVAR_CLASSES_OVERLAY_DEFAULT] = CreateConVar("zr_classes_overlay_default", "0", "");
|
|
||||||
// Desc: Default toggle value of class overlay. [Ignored when zr_classes_overlay_toggle is disabled.]
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Weapons (core)
|
// Weapons (core)
|
||||||
@ -537,10 +550,6 @@ CvarsHook(bool:unhook = false)
|
|||||||
HookConVarChange(g_hAutoTeamBalance, CvarsHookLocked);
|
HookConVarChange(g_hAutoTeamBalance, CvarsHookLocked);
|
||||||
HookConVarChange(g_hLimitTeams, CvarsHookLocked);
|
HookConVarChange(g_hLimitTeams, CvarsHookLocked);
|
||||||
HookConVarChange(g_hRestartGame, CvarsHookRestartGame);
|
HookConVarChange(g_hRestartGame, CvarsHookRestartGame);
|
||||||
|
|
||||||
// Anticamp shtuff. (needs to be moved to anticamp if these hooks are necessary)
|
|
||||||
HookConVarChange(g_hCvarsList[CVAR_ANTICAMP], AnticampHook);
|
|
||||||
HookConVarChange(g_hCvarsList[CVAR_ANTICAMP_UPDATE_INTERVAL], UpdateIntervalHook);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -566,10 +575,7 @@ public CvarsHookLocked(Handle:cvar, const String:oldvalue[], const String:newval
|
|||||||
SetConVarInt(g_hAutoTeamBalance, CVARS_AUTOTEAMBALANCE_LOCKED);
|
SetConVarInt(g_hAutoTeamBalance, CVARS_AUTOTEAMBALANCE_LOCKED);
|
||||||
|
|
||||||
// If log flag check fails, then don't log.
|
// If log flag check fails, then don't log.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
LogPrintToLog(_, "Cvars", "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Cvars", "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".", LOG_FORMAT_TYPE_FULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// If cvar is mp_limitteams, then continue.
|
// If cvar is mp_limitteams, then continue.
|
||||||
else if (cvar == g_hLimitTeams)
|
else if (cvar == g_hLimitTeams)
|
||||||
@ -584,10 +590,7 @@ public CvarsHookLocked(Handle:cvar, const String:oldvalue[], const String:newval
|
|||||||
SetConVarInt(g_hLimitTeams, CVARS_LIMITTEAMS_LOCKED);
|
SetConVarInt(g_hLimitTeams, CVARS_LIMITTEAMS_LOCKED);
|
||||||
|
|
||||||
// If log flag check fails, then don't log.
|
// If log flag check fails, then don't log.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
LogPrintToLog(_, "Cvars", "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Cvars", "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".", LOG_FORMAT_TYPE_FULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,8 +618,5 @@ public CvarsHookRestartGame(Handle:cvar, const String:oldvalue[], const String:n
|
|||||||
RoundEndTerminateRound(delay);
|
RoundEndTerminateRound(delay);
|
||||||
|
|
||||||
// If log flag check fails, then don't log.
|
// If log flag check fails, then don't log.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
LogPrintToLog(_, "Cvars", "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Cvars", "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.", LOG_FORMAT_TYPE_FULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -275,14 +275,6 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
|||||||
*/
|
*/
|
||||||
public Action:DamageSuicideIntercept(client, argc)
|
public Action:DamageSuicideIntercept(client, argc)
|
||||||
{
|
{
|
||||||
// Disabled.
|
|
||||||
/**
|
|
||||||
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
|
||||||
if (!enabled)
|
|
||||||
{
|
|
||||||
return Plugin_Continue;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// If zombie hasn't spawned, then stop.
|
// If zombie hasn't spawned, then stop.
|
||||||
if (!g_bZombieSpawned)
|
if (!g_bZombieSpawned)
|
||||||
{
|
{
|
||||||
@ -318,13 +310,10 @@ public Action:DamageSuicideIntercept(client, argc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tell client their command has been intercepted.
|
// Tell client their command has been intercepted.
|
||||||
ZR_ReplyToCommand(client, "Damage suicide intercept");
|
TranslationReplyToCommand(client, "Damage suicide intercept");
|
||||||
|
|
||||||
// Log attempt.
|
// Log suicide interception
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_DAMAGE))
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Damage", "Suicide Intercept", "\"%L\" attempted suicide.", client);
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Damage", "Suicide Intercept", "Player %N attempted suicide.", LOG_FORMAT_TYPE_FULL, client);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Block command.
|
// Block command.
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
@ -66,7 +66,8 @@ EventHook(bool:unhook = false)
|
|||||||
*/
|
*/
|
||||||
public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(0, "General round objective");
|
// Print round objective to all clients.
|
||||||
|
TranslationPrintToChatAll(true, false, "General round objective");
|
||||||
|
|
||||||
// Forward event to sub-modules.
|
// Forward event to sub-modules.
|
||||||
OverlaysOnRoundStart();
|
OverlaysOnRoundStart();
|
||||||
@ -183,7 +184,7 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad
|
|||||||
ZTeleOnClientSpawn(index);
|
ZTeleOnClientSpawn(index);
|
||||||
ZHPOnClientSpawn(index);
|
ZHPOnClientSpawn(index);
|
||||||
|
|
||||||
ZR_PrintToChat(index, "General zmenu reminder");
|
TranslationPrintToChat(index, "General zmenu reminder");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,11 +69,7 @@ HitgroupsLoad()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log failure.
|
// Log failure.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_HITGROUPS))
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Hitgroups", "Config Validation", "Missing hitgroups config file: %s", pathhitgroups);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Hitgroups", "Config Validation", "Missing hitgroups config file: %s", LOG_FORMAT_TYPE_ERROR, pathhitgroups);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,16 +85,11 @@ HitgroupsLoad()
|
|||||||
*/
|
*/
|
||||||
HitgroupsValidateConfig()
|
HitgroupsValidateConfig()
|
||||||
{
|
{
|
||||||
// If log flag check fails, then don't log.
|
|
||||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_HITGROUPS))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
KvRewind(kvHitgroups);
|
KvRewind(kvHitgroups);
|
||||||
if (!KvGotoFirstSubKey(kvHitgroups))
|
if (!KvGotoFirstSubKey(kvHitgroups))
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Hitgroups", "Config Validation", "No hitgroups listed in hitgroups.txt, disabling hitgroup-based modules.", LOG_FORMAT_TYPE_FULL);
|
// Log that no data was loaded from hitgroup file.
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Hitgroups", "Config Validation", "No hitgroups listed in hitgroups.txt, disabling hitgroup-based modules.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ InfectOnClientDisconnect(client)
|
|||||||
InfectClient(randclient);
|
InfectClient(randclient);
|
||||||
|
|
||||||
// Tell client they have been randomly been chosen to replace disconnecting zombie.
|
// Tell client they have been randomly been chosen to replace disconnecting zombie.
|
||||||
ZR_PrintToChat(randclient, "Infect disconnect");
|
TranslationPrintToChat(randclient, "Infect disconnect");
|
||||||
|
|
||||||
// Destroy handle.
|
// Destroy handle.
|
||||||
CloseHandle(arrayEligibleClients);
|
CloseHandle(arrayEligibleClients);
|
||||||
@ -569,7 +569,7 @@ InfectClient(client, attacker = -1, bool:motherinfect = false)
|
|||||||
SetGlobalTransTarget(client);
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
// Print message to client.
|
// Print message to client.
|
||||||
ZR_PrintToChat(client, "Infect infected");
|
TranslationPrintToChat(client, "Infect infected");
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
ClassOnClientInfected(client, motherinfect);
|
ClassOnClientInfected(client, motherinfect);
|
||||||
|
232
src/zr/log.inc
232
src/zr/log.inc
@ -22,225 +22,101 @@
|
|||||||
/**
|
/**
|
||||||
* @section Log format types
|
* @section Log format types
|
||||||
*/
|
*/
|
||||||
#define LOG_FORMAT_TYPE_SIMPLE 0 /** Simple log message. */
|
#define LOG_FORMAT_TYPE_NORMAL 1 /** Printed in normal log. */
|
||||||
#define LOG_FORMAT_TYPE_FULL 1 /** Full log message, printed in normal log. */
|
#define LOG_FORMAT_TYPE_DEBUG 2 /** Printed in normal log, flagged as debug. */
|
||||||
#define LOG_FORMAT_TYPE_ERROR 2 /** Full log message, printed in error log. */
|
#define LOG_FORMAT_TYPE_ERROR 3 /** Printed in error log. */
|
||||||
#define LOG_FORMAT_TYPE_FATALERROR 3 /** Full log message, stops the plugin and printed in error logs. */
|
#define LOG_FORMAT_TYPE_FATALERROR 4 /** Stops the plugin + LOG_FORMAT_TYPE_ERROR */
|
||||||
/**
|
/**
|
||||||
* @endsection
|
* @endsection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @section Logging flags.
|
* Print a formatted message to logs or error logs.
|
||||||
*/
|
|
||||||
#define LOG_CORE_EVENTS 1 /** Config validation, other core events. */
|
|
||||||
#define LOG_GAME_EVENTS 2 /** Admin commands, suicide prevention, anticamp kills. */
|
|
||||||
#define LOG_PLAYER_COMMANDS 4 /** Commands executed by non-admins: zspawn, teleport, class change. */
|
|
||||||
#define LOG_DEBUG 8 /** Debug messages. */
|
|
||||||
#define LOG_DEBUG_DETAIL 16 /** Debug messages with more detail. May cause spam. */
|
|
||||||
#define LOG_DEBUG_MAX_DETAIL 32 /** Low level debug messages. Causes spam! Only enable for a limited period right before and after testing. */
|
|
||||||
#define LOG_TO_ADMINS 64 /** Copy kinds of log events to admin chat. */
|
|
||||||
#define LOG_TO_CLIENT 128 /** Copy all log events related to a player, to the players console. */
|
|
||||||
#define LOG_IGNORE_CONSOLE 256 /** Don't log messages from the console (client 0). */
|
|
||||||
#define LOG_MODULES_ENABLED 512 /** Enable module based log control. Module logs overrides previous flags, including debug flags. */
|
|
||||||
#define LOG_MODULE_CORE 1024 /** The core of the plugin (startup, loading configs, etc.). Not really a module. */
|
|
||||||
#define LOG_MODULE_COMMANDS 2048 /** commands.inc */
|
|
||||||
#define LOG_MODULE_CLASSES 4096 /** Class system - playerclasses/ *.inc */
|
|
||||||
#define LOG_MODULE_ZOMBIE 8192 /** zombie.inc */
|
|
||||||
#define LOG_MODULE_SAYTRIGGERS 16384 /** sayhooks.inc */
|
|
||||||
#define LOG_MODULE_AMBIENTSOUNDS 32768 /** ambientsounds.inc */
|
|
||||||
#define LOG_MODULE_OVERLAYS 65536 /** overlays.inc */
|
|
||||||
#define LOG_MODULE_TELEPORT 131072 /** teleport.inc */
|
|
||||||
#define LOG_MODULE_WEAPONS 262144 /** Weapons module - weapons/ *.inc */
|
|
||||||
#define LOG_MODULE_HITGROUPS 524288 /** hitgroups.inc */
|
|
||||||
#define LOG_MODULE_ANTICAMP 1048576 /** anticamp.inc */
|
|
||||||
#define LOG_MODULE_DAMAGE 2097152 /** damage.inc */
|
|
||||||
#define LOG_MODULE_OFFSETS 4194304 /** offsets.inc */
|
|
||||||
/*
|
|
||||||
* @endsection
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @section Global handles for modules cvars.
|
|
||||||
*/
|
|
||||||
new Handle:g_hLog = INVALID_HANDLE;
|
|
||||||
new Handle:g_hLogFlags = INVALID_HANDLE;
|
|
||||||
/**
|
|
||||||
* @endsection
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log module init function.
|
|
||||||
*/
|
|
||||||
LogInit()
|
|
||||||
{
|
|
||||||
// Create modules cvars.
|
|
||||||
g_hLog = CreateConVar("zr_log", "1", "");
|
|
||||||
g_hLogFlags = CreateConVar("zr_logflags", "331", "");
|
|
||||||
// Old Desc: Logging flags. Log messages to sourcemod logs, server console or client console. Use zr_log_flags to see a list of flags. (0: Disable)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs a formatted message with module and block info depending, on the type.
|
|
||||||
*
|
*
|
||||||
* @param client Specifies the client who triggered the event/command. Use
|
* @param type (Optional) Logging type. (See LOG_FORMAT_TYPE_* defines)
|
||||||
* -1 for core events like validation, etc.
|
* @param module Module the log belongs to.
|
||||||
* @param module what module the log event belongs to.
|
* @param description Short descriptive phrase to group together similar logs.
|
||||||
* @param block What function or code block the log is triggered from.
|
* @param text Text to print to log.
|
||||||
* @param message Log message. Formatted string.
|
* @param ... Formatting parameters.
|
||||||
* @param type Optional. What logging type or style to use. Options:
|
|
||||||
* LOG_FORMAT_TYPE_SIMPLE - Simple, no module or block info.
|
|
||||||
* LOG_FORMAT_TYPE_FULL - Full, with module and block info, printed in normal log.
|
|
||||||
* LOG_FORMAT_TYPE_ERROR - Full, printed in error log.
|
|
||||||
* LOG_FORMAT_TYPE_FATALERROR - Full, stops the plugin.
|
|
||||||
* @param any... Formatting parameters.
|
|
||||||
*/
|
*/
|
||||||
LogMessageFormatted(client, const String:module[], const String:block[], const String:message[], type = LOG_FORMAT_TYPE_FULL, any:...)
|
LogPrintToLog(type = LOG_FORMAT_TYPE_NORMAL, const String:module[], const String:description[], const String:text[], any:...)
|
||||||
{
|
{
|
||||||
// If logging is disabled, then stop.
|
// If logging is disabled, then stop.
|
||||||
new bool:log = GetConVarBool(g_hLog);
|
new bool:log = GetConVarBool(g_hCvarsList[CVAR_LOG]);
|
||||||
if (!log)
|
if (!log)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
decl String:logtext[LOG_MAX_LENGTH_FILE];
|
// If module is filtered, then stop.
|
||||||
|
decl String:filtermodules[256];
|
||||||
|
GetConVarString(g_hCvarsList[CVAR_LOG_FILTER_MODULES], filtermodules, sizeof(filtermodules));
|
||||||
|
|
||||||
// If client is invalid (console), and console log events are ignored, then stop.
|
if (StrContains(filtermodules, module, false) > -1)
|
||||||
if (client == 0 && LogCheckFlag(LOG_IGNORE_CONSOLE))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format log text.
|
// If description is filtered, then stop.
|
||||||
VFormat(logtext, sizeof(logtext), message, 6);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format extra parameters into the log buffer.
|
||||||
|
decl String:logbuffer[LOG_MAX_LENGTH_FILE];
|
||||||
|
VFormat(logbuffer, sizeof(logbuffer), text, 5);
|
||||||
|
|
||||||
|
// Format
|
||||||
|
Format(logbuffer, sizeof(logbuffer), "[%s]|[%s]: %s", module, description, logbuffer);
|
||||||
|
|
||||||
// Format other parameters onto the log text.
|
// Format other parameters onto the log text.
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
// Log type is simple.
|
// Log type is normal.
|
||||||
case LOG_FORMAT_TYPE_SIMPLE:
|
case LOG_FORMAT_TYPE_NORMAL:
|
||||||
{
|
{
|
||||||
LogMessage(logtext);
|
LogMessage(logbuffer);
|
||||||
}
|
|
||||||
// Log type is full.
|
|
||||||
case LOG_FORMAT_TYPE_FULL:
|
|
||||||
{
|
|
||||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
|
||||||
LogMessage(logtext);
|
|
||||||
}
|
}
|
||||||
// Log type is error.
|
// Log type is error.
|
||||||
case LOG_FORMAT_TYPE_ERROR:
|
case LOG_FORMAT_TYPE_ERROR:
|
||||||
{
|
{
|
||||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
LogError(logbuffer);
|
||||||
LogError(logtext);
|
|
||||||
}
|
}
|
||||||
|
// Log type is fatal error.
|
||||||
case LOG_FORMAT_TYPE_FATALERROR:
|
case LOG_FORMAT_TYPE_FATALERROR:
|
||||||
{
|
{
|
||||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
SetFailState(logbuffer);
|
||||||
SetFailState(logtext);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If log to admin flag is enabled, then print to admins.
|
// If print to admin cvar is enabled, then print to all connect admins.
|
||||||
if (LogCheckFlag(LOG_TO_ADMINS))
|
new bool:printadmins = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_ADMINS]);
|
||||||
|
if (printadmins)
|
||||||
{
|
{
|
||||||
// Print text to admins.
|
// Print text to admins.
|
||||||
LogToAdmins(logtext);
|
// Note: The phrase "Literal text" is a blank phrase to pass any string we want into it.
|
||||||
}
|
|
||||||
|
|
||||||
// If client is a valid client (but not console), and we log to client's then continue.
|
new bool:printchat = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CHAT]);
|
||||||
if (ZRIsClientValid(client) && LogCheckFlag(LOG_TO_CLIENT))
|
if (printchat)
|
||||||
{
|
{
|
||||||
// Set client as translation target.
|
TranslationPrintToChatAll(false, true, "Literal text", logbuffer);
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
// Print to client.
|
|
||||||
PrintToConsole(client, "[ZR] %s", logtext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogToAdmins(String:message[])
|
new bool:printconsole = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CONSOLE]);
|
||||||
|
if (printconsole)
|
||||||
{
|
{
|
||||||
decl String:buffer[LOG_MAX_LENGTH_CHAT];
|
TranslationPrintToConsoleAll(false, true, "Literal text", logbuffer);
|
||||||
|
|
||||||
// x = client index.
|
|
||||||
for (new x = 1; x < MaxClients; x++)
|
|
||||||
{
|
|
||||||
// If client isn't in-game, then stop.
|
|
||||||
if (!IsClientInGame(x))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If client isn't an admin, then stop.
|
|
||||||
if (!ZRIsClientAdmin(x))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set client as translation target.
|
|
||||||
SetGlobalTransTarget(x);
|
|
||||||
|
|
||||||
// Format message to admin, then print.
|
|
||||||
Format(buffer, sizeof(buffer), "[ZR] %s", message);
|
|
||||||
PrintToChat(x, buffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the zr_logflags cvar has a certain flag.
|
|
||||||
*
|
|
||||||
* @param flag The flag.
|
|
||||||
*/
|
|
||||||
bool:LogHasFlag(flag)
|
|
||||||
{
|
|
||||||
// Get log flags.
|
|
||||||
new logflags = GetConVarInt(g_hLogFlags);
|
|
||||||
|
|
||||||
// Return true if flag is found, false if not.
|
|
||||||
return bool:(logflags & flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a log message should be written depending on log flags. If module
|
|
||||||
* overrides are enabled only logs with it's module flag set will be logged.
|
|
||||||
*
|
|
||||||
* @param logtype Log type flag.
|
|
||||||
* @param modulefilter Specifies what module the log event belongs to.
|
|
||||||
* @return True if the event should be logged, false otherwise.
|
|
||||||
*/
|
|
||||||
bool:LogCheckFlag(logtype, modulefilter = 0)
|
|
||||||
{
|
|
||||||
if (modulefilter && (logtype & LOG_MODULES_ENABLED))
|
|
||||||
{
|
|
||||||
return bool:(logtype & modulefilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return LogHasFlag(logtype);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggles a log flag.
|
|
||||||
*
|
|
||||||
* @param flag The flag to toggle.
|
|
||||||
*/
|
|
||||||
LogToggleFlag(flag)
|
|
||||||
{
|
|
||||||
// Get current flags
|
|
||||||
new logflags = GetConVarInt(g_hLogFlags);
|
|
||||||
|
|
||||||
// If cvar contains flag, then remove it.
|
|
||||||
if (logflags & flag)
|
|
||||||
{
|
|
||||||
logflags = logflags - flag;
|
|
||||||
}
|
|
||||||
// If cvar doesn't have the flag, then add it.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logflags = logflags + flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set new value to logflags cvar.
|
|
||||||
SetConVarInt(g_hLogFlags, logflags);
|
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,6 @@ ModelsLoad()
|
|||||||
*/
|
*/
|
||||||
ModelsPrepModels()
|
ModelsPrepModels()
|
||||||
{
|
{
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE);
|
|
||||||
|
|
||||||
// Get models file path.
|
// Get models file path.
|
||||||
decl String:pathmodels[PLATFORM_MAX_PATH];
|
decl String:pathmodels[PLATFORM_MAX_PATH];
|
||||||
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_MODELS, pathmodels);
|
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_MODELS, pathmodels);
|
||||||
@ -51,7 +48,7 @@ ModelsPrepModels()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log failure and stop plugin.
|
// Log failure and stop plugin.
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "Fatal error: Missing models file: \"%s\"", LOG_FORMAT_TYPE_FATALERROR, pathmodels);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: Missing models file: \"%s\"", pathmodels);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If model array exists, then destroy it.
|
// If model array exists, then destroy it.
|
||||||
@ -65,7 +62,7 @@ ModelsPrepModels()
|
|||||||
// If array couldn't be created, then fail.
|
// If array couldn't be created, then fail.
|
||||||
if (arrayModelsList == INVALID_HANDLE)
|
if (arrayModelsList == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "Fatal error: Error parsing \"%s\"", LOG_FORMAT_TYPE_FATALERROR, pathmodels);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: Error parsing \"%s\"", pathmodels);
|
||||||
}
|
}
|
||||||
|
|
||||||
new modelcount;
|
new modelcount;
|
||||||
@ -155,26 +152,17 @@ ModelsPrepModels()
|
|||||||
x--;
|
x--;
|
||||||
|
|
||||||
// Log missing model files.
|
// Log missing model files.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Models", "Config Validation", "Missing model files on server (%s)", modelbase);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "Missing model files on server (%s)", LOG_FORMAT_TYPE_ERROR, modelbase);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log model validation info.
|
// Log model validation info.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Models", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", modelcount, modelvalidcount, modelcount - modelvalidcount);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", LOG_FORMAT_TYPE_FULL, modelcount, modelvalidcount, modelcount - modelvalidcount);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If none of the model paths are valid, then log and fail.
|
// If none of the model paths are valid, then log and fail.
|
||||||
if (!modelvalidcount)
|
if (!modelvalidcount)
|
||||||
{
|
{
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: No usable model paths in %s", pathmodels);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Models", "Config Validation", "No usable model paths in %s", LOG_FORMAT_TYPE_FATALERROR, pathmodels);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,9 +171,6 @@ ModelsPrepModels()
|
|||||||
*/
|
*/
|
||||||
ModelsPrepDownloads()
|
ModelsPrepDownloads()
|
||||||
{
|
{
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE);
|
|
||||||
|
|
||||||
// Get downloads file path.
|
// Get downloads file path.
|
||||||
decl String:pathdownloads[PLATFORM_MAX_PATH];
|
decl String:pathdownloads[PLATFORM_MAX_PATH];
|
||||||
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_DOWNLOADS, pathdownloads);
|
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_DOWNLOADS, pathdownloads);
|
||||||
@ -194,10 +179,7 @@ ModelsPrepDownloads()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log error, then stop.
|
// Log error, then stop.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Missing downloads file: \"%s\"", pathdownloads);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Missing downloads file: \"%s\"", LOG_FORMAT_TYPE_ERROR, pathdownloads);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -207,10 +189,7 @@ ModelsPrepDownloads()
|
|||||||
// If array couldn't be created, then fail.
|
// If array couldn't be created, then fail.
|
||||||
if (arrayModelsList == INVALID_HANDLE)
|
if (arrayModelsList == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Error parsing \"%s\"", pathdownloads);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Error parsing \"%s\"", LOG_FORMAT_TYPE_ERROR, pathdownloads);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new downloadcount;
|
new downloadcount;
|
||||||
@ -238,11 +217,7 @@ ModelsPrepDownloads()
|
|||||||
// Backtrack one index, because we deleted it out from under the loop.
|
// Backtrack one index, because we deleted it out from under the loop.
|
||||||
x--;
|
x--;
|
||||||
|
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Missing file \"%s\"", downloadpath);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Missing file \"%s\"", LOG_FORMAT_TYPE_ERROR, downloadpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,8 +229,5 @@ ModelsPrepDownloads()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Log model validation info.
|
// Log model validation info.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Downloads", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", downloadcount, downloadvalidcount, downloadcount - downloadvalidcount);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", LOG_FORMAT_TYPE_FULL, downloadcount, downloadvalidcount, downloadcount - downloadvalidcount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ OverlaysClientUpdateOverlay(client, OverlaysChannel:channel = OVERLAYS_CHANNEL_N
|
|||||||
// If client doesn't meet DXLevel requirement, then tell client, then stop.
|
// If client doesn't meet DXLevel requirement, then tell client, then stop.
|
||||||
if (g_iOverlaysDXL[client] < OVERLAYS_DXL_MIN)
|
if (g_iOverlaysDXL[client] < OVERLAYS_DXL_MIN)
|
||||||
{
|
{
|
||||||
ZR_PrintCenterText(client, "Overlays not supported", g_iOverlaysDXL[client], OVERLAYS_DXL_MIN);
|
TranslationPrintCenterText(client, "Overlays not supported", g_iOverlaysDXL[client], OVERLAYS_DXL_MIN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +92,20 @@ public Action:Command_ClassDump(client, argc)
|
|||||||
// Dump the specified cache.
|
// Dump the specified cache.
|
||||||
ReplyToCommand(client, "DUMPING CACHE: \"%s\" (%d classes total)\n========================================\n", type, ClassCount);
|
ReplyToCommand(client, "DUMPING CACHE: \"%s\" (%d classes total)\n========================================\n", type, ClassCount);
|
||||||
ClassDumpData(index, cachetype, buffer, sizeof(buffer));
|
ClassDumpData(index, cachetype, buffer, sizeof(buffer));
|
||||||
ZR_ReplyToCommandLong(client, buffer);
|
|
||||||
|
// Print all data to client.
|
||||||
|
decl String:partbuffer[1024];
|
||||||
|
new pos;
|
||||||
|
new cellswritten = 1; // Initialize for the loop.
|
||||||
|
|
||||||
|
while (cellswritten)
|
||||||
|
{
|
||||||
|
cellswritten = strcopy(partbuffer, sizeof(partbuffer), buffer[pos]);
|
||||||
|
ReplyToCommand(client, partbuffer);
|
||||||
|
pos += cellswritten;
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,12 +94,12 @@ ClassOnClientSpawn(client)
|
|||||||
// Mark zombie class as selected.
|
// Mark zombie class as selected.
|
||||||
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie;
|
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie;
|
||||||
ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES);
|
ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES);
|
||||||
ZR_PrintToChat(client, "Classes random assignment", classname);
|
TranslationPrintToChat(client, "Classes random assignment", classname);
|
||||||
|
|
||||||
// Mark human class as selected.
|
// Mark human class as selected.
|
||||||
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman;
|
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman;
|
||||||
ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS);
|
ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS);
|
||||||
ZR_PrintToChat(client, "Classes random assignment", classname);
|
TranslationPrintToChat(client, "Classes random assignment", classname);
|
||||||
|
|
||||||
// Update player cache with the human class data, and apply it.
|
// Update player cache with the human class data, and apply it.
|
||||||
ClassReloadPlayerCache(client, randomhuman);
|
ClassReloadPlayerCache(client, randomhuman);
|
||||||
|
@ -81,7 +81,7 @@ ClassOverlayOnClientSpawn(client)
|
|||||||
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
||||||
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
|
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
|
||||||
|
|
||||||
ZR_HudHint(client, "Classes overlay toggle", togglecmds);
|
TranslationPrintHUDText(client, "Classes overlay toggle", togglecmds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ ClassOverlayOnClientInfected(client)
|
|||||||
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
||||||
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
|
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
|
||||||
|
|
||||||
ZR_PrintCenterText(client, "Classes overlay toggle", togglecmds);
|
TranslationPrintCenterText(client, "Classes overlay toggle", togglecmds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,9 +674,6 @@ ClassGetDefaultSpawnClass(teamid, cachetype = ZR_CLASS_CACHE_MODIFIED)
|
|||||||
decl String:classname[64];
|
decl String:classname[64];
|
||||||
new classindex;
|
new classindex;
|
||||||
|
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES);
|
|
||||||
|
|
||||||
// Get the default class name from the correct CVAR depending on teamid.
|
// Get the default class name from the correct CVAR depending on teamid.
|
||||||
switch (teamid)
|
switch (teamid)
|
||||||
{
|
{
|
||||||
@ -740,20 +737,13 @@ ClassGetDefaultSpawnClass(teamid, cachetype = ZR_CLASS_CACHE_MODIFIED)
|
|||||||
// in the specified team, and log a warning.
|
// in the specified team, and log a warning.
|
||||||
classindex = ClassGetFirstClass(teamid, _, cachetype);
|
classindex = ClassGetFirstClass(teamid, _, cachetype);
|
||||||
|
|
||||||
if (enablelog)
|
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);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "DefaultSpawnClass", "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.
|
// Validate the new index.
|
||||||
if (ClassValidateIndex(classindex))
|
if (ClassValidateIndex(classindex))
|
||||||
{
|
{
|
||||||
// Log a warning.
|
// Log a warning.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Default Spawn Class", "Warning: The default class name \"%s\" does not exist or matches the team ID.", classname);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "DefaultSpawnClass", "Warning: The default class name \"%s\" does not exist or matches the team ID.", _, classname);
|
|
||||||
}
|
|
||||||
|
|
||||||
return classindex;
|
return classindex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -322,9 +322,6 @@ new ClassPlayerNextAdminClass[MAXPLAYERS + 1];
|
|||||||
*/
|
*/
|
||||||
ClassLoad()
|
ClassLoad()
|
||||||
{
|
{
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES);
|
|
||||||
|
|
||||||
// Make sure kvClassData is ready to use.
|
// Make sure kvClassData is ready to use.
|
||||||
if (kvClassData != INVALID_HANDLE)
|
if (kvClassData != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
@ -339,16 +336,12 @@ ClassLoad()
|
|||||||
// If file doesn't exist, then log and stop.
|
// If file doesn't exist, then log and stop.
|
||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Classes", "Load", "Fatal error: Missing playerclasses config file \"%s\"", LOG_FORMAT_TYPE_FATALERROR, pathclasses);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: Missing playerclasses config file \"%s\"", pathclasses);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log what class file that is loaded.
|
// Log what class file that is loaded.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Loading classes from file \"%s\".", pathclasses);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "Load", "Loading classes from file \"%s\".", LOG_FORMAT_TYPE_SIMPLE, pathclasses);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put file data into memory.
|
// Put file data into memory.
|
||||||
FileToKeyValues(kvClassData, pathclasses);
|
FileToKeyValues(kvClassData, pathclasses);
|
||||||
@ -357,7 +350,7 @@ ClassLoad()
|
|||||||
KvRewind(kvClassData);
|
KvRewind(kvClassData);
|
||||||
if (!KvGotoFirstSubKey(kvClassData))
|
if (!KvGotoFirstSubKey(kvClassData))
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Classes", "Load", "Fatal error: Can't find any classes in \"%s\"", LOG_FORMAT_TYPE_FATALERROR, pathclasses);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: Can't find any classes in \"%s\"", pathclasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
decl String:name[64];
|
decl String:name[64];
|
||||||
@ -375,10 +368,7 @@ ClassLoad()
|
|||||||
if (ClassCount > ZR_CLASS_MAX)
|
if (ClassCount > ZR_CLASS_MAX)
|
||||||
{
|
{
|
||||||
// Maximum classes reached. Write a warning and exit the loop.
|
// Maximum classes reached. Write a warning and exit the loop.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Warning: Maximum classes reached (%d). Skipping other classes.", ZR_CLASS_MAX + 1);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "Load", "Warning: Maximum classes reached (%d). Skipping other classes.", _, ZR_CLASS_MAX + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -439,10 +429,7 @@ ClassLoad()
|
|||||||
// There's one or more invalid class attributes. Disable the class
|
// There's one or more invalid class attributes. Disable the class
|
||||||
// and log an error message.
|
// and log an error message.
|
||||||
ClassData[ClassCount][class_enabled] = false;
|
ClassData[ClassCount][class_enabled] = false;
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Classes", "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", ClassCount, ClassErrorFlags);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", LOG_FORMAT_TYPE_ERROR, ClassCount, ClassErrorFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
failedcount++;
|
failedcount++;
|
||||||
}
|
}
|
||||||
@ -454,13 +441,13 @@ ClassLoad()
|
|||||||
// Validate team requirements.
|
// Validate team requirements.
|
||||||
if (!ClassValidateTeamRequirements())
|
if (!ClassValidateTeamRequirements())
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Fatal error: The class configuration doesn't match the team requirements.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Classes", "Config Validation", "Fatal Error: The class configuration doesn't match the team requirements.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate team default requirements.
|
// Validate team default requirements.
|
||||||
if (!ClassValidateTeamDefaults())
|
if (!ClassValidateTeamDefaults())
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "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.", LOG_FORMAT_TYPE_FATALERROR);
|
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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache class data.
|
// Cache class data.
|
||||||
@ -470,10 +457,7 @@ ClassLoad()
|
|||||||
ClassValidated = true;
|
ClassValidated = true;
|
||||||
|
|
||||||
// Log summary.
|
// Log summary.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", ClassCount, ClassCount - failedcount, failedcount);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", _, ClassCount, ClassCount - failedcount, failedcount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -657,10 +641,7 @@ ClassClientSetDefaultIndexes(client = -1)
|
|||||||
{
|
{
|
||||||
// Invalid class index. Fall back to default class in class config and
|
// Invalid class index. Fall back to default class in class config and
|
||||||
// log a warning.
|
// log a warning.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES))
|
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\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "SetDefaultIndexes", "Warning: Failed to get default zombie class, falling back to default class in class config. Check spelling in \"zr_classes_default_zombie\".", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use default class.
|
// Use default class.
|
||||||
zombieindex = ClassGetDefaultClass(ZR_CLASS_TEAM_ZOMBIES);
|
zombieindex = ClassGetDefaultClass(ZR_CLASS_TEAM_ZOMBIES);
|
||||||
@ -671,10 +652,7 @@ ClassClientSetDefaultIndexes(client = -1)
|
|||||||
{
|
{
|
||||||
// Invalid class index. Fall back to default class in class config and
|
// Invalid class index. Fall back to default class in class config and
|
||||||
// log a warning.
|
// log a warning.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES))
|
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\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Classes", "SetDefaultIndexes", "Warning: Failed to get default human class, falling back to default class in class config. Check spelling in \"zr_classes_default_human\".", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use default class.
|
// Use default class.
|
||||||
humanindex = ClassGetDefaultClass(ZR_CLASS_TEAM_HUMANS);
|
humanindex = ClassGetDefaultClass(ZR_CLASS_TEAM_HUMANS);
|
||||||
|
@ -57,9 +57,6 @@ bool:AmbientSoundsValidateConfig()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize log boolean.
|
|
||||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_AMBIENTSOUNDS);
|
|
||||||
|
|
||||||
// Get ambient sound file.
|
// Get ambient sound file.
|
||||||
decl String:sound[SOUND_MAX_PATH];
|
decl String:sound[SOUND_MAX_PATH];
|
||||||
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
|
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
|
||||||
@ -69,11 +66,7 @@ bool:AmbientSoundsValidateConfig()
|
|||||||
if (!FileExists(sound, true))
|
if (!FileExists(sound, true))
|
||||||
{
|
{
|
||||||
// Log invalid sound file error.
|
// Log invalid sound file error.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Invalid sound file specified in \"zr_ambientsounds_file\".");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Invalid sound file specified in zr_ambientsounds_file.", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,10 +75,7 @@ bool:AmbientSoundsValidateConfig()
|
|||||||
if (ambientvolume <= 0.0)
|
if (ambientvolume <= 0.0)
|
||||||
{
|
{
|
||||||
// Log invalid ambient sound volume error.
|
// Log invalid ambient sound volume error.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Ambient sound is either muted or invalid.");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Ambient sound is either muted or invalid.", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -95,10 +85,7 @@ bool:AmbientSoundsValidateConfig()
|
|||||||
if (ambientlength <= 0.0)
|
if (ambientlength <= 0.0)
|
||||||
{
|
{
|
||||||
// Log invalid ambient sound length error.
|
// Log invalid ambient sound length error.
|
||||||
if (enablelog)
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Specified ambient sound length is invalid.");
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Specified ambient sound length is invalid.", LOG_FORMAT_TYPE_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -91,10 +91,10 @@ SpawnProtectOnClientSpawn(client)
|
|||||||
pSpawnProtectTime[client] = protect_time;
|
pSpawnProtectTime[client] = protect_time;
|
||||||
|
|
||||||
// Tell client they are being protected.
|
// Tell client they are being protected.
|
||||||
ZR_PrintToChat(client, "Spawn protection begin", protect_time);
|
TranslationPrintToChat(client, "Spawn protection begin", protect_time);
|
||||||
|
|
||||||
// Send time left in a hud message.
|
// Send time left in a hud message.
|
||||||
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
TranslationPrintHUDText(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||||
|
|
||||||
// Start repeating timer.
|
// Start repeating timer.
|
||||||
tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||||
@ -142,7 +142,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
|||||||
pSpawnProtectTime[client]--;
|
pSpawnProtectTime[client]--;
|
||||||
|
|
||||||
// Print time left to client.
|
// Print time left to client.
|
||||||
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
TranslationPrintHUDText(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||||
|
|
||||||
// Time has expired.
|
// Time has expired.
|
||||||
if (pSpawnProtectTime[client] <= 0)
|
if (pSpawnProtectTime[client] <= 0)
|
||||||
@ -151,7 +151,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
|||||||
bInfectImmune[client][INFECT_TYPE_NORMAL] = false;
|
bInfectImmune[client][INFECT_TYPE_NORMAL] = false;
|
||||||
|
|
||||||
// Tell client spawn protection is over.
|
// Tell client spawn protection is over.
|
||||||
ZR_HudHint(client, "Spawn protection end");
|
TranslationPrintHUDText(client, "Spawn protection end");
|
||||||
|
|
||||||
// Fix attributes.
|
// Fix attributes.
|
||||||
ToolsSetClientAlpha(client, ClassGetAlphaInitial(client));
|
ToolsSetClientAlpha(client, ClassGetAlphaInitial(client));
|
||||||
|
@ -62,70 +62,70 @@ ToolsFindOffsets()
|
|||||||
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
|
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
|
||||||
if (g_iToolsVelocity == -1)
|
if (g_iToolsVelocity == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecVelocity[0]\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecVelocity[0]\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_vecBaseVelocity" can't be found, then stop the plugin.
|
// If offset "m_vecBaseVelocity" can't be found, then stop the plugin.
|
||||||
g_iToolsBaseVelocity = FindSendPropInfo("CBasePlayer", "m_vecBaseVelocity");
|
g_iToolsBaseVelocity = FindSendPropInfo("CBasePlayer", "m_vecBaseVelocity");
|
||||||
if (g_iToolsBaseVelocity == -1)
|
if (g_iToolsBaseVelocity == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecBaseVelocity\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_vecBaseVelocity\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_flLaggedMovementValue" can't be found, then stop the plugin.
|
// If offset "m_flLaggedMovementValue" can't be found, then stop the plugin.
|
||||||
g_iToolsLMV = FindSendPropInfo("CCSPlayer", "m_flLaggedMovementValue");
|
g_iToolsLMV = FindSendPropInfo("CCSPlayer", "m_flLaggedMovementValue");
|
||||||
if (g_iToolsLMV == -1)
|
if (g_iToolsLMV == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_flLaggedMovementValue\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_flLaggedMovementValue\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_bHasNightVision" can't be found, then stop the plugin.
|
// If offset "m_bHasNightVision" can't be found, then stop the plugin.
|
||||||
g_iToolsHasNightVision = FindSendPropInfo("CCSPlayer", "m_bHasNightVision");
|
g_iToolsHasNightVision = FindSendPropInfo("CCSPlayer", "m_bHasNightVision");
|
||||||
if (g_iToolsHasNightVision == -1)
|
if (g_iToolsHasNightVision == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_bHasNightVision\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bHasNightVision\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_bNightVisionOn" can't be found, then stop the plugin.
|
// If offset "m_bNightVisionOn" can't be found, then stop the plugin.
|
||||||
g_iToolsNightVisionOn = FindSendPropInfo("CCSPlayer", "m_bNightVisionOn");
|
g_iToolsNightVisionOn = FindSendPropInfo("CCSPlayer", "m_bNightVisionOn");
|
||||||
if (g_iToolsNightVisionOn == -1)
|
if (g_iToolsNightVisionOn == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_bNightVisionOn\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bNightVisionOn\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_CollisionGroup" can't be found, then stop the plugin.
|
// If offset "m_CollisionGroup" can't be found, then stop the plugin.
|
||||||
g_iToolsCollisionGroup = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
|
g_iToolsCollisionGroup = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
|
||||||
if (g_iToolsCollisionGroup == -1)
|
if (g_iToolsCollisionGroup == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBaseEntity::m_CollisionGroup\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBaseEntity::m_CollisionGroup\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_iAccount" can't be found, then stop the plugin.
|
// If offset "m_iAccount" can't be found, then stop the plugin.
|
||||||
g_iToolsAccount = FindSendPropInfo("CCSPlayer", "m_iAccount");
|
g_iToolsAccount = FindSendPropInfo("CCSPlayer", "m_iAccount");
|
||||||
if (g_iToolsAccount == -1)
|
if (g_iToolsAccount == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_iAccount\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_iAccount\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_iDefaultFOV" can't be found, then stop the plugin.
|
// If offset "m_iDefaultFOV" can't be found, then stop the plugin.
|
||||||
g_iToolsDefaultFOV = FindSendPropInfo("CBasePlayer", "m_iDefaultFOV");
|
g_iToolsDefaultFOV = FindSendPropInfo("CBasePlayer", "m_iDefaultFOV");
|
||||||
if (g_iToolsDefaultFOV == -1)
|
if (g_iToolsDefaultFOV == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBasePlayer::m_iDefaultFOV\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_iDefaultFOV\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_bInBuyZone" can't be found, then stop the plugin.
|
// If offset "m_bInBuyZone" can't be found, then stop the plugin.
|
||||||
g_iToolsInBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone");
|
g_iToolsInBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone");
|
||||||
if (g_iToolsInBuyZone == -1)
|
if (g_iToolsInBuyZone == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offset "m_hActiveWeapon" can't be found, then stop the plugin.
|
// If offset "m_hActiveWeapon" can't be found, then stop the plugin.
|
||||||
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
|
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
|
||||||
if (g_iToolsActiveWeapon == -1)
|
if (g_iToolsActiveWeapon == -1)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "Offsets", "Offset \"CBasePlayer::m_hActiveWeapon\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "Offsets", "Offset \"CBasePlayer::m_hActiveWeapon\" was not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ ToolsSetupGameData()
|
|||||||
// If gamedata file can't be loaded, then stop the plugin.
|
// If gamedata file can't be loaded, then stop the plugin.
|
||||||
if (g_hToolsGameConfig == INVALID_HANDLE)
|
if (g_hToolsGameConfig == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "GameData", "Can't load game config file (plugin.zombiereloaded.txt) from the gamedata directory.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Can't load game config file (plugin.zombiereloaded.txt) from the gamedata directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prep the SDKCall for "EyeAngles."
|
// Prep the SDKCall for "EyeAngles."
|
||||||
@ -152,7 +152,7 @@ ToolsSetupGameData()
|
|||||||
// If offset "EyeAngles" can't be found, then stop the plugin.
|
// If offset "EyeAngles" can't be found, then stop the plugin.
|
||||||
if(g_hToolsEyeAngles == INVALID_HANDLE)
|
if(g_hToolsEyeAngles == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "GameData", "Offset \"EyeAngles\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Offset \"EyeAngles\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prep the SDKCall for "TerminateRound."
|
// Prep the SDKCall for "TerminateRound."
|
||||||
@ -165,7 +165,7 @@ ToolsSetupGameData()
|
|||||||
// If offset "TerminateRound" can't be found, then stop the plugin.
|
// If offset "TerminateRound" can't be found, then stop the plugin.
|
||||||
if(g_hToolsTerminateRound == INVALID_HANDLE)
|
if(g_hToolsTerminateRound == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "GameData", "Signature \"CGameRules::TerminateRound\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Signature \"CGameRules::TerminateRound\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prep the SDKCall for "CSWeaponDrop."
|
// Prep the SDKCall for "CSWeaponDrop."
|
||||||
@ -179,6 +179,6 @@ ToolsSetupGameData()
|
|||||||
// If offset "CSWeaponDrop" can't be found, then stop the plugin.
|
// If offset "CSWeaponDrop" can't be found, then stop the plugin.
|
||||||
if(g_hToolsCSWeaponDrop == INVALID_HANDLE)
|
if(g_hToolsCSWeaponDrop == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Tools", "GameData", "Signature \"CBasePlaye::CSWeaponDrop\" was not found.", LOG_FORMAT_TYPE_FATALERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Tools", "GameData", "Signature \"CBasePlaye::CSWeaponDrop\" was not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,138 +10,326 @@
|
|||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FormatTextString(String:text[], maxlen)
|
/**
|
||||||
|
* @section Max length of different message formats.
|
||||||
|
*/
|
||||||
|
#define TRANSLATION_MAX_LENGTH_CHAT 192
|
||||||
|
#define TRANSLATION_MAX_LENGTH_CONSOLE 1024
|
||||||
|
/**
|
||||||
|
* @endsection
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix on all messages printed from the plugin.
|
||||||
|
*/
|
||||||
|
#define TRANSLATION_PHRASE_PREFIX "[ZR]"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @section Text color chars.
|
||||||
|
*/
|
||||||
|
#define TRANSLATION_TEXT_COLOR_DEFAULT "\x01"
|
||||||
|
#define TRANSLATION_TEXT_COLOR_LGREEN "\x03"
|
||||||
|
#define TRANSLATION_TEXT_COLOR_GREEN "\x04"
|
||||||
|
/**
|
||||||
|
* @endsection
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HUD text usermsg
|
||||||
|
*/
|
||||||
|
#define TRANSLATION_USERMSG_HINTTEXT "HintText"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load translations file here.
|
||||||
|
*/
|
||||||
|
TranslationInit()
|
||||||
{
|
{
|
||||||
Format(text, maxlen, "@green[ZR] @default%s", text);
|
// Load translations phrases used by plugin.
|
||||||
|
LoadTranslations("common.phrases.txt");
|
||||||
ReplaceString(text, maxlen, "@default","\x01");
|
LoadTranslations("zombiereloaded.phrases.txt");
|
||||||
ReplaceString(text, maxlen, "@lgreen","\x03");
|
|
||||||
ReplaceString(text, maxlen, "@green","\x04");
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_PrintToChat(client, any:...)
|
|
||||||
{
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
if (ZRIsClientValid(client))
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
FormatTextString(phrase, sizeof(phrase));
|
|
||||||
|
|
||||||
PrintToChat(client, phrase);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
FormatTextString(phrase, sizeof(phrase));
|
|
||||||
|
|
||||||
PrintToServer(phrase);
|
|
||||||
|
|
||||||
for (new x = 1; x <= MaxClients; x++)
|
|
||||||
{
|
|
||||||
if (IsClientInGame(x))
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(x);
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
FormatTextString(phrase, sizeof(phrase));
|
|
||||||
|
|
||||||
PrintToChat(x, phrase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_PrintCenterText(client, any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
|
|
||||||
PrintCenterText(client, phrase);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_HudHint(client, any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
|
|
||||||
new Handle:hHintText = StartMessageOne("HintText", client);
|
|
||||||
if (hHintText != INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
BfWriteByte(hHintText, -1);
|
|
||||||
BfWriteString(hHintText, phrase);
|
|
||||||
EndMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_PrintToServer(any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(LANG_SERVER);
|
|
||||||
|
|
||||||
decl String:phrase[192];
|
|
||||||
decl String:buffer[192];
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 1);
|
|
||||||
Format(buffer, sizeof(buffer), "[ZR] %s", phrase);
|
|
||||||
|
|
||||||
PrintToServer(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_LogMessage(any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(LANG_SERVER);
|
|
||||||
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 1);
|
|
||||||
|
|
||||||
LogMessage(phrase);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_TranslateMessage(String:buffer[], maxlen, any:...)
|
|
||||||
{
|
|
||||||
SetGlobalTransTarget(LANG_SERVER);
|
|
||||||
VFormat(buffer, maxlen, "%t", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ZR_ReplyToCommand(client, any:...)
|
|
||||||
{
|
|
||||||
decl String:phrase[192];
|
|
||||||
|
|
||||||
SetGlobalTransTarget(client);
|
|
||||||
|
|
||||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
|
||||||
FormatTextString(phrase, sizeof(phrase));
|
|
||||||
|
|
||||||
ReplyToCommand(client, phrase);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds support for printing long strings.
|
* Translate a phrase in zombiereloaded.phrases.txt
|
||||||
|
*
|
||||||
|
* @param client The client index
|
||||||
|
* @param translation The translated text.
|
||||||
|
* @param maxlen Maximum length of the translated string.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationTranslatePhrase(client, String:translation[], maxlen, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target to given target.
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Dump translation into return string.
|
||||||
|
VFormat(translation, maxlen, "%t", 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the string to the plugin's style.
|
||||||
|
*
|
||||||
|
* @param text Text to format.
|
||||||
|
* @param maxlen Maximum length of the formatted text.
|
||||||
|
*/
|
||||||
|
stock TranslationPluginFormatString(String:text[], maxlen, bool:color = true)
|
||||||
|
{
|
||||||
|
if (color)
|
||||||
|
{
|
||||||
|
// Format prefix onto the string.
|
||||||
|
Format(text, maxlen, "@green%s @default%s", TRANSLATION_PHRASE_PREFIX, text);
|
||||||
|
|
||||||
|
// Replace color tokens with CS:S color chars.
|
||||||
|
ReplaceString(text, maxlen, "@default", TRANSLATION_TEXT_COLOR_DEFAULT);
|
||||||
|
ReplaceString(text, maxlen, "@lgreen", TRANSLATION_TEXT_COLOR_LGREEN);
|
||||||
|
ReplaceString(text, maxlen, "@green", TRANSLATION_TEXT_COLOR_GREEN);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format prefix onto the string.
|
||||||
|
Format(text, maxlen, "%s %s", TRANSLATION_PHRASE_PREFIX, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print chat text to client. (with style)
|
||||||
*
|
*
|
||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @param text The text to print.
|
* @param ... Translation formatting parameters.
|
||||||
*/
|
*/
|
||||||
stock ZR_ReplyToCommandLong(client, const String:text[])
|
stock TranslationPrintToChat(client, any:...)
|
||||||
{
|
{
|
||||||
decl String:partbuffer[1024];
|
// Set translation target
|
||||||
new pos;
|
SetGlobalTransTarget(client);
|
||||||
new cellswritten = 1; // Initialize for the loop.
|
|
||||||
|
|
||||||
while (cellswritten)
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation));
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToChat(client, translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the string to the plugin's style.
|
||||||
|
*
|
||||||
|
* @param server True to also print text to server console, false just to clients.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintToChatAll(bool:server, bool:admin, any:...)
|
||||||
{
|
{
|
||||||
cellswritten = strcopy(partbuffer, sizeof(partbuffer), text[pos]);
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
ReplyToCommand(client, partbuffer);
|
|
||||||
pos += cellswritten;
|
if (server)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 3);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print phrase to server.
|
||||||
|
PrintToServer(translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// x = client index.
|
||||||
|
for (new x = 1; x <= MaxClients; x++)
|
||||||
|
{
|
||||||
|
// If client isn't in-game, then stop.
|
||||||
|
if (!IsClientInGame(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client isn't an admin, and we're only printing to admins, then stop.
|
||||||
|
if (admin && !ZRIsClientAdmin(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 3);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation));
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToChat(x, translation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print console text to client. (with style)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintToConsole(client, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToConsole(client, translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the string to the plugin's style.
|
||||||
|
*
|
||||||
|
* @param server True to also print text to server console, false just to clients.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintToConsoleAll(bool:server, bool:admin, any:...)
|
||||||
|
{
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
|
||||||
|
if (server)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 3);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print phrase to server.
|
||||||
|
PrintToServer(translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// x = client index.
|
||||||
|
for (new x = 1; x <= MaxClients; x++)
|
||||||
|
{
|
||||||
|
// If client isn't in-game, then stop.
|
||||||
|
if (!IsClientInGame(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client isn't an admin, and we're only printing to admins, then stop.
|
||||||
|
if (admin && !ZRIsClientAdmin(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 3);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToConsole(x, translation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print center text to client. (with style)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintCenterText(client, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintCenterText(client, translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print HUD text to client. (with style)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintHUDText(client, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
|
||||||
|
// If hint text usermsg is invalid, then stop.
|
||||||
|
new Handle:hHintText = StartMessageOne(TRANSLATION_USERMSG_HINTTEXT, client);
|
||||||
|
if (hHintText == INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BfWriteByte(hHintText, -1);
|
||||||
|
BfWriteString(hHintText, translation);
|
||||||
|
EndMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print text to server. (with style)
|
||||||
|
*
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationPrintToServer(any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(LANG_SERVER);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 1);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation), false);
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
PrintToServer(translation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print chat text to client. (with style)
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param ... Translation formatting parameters.
|
||||||
|
*/
|
||||||
|
stock TranslationReplyToCommand(client, any:...)
|
||||||
|
{
|
||||||
|
// Set translation target
|
||||||
|
SetGlobalTransTarget(client);
|
||||||
|
|
||||||
|
// Translate phrase.
|
||||||
|
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||||
|
VFormat(translation, sizeof(translation), "%t", 2);
|
||||||
|
|
||||||
|
// Format string to create plugin style.
|
||||||
|
TranslationPluginFormatString(translation, sizeof(translation));
|
||||||
|
|
||||||
|
// Print translated phrase to client.
|
||||||
|
ReplyToCommand(client, translation);
|
||||||
|
}
|
@ -15,6 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
new bool:g_bMarket;
|
new bool:g_bMarket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set global market flag variable
|
||||||
|
*/
|
||||||
|
MarketInit()
|
||||||
|
{
|
||||||
|
// Set market variable to true if market is installed.
|
||||||
|
g_bMarket = LibraryExists("market");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends market menu to client.
|
* Sends market menu to client.
|
||||||
*
|
*
|
||||||
@ -26,7 +35,7 @@ bool:ZMarketMenu(client)
|
|||||||
if (!g_bMarket)
|
if (!g_bMarket)
|
||||||
{
|
{
|
||||||
// Tell client market is disabled.
|
// Tell client market is disabled.
|
||||||
ZR_PrintToChat(client, "Feature is disabled");
|
TranslationPrintToChat(client, "Feature is disabled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +43,7 @@ bool:ZMarketMenu(client)
|
|||||||
if (!IsPlayerAlive(client))
|
if (!IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
// Tell player they must be alive.
|
// Tell player they must be alive.
|
||||||
ZR_PrintToChat(client, "Must be alive");
|
TranslationPrintToChat(client, "Must be alive");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +52,7 @@ bool:ZMarketMenu(client)
|
|||||||
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
||||||
{
|
{
|
||||||
// Tell client they must be in a buyzone.
|
// Tell client they must be in a buyzone.
|
||||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
TranslationPrintCenterText(client, "Market out of buyzone");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +102,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
// If player is a zombie, then stop.
|
// If player is a zombie, then stop.
|
||||||
if (InfectIsClientInfected(client))
|
if (InfectIsClientInfected(client))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Zombie cant use weapon");
|
TranslationPrintToChat(client, "Zombie cant use weapon");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -120,7 +129,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
// If the weapon is restricted, then stop.
|
// If the weapon is restricted, then stop.
|
||||||
if (RestrictIsWeaponRestricted(weapon))
|
if (RestrictIsWeaponRestricted(weapon))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
TranslationPrintToChat(client, "Weapon is restricted", weapon);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -129,7 +138,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
|||||||
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
||||||
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
||||||
{
|
{
|
||||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
TranslationPrintCenterText(client, "Market out of buyzone");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -105,10 +105,7 @@ RestrictOnMapStart()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log failure.
|
// Log failure.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "Missing weapon groups config file: %s", pathweapongroups);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing weapon groups config file: %s", LOG_FORMAT_TYPE_ERROR, pathweapongroups);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -159,12 +156,6 @@ RestrictDefaultRestrictions()
|
|||||||
*/
|
*/
|
||||||
RestrictValidateWeaponGroups()
|
RestrictValidateWeaponGroups()
|
||||||
{
|
{
|
||||||
// If log flag check fails, then don't log.
|
|
||||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset keygroup's traversal stack.
|
// Reset keygroup's traversal stack.
|
||||||
KvRewind(kvWeaponGroups);
|
KvRewind(kvWeaponGroups);
|
||||||
|
|
||||||
@ -188,7 +179,7 @@ RestrictValidateWeaponGroups()
|
|||||||
// If weapon is invalid, then log it.
|
// If weapon is invalid, then log it.
|
||||||
if (!WeaponsIsValidWeapon(groupweapon))
|
if (!WeaponsIsValidWeapon(groupweapon))
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Weapon Restrict", "Config Validation", "Invalid weapon \"%s\" in group \"%s\" configured in weapongroups.txt.", LOG_FORMAT_TYPE_ERROR, groupweapon, weapongroup);
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "Invalid weapon \"%s\" in group \"%s\" configured in weapongroups.txt.", groupweapon, weapongroup);
|
||||||
}
|
}
|
||||||
} while (KvGotoNextKey(kvWeaponGroups));
|
} while (KvGotoNextKey(kvWeaponGroups));
|
||||||
|
|
||||||
@ -197,7 +188,7 @@ RestrictValidateWeaponGroups()
|
|||||||
// If it couldn't traverse to the weapons, then log no weapons within group.
|
// If it couldn't traverse to the weapons, then log no weapons within group.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Weapon Restrict", "Config Validation", "No weapons listed in weapon group \"%s\" in weapongroups.txt.", LOG_FORMAT_TYPE_ERROR, weapongroup);
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "No weapons listed in weapon group \"%s\" in weapongroups.txt.", weapongroup);
|
||||||
}
|
}
|
||||||
} while (KvGotoNextKey(kvWeaponGroups));
|
} while (KvGotoNextKey(kvWeaponGroups));
|
||||||
}
|
}
|
||||||
@ -259,19 +250,10 @@ RestrictOnClientSpawn(client)
|
|||||||
*/
|
*/
|
||||||
public Action:RestrictBuyCommand(client, argc)
|
public Action:RestrictBuyCommand(client, argc)
|
||||||
{
|
{
|
||||||
// If plugin is disabled then stop.
|
|
||||||
/*new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
|
||||||
if (!enabled)
|
|
||||||
{
|
|
||||||
// Allow command.
|
|
||||||
return Plugin_Continue;
|
|
||||||
}*/
|
|
||||||
// Disabled
|
|
||||||
|
|
||||||
// If player is a zombie, then block command.
|
// If player is a zombie, then block command.
|
||||||
if (InfectIsClientInfected(client))
|
if (InfectIsClientInfected(client))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Zombie cant use weapon");
|
TranslationPrintToChat(client, "Zombie cant use weapon");
|
||||||
|
|
||||||
// Block command
|
// Block command
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -285,7 +267,7 @@ public Action:RestrictBuyCommand(client, argc)
|
|||||||
// Check if the weapon is restricted, if so then block command.
|
// Check if the weapon is restricted, if so then block command.
|
||||||
if (RestrictIsWeaponRestricted(weapon))
|
if (RestrictIsWeaponRestricted(weapon))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
TranslationPrintToChat(client, "Weapon is restricted", weapon);
|
||||||
|
|
||||||
// Block command.
|
// Block command.
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -480,12 +462,8 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
|||||||
// Weapon was successfully restricted.
|
// Weapon was successfully restricted.
|
||||||
case Successful_Weapon:
|
case Successful_Weapon:
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(0, "Restrict weapon", weapon);
|
TranslationPrintToChatAll(true, false, "Restrict weapon", weapon);
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon: \"%s\".", client, weapon);
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Weapon group was successfully restricted.
|
// Weapon group was successfully restricted.
|
||||||
case Successful_Group:
|
case Successful_Group:
|
||||||
@ -493,23 +471,19 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
|||||||
decl String:weaponlist[128];
|
decl String:weaponlist[128];
|
||||||
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||||
|
|
||||||
ZR_PrintToChat(0, "Restrict custom weapon group", weapon, weaponlist);
|
TranslationPrintToChatAll(true, false, "Restrict custom weapon group", weapon, weaponlist);
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon group: \"%s\".", client, weapon);
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon group: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Weapon was already restricted.
|
// Weapon was already restricted.
|
||||||
case Failed_Weapon:
|
case Failed_Weapon:
|
||||||
{
|
{
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Restrict weapon failed", weapon);
|
TranslationReplyToCommand(client, "Restrict weapon failed", weapon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Restrict weapon failed", weapon);
|
TranslationPrintToChat(client, "Restrict weapon failed", weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Weapon group was already restricted.
|
// Weapon group was already restricted.
|
||||||
@ -520,11 +494,11 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
|||||||
|
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
TranslationReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
TranslationPrintToChat(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Weapon name was invalid.
|
// Weapon name was invalid.
|
||||||
@ -532,11 +506,11 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
|||||||
{
|
{
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Weapon invalid", weapon);
|
TranslationReplyToCommand(client, "Weapon invalid", weapon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
TranslationPrintToChat(client, "Weapon invalid", weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,12 +530,9 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
|||||||
// Weapon was successfully unrestricted.
|
// Weapon was successfully unrestricted.
|
||||||
case Successful_Weapon:
|
case Successful_Weapon:
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(0, "Unrestrict weapon", weapon);
|
TranslationPrintToChatAll(true, false, "Unrestrict weapon", weapon);
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon: \"%s\".", client, weapon);
|
||||||
|
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Weapon group was successfully unrestricted.
|
// Weapon group was successfully unrestricted.
|
||||||
case Successful_Group:
|
case Successful_Group:
|
||||||
@ -569,23 +540,19 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
|||||||
decl String:weaponlist[128];
|
decl String:weaponlist[128];
|
||||||
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||||
|
|
||||||
ZR_PrintToChat(0, "Unrestrict custom weapon group", weapon, weaponlist);
|
TranslationPrintToChatAll(true, false, "Unrestrict custom weapon group", weapon, weaponlist);
|
||||||
|
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon group: \"%s\".", client, weapon);
|
||||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
LogMessageFormatted(client, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon group: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Weapon wasn't restricted.
|
// Weapon wasn't restricted.
|
||||||
case Failed_Weapon:
|
case Failed_Weapon:
|
||||||
{
|
{
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Unrestrict weapon failed", weapon);
|
TranslationReplyToCommand(client, "Unrestrict weapon failed", weapon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Unrestrict weapon failed", weapon);
|
TranslationPrintToChat(client, "Unrestrict weapon failed", weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Weapon group wasn't restricted.
|
// Weapon group wasn't restricted.
|
||||||
@ -596,11 +563,11 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
|||||||
|
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
TranslationReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
TranslationPrintToChat(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Weapon name was invalid.
|
// Weapon name was invalid.
|
||||||
@ -608,11 +575,11 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
|||||||
{
|
{
|
||||||
if (reply)
|
if (reply)
|
||||||
{
|
{
|
||||||
ZR_ReplyToCommand(client, "Weapon invalid", weapon);
|
TranslationReplyToCommand(client, "Weapon invalid", weapon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
TranslationPrintToChat(client, "Weapon invalid", weapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -933,7 +900,7 @@ public Action:RestrictRestrictCommand(client, argc)
|
|||||||
if (!weapons)
|
if (!weapons)
|
||||||
{
|
{
|
||||||
// Tell client command is disabled.
|
// Tell client command is disabled.
|
||||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
TranslationReplyToCommand(client, "Feature is disabled");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,7 +909,7 @@ public Action:RestrictRestrictCommand(client, argc)
|
|||||||
if (!restrict)
|
if (!restrict)
|
||||||
{
|
{
|
||||||
// Tell client command is disabled.
|
// Tell client command is disabled.
|
||||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
TranslationReplyToCommand(client, "Feature is disabled");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,7 +942,7 @@ public Action:RestrictUnrestrictCommand(client, argc)
|
|||||||
if (!weapons)
|
if (!weapons)
|
||||||
{
|
{
|
||||||
// Tell client command is disabled.
|
// Tell client command is disabled.
|
||||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
TranslationReplyToCommand(client, "Feature is disabled");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -984,7 +951,7 @@ public Action:RestrictUnrestrictCommand(client, argc)
|
|||||||
if (!restrict)
|
if (!restrict)
|
||||||
{
|
{
|
||||||
// Tell client command is disabled.
|
// Tell client command is disabled.
|
||||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
TranslationReplyToCommand(client, "Feature is disabled");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +93,7 @@ WeaponsLoad()
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// Log failure.
|
// Log failure.
|
||||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "Missing weapons config file: %s", pathweapons);
|
||||||
{
|
|
||||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing weapons config file: %s", LOG_FORMAT_TYPE_ERROR, pathweapons);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -116,16 +113,10 @@ WeaponsLoad()
|
|||||||
*/
|
*/
|
||||||
WeaponsValidateConfig()
|
WeaponsValidateConfig()
|
||||||
{
|
{
|
||||||
// If log flag check fails, then don't log.
|
|
||||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
KvRewind(kvWeapons);
|
KvRewind(kvWeapons);
|
||||||
if (!KvGotoFirstSubKey(kvWeapons))
|
if (!KvGotoFirstSubKey(kvWeapons))
|
||||||
{
|
{
|
||||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "No weapons listed in weapons.txt.", LOG_FORMAT_TYPE_ERROR);
|
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "No weapons listed in weapons.txt.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ bool:ZRAdminMenu(client)
|
|||||||
{
|
{
|
||||||
if (!ZRIsClientAdmin(client))
|
if (!ZRIsClientAdmin(client))
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Must be admin");
|
TranslationPrintToChat(client, "Must be admin");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,76 +504,14 @@ ZRLogFlagsMenu(client)
|
|||||||
|
|
||||||
SetMenuTitle(menu_log_flags, "%t\n ", "!zadmin log flags title");
|
SetMenuTitle(menu_log_flags, "%t\n ", "!zadmin log flags title");
|
||||||
|
|
||||||
new client_flags = GetUserFlagBits(client);
|
//new client_flags = GetUserFlagBits(client);
|
||||||
new item_state = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
|
//new item_state = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
|
||||||
|
|
||||||
decl String:z_log_core[64];
|
//decl String:z_log_core[64];
|
||||||
decl String:z_log_game[64];
|
|
||||||
decl String:z_log_player[64];
|
|
||||||
decl String:z_log_debug[64];
|
|
||||||
decl String:z_log_debug_detail[64];
|
|
||||||
decl String:z_log_debug_max[64];
|
|
||||||
decl String:z_log_admins[64];
|
|
||||||
decl String:z_log_client[64];
|
|
||||||
decl String:z_log_ignore_console[64];
|
|
||||||
decl String:z_log_modules_enabled[64];
|
|
||||||
decl String:z_log_module_zombie[64];
|
|
||||||
decl String:z_log_module_ambientsounds[64];
|
|
||||||
decl String:z_log_module_overlays[64];
|
|
||||||
decl String:z_log_module_saytriggers[64];
|
|
||||||
decl String:z_log_module_teleport[64];
|
|
||||||
decl String:z_log_module_classes[64];
|
|
||||||
decl String:z_log_module_weapons[64];
|
|
||||||
decl String:z_log_module_hitgroups[64];
|
|
||||||
decl String:z_log_module_commands[64];
|
|
||||||
decl String:z_log_module_anticamp[64];
|
|
||||||
decl String:z_log_module_damage[64];
|
|
||||||
decl String:z_log_module_offsets[64];
|
|
||||||
|
|
||||||
Format(z_log_core, sizeof(z_log_core), "Log core events (%d)", LogCheckFlag(LOG_CORE_EVENTS));
|
//Format(z_log_core, sizeof(z_log_core), "Log core events (%d)", LogCheckFlag(LOG_CORE_EVENTS));
|
||||||
Format(z_log_game, sizeof(z_log_game), "Log game events (%d)", LogCheckFlag(LOG_GAME_EVENTS));
|
|
||||||
Format(z_log_player, sizeof(z_log_player), "Log player commands (%d)", LogCheckFlag(LOG_PLAYER_COMMANDS));
|
|
||||||
Format(z_log_debug, sizeof(z_log_debug), "Log debug messages (%d)", LogCheckFlag(LOG_DEBUG));
|
|
||||||
Format(z_log_debug_detail, sizeof(z_log_debug_detail), "Log detailed debug messages (%d)", LogCheckFlag(LOG_DEBUG_DETAIL));
|
|
||||||
Format(z_log_debug_max, sizeof(z_log_debug_max), "Log low level debug messages (%d)", LogCheckFlag(LOG_DEBUG_MAX_DETAIL));
|
|
||||||
Format(z_log_admins, sizeof(z_log_admins), "Also log to admin chat (%d)", LogCheckFlag(LOG_TO_ADMINS));
|
|
||||||
Format(z_log_client, sizeof(z_log_client), "Also log to client console (%d)", LogCheckFlag(LOG_TO_CLIENT));
|
|
||||||
Format(z_log_ignore_console, sizeof(z_log_ignore_console), "Don't log messages from the console (%d)", LogCheckFlag(LOG_IGNORE_CONSOLE));
|
|
||||||
Format(z_log_modules_enabled, sizeof(z_log_modules_enabled), "Module based log control (%d)", LogCheckFlag(LOG_MODULES_ENABLED));
|
|
||||||
Format(z_log_module_zombie, sizeof(z_log_module_zombie), "Zombie (%d)", LogCheckFlag(LOG_MODULE_ZOMBIE));
|
|
||||||
Format(z_log_module_ambientsounds, sizeof(z_log_module_ambientsounds), "Ambient Sounds (%d)", LogCheckFlag(LOG_MODULE_AMBIENTSOUNDS));
|
|
||||||
Format(z_log_module_overlays, sizeof(z_log_module_overlays), "Overlays (%d)", LogCheckFlag(LOG_MODULE_OVERLAYS));
|
|
||||||
Format(z_log_module_saytriggers, sizeof(z_log_module_saytriggers), "Chat commands (%d)", LogCheckFlag(LOG_MODULE_SAYTRIGGERS));
|
|
||||||
Format(z_log_module_teleport, sizeof(z_log_module_teleport), "Teleporter (%d)", LogCheckFlag(LOG_MODULE_TELEPORT));
|
|
||||||
Format(z_log_module_classes, sizeof(z_log_module_classes), "Classes (%d)", LogCheckFlag(LOG_MODULE_CLASSES));
|
|
||||||
Format(z_log_module_weapons, sizeof(z_log_module_weapons), "Weapons (%d)", LogCheckFlag(LOG_MODULE_WEAPONS));
|
|
||||||
Format(z_log_module_hitgroups, sizeof(z_log_module_hitgroups), "Hitgroups (%d)", LogCheckFlag(LOG_MODULE_HITGROUPS));
|
|
||||||
Format(z_log_module_commands, sizeof(z_log_module_commands), "Admin commands (%d)", LogCheckFlag(LOG_MODULE_COMMANDS));
|
|
||||||
Format(z_log_module_anticamp, sizeof(z_log_module_anticamp), "Anticamp (%d)", LogCheckFlag(LOG_MODULE_ANTICAMP));
|
|
||||||
Format(z_log_module_damage, sizeof(z_log_module_damage), "Damage (Suicide Intercept) (%d)", LogCheckFlag(LOG_MODULE_DAMAGE));
|
|
||||||
Format(z_log_module_offsets, sizeof(z_log_module_offsets), "Offsets (properties) (%d)", LogCheckFlag(LOG_MODULE_OFFSETS));
|
|
||||||
|
|
||||||
AddMenuItem(menu_log_flags, z_log_core, z_log_core, item_state);
|
//AddMenuItem(menu_log_flags, z_log_core, z_log_core, item_state);
|
||||||
AddMenuItem(menu_log_flags, z_log_game, z_log_game, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_player, z_log_player, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_debug, z_log_debug, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_debug_detail, z_log_debug_detail, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_debug_max, z_log_debug_max, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_admins, z_log_admins);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_client, z_log_client);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_ignore_console, z_log_ignore_console, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_modules_enabled, z_log_modules_enabled, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_zombie, z_log_module_zombie, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_ambientsounds, z_log_module_ambientsounds, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_overlays, z_log_module_overlays, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_saytriggers, z_log_module_saytriggers, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_teleport, z_log_module_teleport, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_classes, z_log_module_classes, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_weapons, z_log_module_weapons, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_commands, z_log_module_commands, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_anticamp, z_log_module_anticamp, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_damage, z_log_module_damage, item_state);
|
|
||||||
AddMenuItem(menu_log_flags, z_log_module_offsets, z_log_module_offsets, item_state);
|
|
||||||
|
|
||||||
SetMenuExitBackButton(menu_log_flags, true);
|
SetMenuExitBackButton(menu_log_flags, true);
|
||||||
DisplayMenu(menu_log_flags, client, MENU_TIME_FOREVER);
|
DisplayMenu(menu_log_flags, client, MENU_TIME_FOREVER);
|
||||||
@ -585,116 +523,6 @@ public ZRLogFlagsMenuHandle(Handle:menu_log_flags, MenuAction:action, client, sl
|
|||||||
{
|
{
|
||||||
switch(slot)
|
switch(slot)
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_CORE_EVENTS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_GAME_EVENTS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_PLAYER_COMMANDS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_DEBUG);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_DEBUG_DETAIL);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_DEBUG_MAX_DETAIL);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 6:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_TO_ADMINS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 7:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_TO_CLIENT);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 8:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_IGNORE_CONSOLE);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 9:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULES_ENABLED);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 10:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_ZOMBIE);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 11:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_AMBIENTSOUNDS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 12:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_OVERLAYS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 13:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_SAYTRIGGERS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 14:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_TELEPORT);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 15:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_CLASSES);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 16:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_WEAPONS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 17:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_HITGROUPS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 18:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_COMMANDS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 19:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_ANTICAMP);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 20:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_DAMAGE);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
case 21:
|
|
||||||
{
|
|
||||||
LogToggleFlag(LOG_MODULE_OFFSETS);
|
|
||||||
ZRLogFlagsMenu(client);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (action == MenuAction_Cancel)
|
if (action == MenuAction_Cancel)
|
||||||
|
@ -132,7 +132,7 @@ bool:ZHPToggle(client)
|
|||||||
if (!zhp)
|
if (!zhp)
|
||||||
{
|
{
|
||||||
// Tell client feature is disabled.
|
// Tell client feature is disabled.
|
||||||
ZR_PrintToChat(client, "Feature is disabled");
|
TranslationPrintToChat(client, "Feature is disabled");
|
||||||
|
|
||||||
// Stop.
|
// Stop.
|
||||||
return false;
|
return false;
|
||||||
@ -141,12 +141,12 @@ bool:ZHPToggle(client)
|
|||||||
// If ZHP is enabled, then tell client it's being disabled.
|
// If ZHP is enabled, then tell client it's being disabled.
|
||||||
if (pZHP[client])
|
if (pZHP[client])
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "ZHP disable");
|
TranslationPrintToChat(client, "ZHP disable");
|
||||||
}
|
}
|
||||||
// If ZHP is disabled, then tell client it's being enabled.
|
// If ZHP is disabled, then tell client it's being enabled.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "ZHP enable");
|
TranslationPrintToChat(client, "ZHP enable");
|
||||||
|
|
||||||
// Update HP display.
|
// Update HP display.
|
||||||
ZHPUpdateHUD(client);
|
ZHPUpdateHUD(client);
|
||||||
@ -186,7 +186,7 @@ ZHPUpdateHUD(client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display HP
|
// Display HP
|
||||||
ZR_HudHint(client, "Display HP", health);
|
TranslationPrintHUDText(client, "Display HP", health);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index of server console.
|
||||||
|
*/
|
||||||
|
#define ZR_CONSOLE_INDEX 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @section Conversion factors.
|
* @section Conversion factors.
|
||||||
*/
|
*/
|
||||||
@ -43,7 +48,7 @@ Float:ZRConvertUnitsFloat(Float:number, Float:conversion)
|
|||||||
* on it when finished!
|
* on it when finished!
|
||||||
* @param immunity True to ignore clients immune from mother infect, false to count them.
|
* @param immunity True to ignore clients immune from mother infect, false to count them.
|
||||||
*/
|
*/
|
||||||
ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool:alive = false, bool:human = false)
|
stock ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool:alive = false, bool:human = false)
|
||||||
{
|
{
|
||||||
// Create array.
|
// Create array.
|
||||||
arrayEligibleClients = CreateArray();
|
arrayEligibleClients = CreateArray();
|
||||||
@ -90,7 +95,7 @@ ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool
|
|||||||
* @param console True to include console (index 0), false if not.
|
* @param console True to include console (index 0), false if not.
|
||||||
* @return True if client is valid, false otherwise.
|
* @return True if client is valid, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZRIsClientValid(client, bool:console = false)
|
stock bool:ZRIsClientValid(client, bool:console = false)
|
||||||
{
|
{
|
||||||
// If index is greater than max number of clients, then return false.
|
// If index is greater than max number of clients, then return false.
|
||||||
if (client > MaxClients)
|
if (client > MaxClients)
|
||||||
@ -102,6 +107,19 @@ bool:ZRIsClientValid(client, bool:console = false)
|
|||||||
return console ? (client >= 0) : (client > 0);
|
return console ? (client >= 0) : (client > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a given index is console.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
* @param console True to include console (index 0), false if not.
|
||||||
|
* @return True if client is valid, false otherwise.
|
||||||
|
*/
|
||||||
|
stock bool:ZRIsConsole(index)
|
||||||
|
{
|
||||||
|
// Return true if index is = to console's index.
|
||||||
|
return (index == ZR_CONSOLE_INDEX);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count clients on each team.
|
* Count clients on each team.
|
||||||
*
|
*
|
||||||
@ -110,7 +128,7 @@ bool:ZRIsClientValid(client, bool:console = false)
|
|||||||
* @param alive If true it will only count live players, false will count alive and dead.
|
* @param alive If true it will only count live players, false will count alive and dead.
|
||||||
* @return True if successful (zombie has spawned), false otherwise.
|
* @return True if successful (zombie has spawned), false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, bool:ignorezombiespawned = false)
|
stock bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, bool:ignorezombiespawned = false)
|
||||||
{
|
{
|
||||||
// If zombie hasn't spawned and were not only counting humans, then stop.
|
// If zombie hasn't spawned and were not only counting humans, then stop.
|
||||||
if (!g_bZombieSpawned && !ignorezombiespawned)
|
if (!g_bZombieSpawned && !ignorezombiespawned)
|
||||||
@ -161,7 +179,7 @@ bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, b
|
|||||||
* @param team Team to check if player is on, -1 to check both.
|
* @param team Team to check if player is on, -1 to check both.
|
||||||
* @return True if client is on a team, false otherwise.
|
* @return True if client is on a team, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZRIsClientOnTeam(client, team = -1)
|
stock bool:ZRIsClientOnTeam(client, team = -1)
|
||||||
{
|
{
|
||||||
// If index is invalid, then stop.
|
// If index is invalid, then stop.
|
||||||
if (!ZRIsClientValid(client))
|
if (!ZRIsClientValid(client))
|
||||||
@ -185,7 +203,7 @@ bool:ZRIsClientOnTeam(client, team = -1)
|
|||||||
*
|
*
|
||||||
* @param team (Optional) Team to check if there are clients on.
|
* @param team (Optional) Team to check if there are clients on.
|
||||||
*/
|
*/
|
||||||
bool:ZRTeamHasClients(team = -1)
|
stock bool:ZRTeamHasClients(team = -1)
|
||||||
{
|
{
|
||||||
// If team is
|
// If team is
|
||||||
if (team == -1)
|
if (team == -1)
|
||||||
@ -204,7 +222,7 @@ bool:ZRTeamHasClients(team = -1)
|
|||||||
* @param client The client index.
|
* @param client The client index.
|
||||||
* @return True if generic admin, false otherwise.
|
* @return True if generic admin, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool:ZRIsClientAdmin(client)
|
stock bool:ZRIsClientAdmin(client)
|
||||||
{
|
{
|
||||||
// If index is invalid, then stop.
|
// If index is invalid, then stop.
|
||||||
if (!ZRIsClientValid(client))
|
if (!ZRIsClientValid(client))
|
||||||
|
@ -132,7 +132,7 @@ bool:ZSpawnClient(client)
|
|||||||
new bool:zspawn = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN]);
|
new bool:zspawn = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN]);
|
||||||
if (!zspawn)
|
if (!zspawn)
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "Feature is disabled");
|
TranslationPrintToChat(client, "Feature is disabled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ bool:ZSpawnClient(client)
|
|||||||
if (!ZRIsClientOnTeam(client))
|
if (!ZRIsClientOnTeam(client))
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when on a team.
|
// Tell client the command may only be used when on a team.
|
||||||
ZR_PrintToChat(client, "Must be on team");
|
TranslationPrintToChat(client, "Must be on team");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ bool:ZSpawnClient(client)
|
|||||||
if (IsPlayerAlive(client))
|
if (IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when dead.
|
// Tell client the command may only be used when dead.
|
||||||
ZR_PrintToChat(client, "Must be dead");
|
TranslationPrintToChat(client, "Must be dead");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ bool:ZSpawnClient(client)
|
|||||||
if (SerialClientExists(client))
|
if (SerialClientExists(client))
|
||||||
{
|
{
|
||||||
// Tell client the command may only be used when joining late.
|
// Tell client the command may only be used when joining late.
|
||||||
ZR_PrintToChat(client, "ZSpawn double spawn");
|
TranslationPrintToChat(client, "ZSpawn double spawn");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ bool:ZSpawnClient(client)
|
|||||||
new Float:zspawntime = GetConVarFloat(g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME]);
|
new Float:zspawntime = GetConVarFloat(g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME]);
|
||||||
|
|
||||||
// Tell client the timelimit for this command has expired.
|
// Tell client the timelimit for this command has expired.
|
||||||
ZR_PrintToChat(client, "ZSpawn timelimit", RoundToNearest(zspawntime));
|
TranslationPrintToChat(client, "ZSpawn timelimit", RoundToNearest(zspawntime));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ bool:ZTeleClient(client)
|
|||||||
if (infected && !ztelezombie)
|
if (infected && !ztelezombie)
|
||||||
{
|
{
|
||||||
// Tell client they must be human to use this feature.
|
// Tell client they must be human to use this feature.
|
||||||
ZR_PrintToChat(client, "Must be human");
|
TranslationPrintToChat(client, "Must be human");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ bool:ZTeleClient(client)
|
|||||||
if (!infected && !ztelehuman)
|
if (!infected && !ztelehuman)
|
||||||
{
|
{
|
||||||
// Tell client that feature is restricted at this time.
|
// Tell client that feature is restricted at this time.
|
||||||
ZR_PrintToChat(client, "ZTele restricted human");
|
TranslationPrintToChat(client, "ZTele restricted human");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,14 +143,14 @@ bool:ZTeleClient(client)
|
|||||||
if (g_iZTeleCount[client] >= ztelemax)
|
if (g_iZTeleCount[client] >= ztelemax)
|
||||||
{
|
{
|
||||||
// Tell client that they have already reached their limit.
|
// Tell client that they have already reached their limit.
|
||||||
ZR_PrintToChat(client, "ZTele max", ztelemax);
|
TranslationPrintToChat(client, "ZTele max", ztelemax);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If teleport is already in progress, then stop.
|
// If teleport is already in progress, then stop.
|
||||||
if (tZTele[client] != INVALID_HANDLE)
|
if (tZTele[client] != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
ZR_PrintToChat(client, "ZTele in progress");
|
TranslationPrintToChat(client, "ZTele in progress");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ bool:ZTeleClient(client)
|
|||||||
if (g_iZTeleTimeLeft[client] > 0)
|
if (g_iZTeleTimeLeft[client] > 0)
|
||||||
{
|
{
|
||||||
// Tell client how much time is left until teleport.
|
// Tell client how much time is left until teleport.
|
||||||
ZR_PrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
|
TranslationPrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
|
||||||
|
|
||||||
// Start repeating timer.
|
// Start repeating timer.
|
||||||
tZTele[client] = CreateTimer(1.0, ZTeleTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
tZTele[client] = CreateTimer(1.0, ZTeleTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
|
||||||
@ -182,7 +182,7 @@ bool:ZTeleClient(client)
|
|||||||
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR);
|
TeleportEntity(client, g_vecZTeleSpawn[client], NULL_VECTOR, NULL_VECTOR);
|
||||||
|
|
||||||
// Tell client they've been teleported.
|
// Tell client they've been teleported.
|
||||||
ZR_PrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
||||||
|
|
||||||
// Increment teleport count.
|
// Increment teleport count.
|
||||||
g_iZTeleCount[client]++;
|
g_iZTeleCount[client]++;
|
||||||
@ -225,8 +225,8 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
|||||||
tZTele[client] = INVALID_HANDLE;
|
tZTele[client] = INVALID_HANDLE;
|
||||||
|
|
||||||
// Tell client teleport has been cancelled.
|
// Tell client teleport has been cancelled.
|
||||||
ZR_PrintCenterText(client, "ZTele autocancel centertext");
|
TranslationPrintCenterText(client, "ZTele autocancel centertext");
|
||||||
ZR_PrintToChat(client, "ZTele autocancel text", RoundToNearest(autocanceldistance));
|
TranslationPrintToChat(client, "ZTele autocancel text", RoundToNearest(autocanceldistance));
|
||||||
|
|
||||||
// Stop timer.
|
// Stop timer.
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
@ -237,7 +237,7 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
|||||||
g_iZTeleTimeLeft[client]--;
|
g_iZTeleTimeLeft[client]--;
|
||||||
|
|
||||||
// Tell client how much time is left until teleport.
|
// Tell client how much time is left until teleport.
|
||||||
ZR_PrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
|
TranslationPrintCenterText(client, "ZTele countdown", g_iZTeleTimeLeft[client]);
|
||||||
|
|
||||||
// Time has expired.
|
// Time has expired.
|
||||||
if (g_iZTeleTimeLeft[client] <= 0)
|
if (g_iZTeleTimeLeft[client] <= 0)
|
||||||
@ -252,7 +252,7 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
|||||||
new ztelemax = InfectIsClientInfected(client) ? GetConVarInt(g_hCvarsList[CVAR_ZTELE_MAX_ZOMBIE]) : GetConVarInt(g_hCvarsList[CVAR_ZTELE_MAX_HUMAN]);
|
new ztelemax = InfectIsClientInfected(client) ? GetConVarInt(g_hCvarsList[CVAR_ZTELE_MAX_ZOMBIE]) : GetConVarInt(g_hCvarsList[CVAR_ZTELE_MAX_HUMAN]);
|
||||||
|
|
||||||
// Tell client spawn protection is over.
|
// Tell client spawn protection is over.
|
||||||
ZR_PrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
TranslationPrintCenterText(client, "ZTele countdown end", g_iZTeleCount[client], ztelemax);
|
||||||
|
|
||||||
// Clear timer handle.
|
// Clear timer handle.
|
||||||
tZTele[client] = INVALID_HANDLE;
|
tZTele[client] = INVALID_HANDLE;
|
||||||
|
Loading…
Reference in New Issue
Block a user