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
|
||||
|
||||
"Literal text"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "{1}"
|
||||
}
|
||||
// Set string to "{1}" for all languages.
|
||||
|
||||
"Feature is disabled"
|
||||
{
|
||||
"en" "This feature is currently disabled by the server host."
|
||||
@ -173,31 +180,37 @@
|
||||
|
||||
"Menu main zadmin"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "ZAdmin ({1}) - Open admin menu."
|
||||
}
|
||||
|
||||
"Menu main zclass"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "ZClass ({1}) - Configure your class settings."
|
||||
}
|
||||
|
||||
"Menu main zspawn"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "ZSpawn ({1}) - Join late? Use this to spawn."
|
||||
}
|
||||
|
||||
"Menu main ztele"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "ZTele ({1}) - Teleport back to your spawn location."
|
||||
}
|
||||
|
||||
"Menu main zhp"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "ZHP ({1}) - Toggle real HP display when infected."
|
||||
}
|
||||
|
||||
"Menu main zmarket"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "ZMarket ({1}) - Need a weapon? Buy them here."
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
// Core includes.
|
||||
#include "zr/zombiereloaded"
|
||||
#include "zr/log"
|
||||
#include "zr/translation"
|
||||
#include "zr/cvars"
|
||||
#include "zr/log"
|
||||
#include "zr/config"
|
||||
#include "zr/serial"
|
||||
#include "zr/translation"
|
||||
#include "zr/sayhooks"
|
||||
#include "zr/tools"
|
||||
#include "zr/models"
|
||||
@ -57,7 +57,7 @@
|
||||
#include "zr/ztele"
|
||||
#include "zr/zhp"
|
||||
#include "zr/jumpboost"
|
||||
#include "zr/anticamp"
|
||||
//#include "zr/anticamp"
|
||||
|
||||
// Almost replaced! :)
|
||||
#include "zr/zombie"
|
||||
@ -95,36 +95,15 @@ public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
|
||||
*/
|
||||
public OnPluginStart()
|
||||
{
|
||||
// Load translations phrases used by plugin.
|
||||
LoadTranslations("common.phrases.txt");
|
||||
LoadTranslations("zombiereloaded.phrases.txt");
|
||||
|
||||
// Log
|
||||
LogInit();
|
||||
|
||||
// Cvars
|
||||
// Forward event to modules.
|
||||
TranslationInit();
|
||||
CvarsInit();
|
||||
|
||||
// Tools
|
||||
ToolsInit();
|
||||
|
||||
// Commands
|
||||
CommandsInit();
|
||||
|
||||
// Weapons
|
||||
WeaponsInit();
|
||||
|
||||
// Say Hooks
|
||||
SayHooksInit();
|
||||
|
||||
// Event
|
||||
EventInit();
|
||||
|
||||
// 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);
|
||||
MarketInit();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,7 +147,6 @@ public OnMapStart()
|
||||
SEffectsOnMapStart();
|
||||
AntiStickOnMapStart();
|
||||
ZSpawnOnMapStart();
|
||||
Anticamp_Startup();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -177,7 +155,6 @@ public OnMapStart()
|
||||
public OnMapEnd()
|
||||
{
|
||||
// Forward event to modules.
|
||||
Anticamp_Disable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -352,7 +352,7 @@ HurtPlayersInVolume(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];
|
||||
if (client_health > 0)
|
||||
{
|
||||
|
@ -89,10 +89,7 @@ ConfigLoad()
|
||||
ServerCommand("exec %s", mapconfig);
|
||||
|
||||
// Log action.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS))
|
||||
{
|
||||
LogMessageFormatted(-1, "", "", "Executed map config file: %s.", LOG_FORMAT_TYPE_SIMPLE, mapconfig);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Config", "Map Configs", "Executed map config file: %s", path);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +103,6 @@ ConfigOnModulesLoaded()
|
||||
decl String:mapname[256];
|
||||
decl String:mapconfig[PLATFORM_MAX_PATH];
|
||||
decl String:path[PLATFORM_MAX_PATH];
|
||||
new bool:cfgexists;
|
||||
|
||||
// Get map name and format into config path.
|
||||
GetCurrentMap(mapname, sizeof(mapname));
|
||||
@ -120,7 +116,7 @@ ConfigOnModulesLoaded()
|
||||
// boolean first works.
|
||||
|
||||
// Check if the file exist.
|
||||
cfgexists = FileExists(path);
|
||||
new bool:cfgexists = FileExists(path);
|
||||
if (!cfgexists)
|
||||
{
|
||||
// File doesn't exist, then stop.
|
||||
@ -131,10 +127,7 @@ ConfigOnModulesLoaded()
|
||||
ServerCommand("exec %s", mapconfig);
|
||||
|
||||
// Log action.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS))
|
||||
{
|
||||
LogMessageFormatted(-1, "", "", "Executed post map config file: %s.", LOG_FORMAT_TYPE_SIMPLE, mapconfig);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Config", "Map Configs", "Executed post map config file: %s", path);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,7 +148,6 @@ bool:ConfigGetFilePath(CvarsList:cvar, String:path[])
|
||||
return FileExists(path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
@ -25,6 +25,15 @@
|
||||
enum CvarsList
|
||||
{
|
||||
Handle:CVAR_ENABLE,
|
||||
Handle:CVAR_LOG,
|
||||
Handle:CVAR_LOG_LOAD,
|
||||
Handle:CVAR_LOG_CORE,
|
||||
Handle:CVAR_LOG_FILTER_MODULES,
|
||||
Handle:CVAR_LOG_FILTER_DESCRIPTION,
|
||||
Handle:CVAR_LOG_FILTER_DEBUG,
|
||||
Handle:CVAR_LOG_PRINT_ADMINS,
|
||||
Handle:CVAR_LOG_PRINT_CHAT,
|
||||
Handle:CVAR_LOG_PRINT_CONSOLE,
|
||||
Handle:CVAR_CONFIG_PATH_MODELS,
|
||||
Handle:CVAR_CONFIG_PATH_DOWNLOADS,
|
||||
Handle:CVAR_CONFIG_PATH_PLAYERCLASSES,
|
||||
@ -157,6 +166,11 @@ CvarsInit()
|
||||
// Hook cvars.
|
||||
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.
|
||||
VEffectsOnCvarInit();
|
||||
}
|
||||
@ -191,7 +205,13 @@ CvarsCreate()
|
||||
// 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)
|
||||
@ -203,12 +223,12 @@ CvarsCreate()
|
||||
// Config (core)
|
||||
// ===========================
|
||||
|
||||
g_hCvarsList[CVAR_CONFIG_PATH_MODELS] = CreateConVar("zr_config_path_models", "configs/zr/models.txt", "");
|
||||
g_hCvarsList[CVAR_CONFIG_PATH_DOWNLOADS] = CreateConVar("zr_config_path_downloads", "configs/zr/downloads.txt");
|
||||
g_hCvarsList[CVAR_CONFIG_PATH_PLAYERCLASSES] = CreateConVar("zr_config_path_playerclasses", "configs/zr/playerclasses.txt");
|
||||
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONS] = CreateConVar("zr_config_path_weapons", "configs/zr/weapons/weapons.txt");
|
||||
g_hCvarsList[CVAR_CONFIG_PATH_WEAPONGROUPS] = CreateConVar("zr_config_path_weapongroups", "configs/zr/weapons/weapongroups.txt");
|
||||
g_hCvarsList[CVAR_CONFIG_PATH_HITGROUPS] = CreateConVar("zr_config_path_hitgroups", "configs/zr/hitgroups.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", "Path to downloads file. [Relative to root sourcemod directory]");
|
||||
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", "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", "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", "Path to hitgroups config file. [Relative to root sourcemod directory]");
|
||||
|
||||
// ===========================
|
||||
// Tools (core)
|
||||
@ -228,24 +248,17 @@ CvarsCreate()
|
||||
|
||||
// General
|
||||
|
||||
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "");
|
||||
// Old Desc: Classmenu is re-displayed every spawn (0: Disable)
|
||||
g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "");
|
||||
// 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_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "");
|
||||
// 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.
|
||||
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "Re-display class selection menu every spawn.");
|
||||
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_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "Zombie class assigned to players on connect ['random' = Random class | '""' = Class config default]");
|
||||
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_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "Admin class assigned to admins on connect ['random' = Random class | '""' = Class config default]");");
|
||||
|
||||
// Overlays
|
||||
|
||||
g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE] = CreateConVar("zr_classes_overlay_toggle", "1", "");
|
||||
// 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", "");
|
||||
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.]
|
||||
g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE] = CreateConVar("zr_classes_overlay_toggle", "1", "Allow players to toggle class overlay.");
|
||||
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_DEFAULT] = CreateConVar("zr_classes_overlay_default", "0", "Default class overlay toggle state [Reliance: zr_classes_overlay_toggle]");
|
||||
|
||||
// ===========================
|
||||
// Weapons (core)
|
||||
@ -537,10 +550,6 @@ CvarsHook(bool:unhook = false)
|
||||
HookConVarChange(g_hAutoTeamBalance, CvarsHookLocked);
|
||||
HookConVarChange(g_hLimitTeams, CvarsHookLocked);
|
||||
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);
|
||||
|
||||
// If log flag check fails, then don't log.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
||||
{
|
||||
LogMessageFormatted(-1, "Cvars", "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".", LOG_FORMAT_TYPE_FULL);
|
||||
}
|
||||
LogPrintToLog(_, "Cvars", "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".");
|
||||
}
|
||||
// If cvar is mp_limitteams, then continue.
|
||||
else if (cvar == g_hLimitTeams)
|
||||
@ -584,10 +590,7 @@ public CvarsHookLocked(Handle:cvar, const String:oldvalue[], const String:newval
|
||||
SetConVarInt(g_hLimitTeams, CVARS_LIMITTEAMS_LOCKED);
|
||||
|
||||
// If log flag check fails, then don't log.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
||||
{
|
||||
LogMessageFormatted(-1, "Cvars", "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".", LOG_FORMAT_TYPE_FULL);
|
||||
}
|
||||
LogPrintToLog(_, "Cvars", "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".");
|
||||
}
|
||||
}
|
||||
|
||||
@ -615,8 +618,5 @@ public CvarsHookRestartGame(Handle:cvar, const String:oldvalue[], const String:n
|
||||
RoundEndTerminateRound(delay);
|
||||
|
||||
// If log flag check fails, then don't log.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
|
||||
{
|
||||
LogMessageFormatted(-1, "Cvars", "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.", LOG_FORMAT_TYPE_FULL);
|
||||
}
|
||||
LogPrintToLog(_, "Cvars", "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.");
|
||||
}
|
||||
|
@ -275,14 +275,6 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
||||
*/
|
||||
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 (!g_bZombieSpawned)
|
||||
{
|
||||
@ -318,13 +310,10 @@ public Action:DamageSuicideIntercept(client, argc)
|
||||
}
|
||||
|
||||
// Tell client their command has been intercepted.
|
||||
ZR_ReplyToCommand(client, "Damage suicide intercept");
|
||||
TranslationReplyToCommand(client, "Damage suicide intercept");
|
||||
|
||||
// Log attempt.
|
||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_DAMAGE))
|
||||
{
|
||||
LogMessageFormatted(client, "Damage", "Suicide Intercept", "Player %N attempted suicide.", LOG_FORMAT_TYPE_FULL, client);
|
||||
}
|
||||
// Log suicide interception
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Damage", "Suicide Intercept", "\"%L\" attempted suicide.", client);
|
||||
|
||||
// Block command.
|
||||
return Plugin_Handled;
|
||||
|
@ -66,7 +66,8 @@ EventHook(bool:unhook = false)
|
||||
*/
|
||||
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.
|
||||
OverlaysOnRoundStart();
|
||||
@ -183,7 +184,7 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad
|
||||
ZTeleOnClientSpawn(index);
|
||||
ZHPOnClientSpawn(index);
|
||||
|
||||
ZR_PrintToChat(index, "General zmenu reminder");
|
||||
TranslationPrintToChat(index, "General zmenu reminder");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,11 +69,7 @@ HitgroupsLoad()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_HITGROUPS))
|
||||
{
|
||||
LogMessageFormatted(-1, "Hitgroups", "Config Validation", "Missing hitgroups config file: %s", LOG_FORMAT_TYPE_ERROR, pathhitgroups);
|
||||
}
|
||||
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Hitgroups", "Config Validation", "Missing hitgroups config file: %s", pathhitgroups);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,16 +85,11 @@ HitgroupsLoad()
|
||||
*/
|
||||
HitgroupsValidateConfig()
|
||||
{
|
||||
// If log flag check fails, then don't log.
|
||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_HITGROUPS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
KvRewind(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);
|
||||
|
||||
// Tell client they have been randomly been chosen to replace disconnecting zombie.
|
||||
ZR_PrintToChat(randclient, "Infect disconnect");
|
||||
TranslationPrintToChat(randclient, "Infect disconnect");
|
||||
|
||||
// Destroy handle.
|
||||
CloseHandle(arrayEligibleClients);
|
||||
@ -569,7 +569,7 @@ InfectClient(client, attacker = -1, bool:motherinfect = false)
|
||||
SetGlobalTransTarget(client);
|
||||
|
||||
// Print message to client.
|
||||
ZR_PrintToChat(client, "Infect infected");
|
||||
TranslationPrintToChat(client, "Infect infected");
|
||||
|
||||
// Forward event to modules.
|
||||
ClassOnClientInfected(client, motherinfect);
|
||||
|
232
src/zr/log.inc
232
src/zr/log.inc
@ -22,225 +22,101 @@
|
||||
/**
|
||||
* @section Log format types
|
||||
*/
|
||||
#define LOG_FORMAT_TYPE_SIMPLE 0 /** Simple log message. */
|
||||
#define LOG_FORMAT_TYPE_FULL 1 /** Full log message, printed in normal log. */
|
||||
#define LOG_FORMAT_TYPE_ERROR 2 /** Full log message, 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_NORMAL 1 /** Printed in normal log. */
|
||||
#define LOG_FORMAT_TYPE_DEBUG 2 /** Printed in normal log, flagged as debug. */
|
||||
#define LOG_FORMAT_TYPE_ERROR 3 /** Printed in error log. */
|
||||
#define LOG_FORMAT_TYPE_FATALERROR 4 /** Stops the plugin + LOG_FORMAT_TYPE_ERROR */
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
/**
|
||||
* @section Logging flags.
|
||||
*/
|
||||
#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.
|
||||
* Print a formatted message to logs or error logs.
|
||||
*
|
||||
* @param client Specifies the client who triggered the event/command. Use
|
||||
* -1 for core events like validation, etc.
|
||||
* @param module what module the log event belongs to.
|
||||
* @param block What function or code block the log is triggered from.
|
||||
* @param message Log message. Formatted string.
|
||||
* @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.
|
||||
* @param type (Optional) Logging type. (See LOG_FORMAT_TYPE_* defines)
|
||||
* @param module Module the log belongs to.
|
||||
* @param description Short descriptive phrase to group together similar logs.
|
||||
* @param text Text to print to log.
|
||||
* @param ... 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.
|
||||
new bool:log = GetConVarBool(g_hLog);
|
||||
new bool:log = GetConVarBool(g_hCvarsList[CVAR_LOG]);
|
||||
if (!log)
|
||||
{
|
||||
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 (client == 0 && LogCheckFlag(LOG_IGNORE_CONSOLE))
|
||||
if (StrContains(filtermodules, module, false) > -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Format log text.
|
||||
VFormat(logtext, sizeof(logtext), message, 6);
|
||||
// If description is filtered, then stop.
|
||||
decl String:filterdescription[256];
|
||||
GetConVarString(g_hCvarsList[CVAR_LOG_FILTER_DESCRIPTION], filterdescription, sizeof(filterdescription));
|
||||
|
||||
if (StrContains(filterdescription, description, false) > -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If debug is disabled, then stop.
|
||||
new bool:filterdebug = GetConVarBool(g_hCvarsList[CVAR_LOG_FILTER_DEBUG]);
|
||||
if (filterdebug && type == LOG_FORMAT_TYPE_DEBUG)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 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.
|
||||
switch (type)
|
||||
{
|
||||
// Log type is simple.
|
||||
case LOG_FORMAT_TYPE_SIMPLE:
|
||||
// Log type is normal.
|
||||
case LOG_FORMAT_TYPE_NORMAL:
|
||||
{
|
||||
LogMessage(logtext);
|
||||
}
|
||||
// Log type is full.
|
||||
case LOG_FORMAT_TYPE_FULL:
|
||||
{
|
||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
||||
LogMessage(logtext);
|
||||
LogMessage(logbuffer);
|
||||
}
|
||||
// Log type is error.
|
||||
case LOG_FORMAT_TYPE_ERROR:
|
||||
{
|
||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
||||
LogError(logtext);
|
||||
LogError(logbuffer);
|
||||
}
|
||||
// Log type is fatal error.
|
||||
case LOG_FORMAT_TYPE_FATALERROR:
|
||||
{
|
||||
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
|
||||
SetFailState(logtext);
|
||||
SetFailState(logbuffer);
|
||||
}
|
||||
}
|
||||
|
||||
// If log to admin flag is enabled, then print to admins.
|
||||
if (LogCheckFlag(LOG_TO_ADMINS))
|
||||
// If print to admin cvar is enabled, then print to all connect admins.
|
||||
new bool:printadmins = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_ADMINS]);
|
||||
if (printadmins)
|
||||
{
|
||||
// Print text to admins.
|
||||
LogToAdmins(logtext);
|
||||
}
|
||||
|
||||
// If client is a valid client (but not console), and we log to client's then continue.
|
||||
if (ZRIsClientValid(client) && LogCheckFlag(LOG_TO_CLIENT))
|
||||
{
|
||||
// Set client as translation target.
|
||||
SetGlobalTransTarget(client);
|
||||
// Note: The phrase "Literal text" is a blank phrase to pass any string we want into it.
|
||||
|
||||
// Print to client.
|
||||
PrintToConsole(client, "[ZR] %s", logtext);
|
||||
}
|
||||
}
|
||||
|
||||
LogToAdmins(String:message[])
|
||||
{
|
||||
decl String:buffer[LOG_MAX_LENGTH_CHAT];
|
||||
|
||||
// x = client index.
|
||||
for (new x = 1; x < MaxClients; x++)
|
||||
{
|
||||
// If client isn't in-game, then stop.
|
||||
if (!IsClientInGame(x))
|
||||
new bool:printchat = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CHAT]);
|
||||
if (printchat)
|
||||
{
|
||||
continue;
|
||||
TranslationPrintToChatAll(false, true, "Literal text", logbuffer);
|
||||
}
|
||||
|
||||
// If client isn't an admin, then stop.
|
||||
if (!ZRIsClientAdmin(x))
|
||||
new bool:printconsole = GetConVarBool(g_hCvarsList[CVAR_LOG_PRINT_CONSOLE]);
|
||||
if (printconsole)
|
||||
{
|
||||
continue;
|
||||
TranslationPrintToConsoleAll(false, true, "Literal text", logbuffer);
|
||||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
// Initialize log boolean.
|
||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE);
|
||||
|
||||
// Get models file path.
|
||||
decl String:pathmodels[PLATFORM_MAX_PATH];
|
||||
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_MODELS, pathmodels);
|
||||
@ -51,7 +48,7 @@ ModelsPrepModels()
|
||||
if (!exists)
|
||||
{
|
||||
// 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.
|
||||
@ -65,7 +62,7 @@ ModelsPrepModels()
|
||||
// If array couldn't be created, then fail.
|
||||
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;
|
||||
@ -155,26 +152,17 @@ ModelsPrepModels()
|
||||
x--;
|
||||
|
||||
// Log missing model files.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Models", "Config Validation", "Missing model files on server (%s)", LOG_FORMAT_TYPE_ERROR, modelbase);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Models", "Config Validation", "Missing model files on server (%s)", modelbase);
|
||||
}
|
||||
}
|
||||
|
||||
// Log model validation info.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Models", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", LOG_FORMAT_TYPE_FULL, modelcount, modelvalidcount, modelcount - modelvalidcount);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Models", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", modelcount, modelvalidcount, modelcount - modelvalidcount);
|
||||
|
||||
// If none of the model paths are valid, then log and fail.
|
||||
if (!modelvalidcount)
|
||||
{
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Models", "Config Validation", "No usable model paths in %s", LOG_FORMAT_TYPE_FATALERROR, pathmodels);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_FATALERROR, "Models", "Config Validation", "Fatal Error: No usable model paths in %s", pathmodels);
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,9 +171,6 @@ ModelsPrepModels()
|
||||
*/
|
||||
ModelsPrepDownloads()
|
||||
{
|
||||
// Initialize log boolean.
|
||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE);
|
||||
|
||||
// Get downloads file path.
|
||||
decl String:pathdownloads[PLATFORM_MAX_PATH];
|
||||
new bool:exists = ConfigGetFilePath(CVAR_CONFIG_PATH_DOWNLOADS, pathdownloads);
|
||||
@ -194,10 +179,7 @@ ModelsPrepDownloads()
|
||||
if (!exists)
|
||||
{
|
||||
// Log error, then stop.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Missing downloads file: \"%s\"", LOG_FORMAT_TYPE_ERROR, pathdownloads);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Missing downloads file: \"%s\"", pathdownloads);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -207,10 +189,7 @@ ModelsPrepDownloads()
|
||||
// If array couldn't be created, then fail.
|
||||
if (arrayModelsList == INVALID_HANDLE)
|
||||
{
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Error parsing \"%s\"", LOG_FORMAT_TYPE_ERROR, pathdownloads);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Error parsing \"%s\"", pathdownloads);
|
||||
}
|
||||
|
||||
new downloadcount;
|
||||
@ -238,11 +217,7 @@ ModelsPrepDownloads()
|
||||
// Backtrack one index, because we deleted it out from under the loop.
|
||||
x--;
|
||||
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Missing file \"%s\"", LOG_FORMAT_TYPE_ERROR, downloadpath);
|
||||
}
|
||||
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Downloads", "Config Validation", "Missing file \"%s\"", downloadpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -254,8 +229,5 @@ ModelsPrepDownloads()
|
||||
}
|
||||
|
||||
// Log model validation info.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Downloads", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", LOG_FORMAT_TYPE_FULL, downloadcount, downloadvalidcount, downloadcount - downloadvalidcount);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Downloads", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", 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 (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;
|
||||
}
|
||||
|
||||
|
@ -92,10 +92,20 @@ public Action:Command_ClassDump(client, argc)
|
||||
// Dump the specified cache.
|
||||
ReplyToCommand(client, "DUMPING CACHE: \"%s\" (%d classes total)\n========================================\n", type, ClassCount);
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,12 +94,12 @@ ClassOnClientSpawn(client)
|
||||
// Mark zombie class as selected.
|
||||
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie;
|
||||
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.
|
||||
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman;
|
||||
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.
|
||||
ClassReloadPlayerCache(client, randomhuman);
|
||||
|
@ -81,7 +81,7 @@ ClassOverlayOnClientSpawn(client)
|
||||
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
|
||||
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];
|
||||
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];
|
||||
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.
|
||||
switch (teamid)
|
||||
{
|
||||
@ -740,20 +737,13 @@ ClassGetDefaultSpawnClass(teamid, cachetype = ZR_CLASS_CACHE_MODIFIED)
|
||||
// in the specified team, and log a warning.
|
||||
classindex = ClassGetFirstClass(teamid, _, cachetype);
|
||||
|
||||
if (enablelog)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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);
|
||||
|
||||
// Validate the new index.
|
||||
if (ClassValidateIndex(classindex))
|
||||
{
|
||||
// Log a warning.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Classes", "DefaultSpawnClass", "Warning: The default class name \"%s\" does not exist or matches the team ID.", _, classname);
|
||||
}
|
||||
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Default Spawn Class", "Warning: The default class name \"%s\" does not exist or matches the team ID.", classname);
|
||||
return classindex;
|
||||
}
|
||||
else
|
||||
|
@ -322,9 +322,6 @@ new ClassPlayerNextAdminClass[MAXPLAYERS + 1];
|
||||
*/
|
||||
ClassLoad()
|
||||
{
|
||||
// Initialize log boolean.
|
||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES);
|
||||
|
||||
// Make sure kvClassData is ready to use.
|
||||
if (kvClassData != INVALID_HANDLE)
|
||||
{
|
||||
@ -339,16 +336,12 @@ ClassLoad()
|
||||
// If file doesn't exist, then log and stop.
|
||||
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;
|
||||
}
|
||||
|
||||
// Log what class file that is loaded.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Classes", "Load", "Loading classes from file \"%s\".", LOG_FORMAT_TYPE_SIMPLE, pathclasses);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Loading classes from file \"%s\".", pathclasses);
|
||||
|
||||
// Put file data into memory.
|
||||
FileToKeyValues(kvClassData, pathclasses);
|
||||
@ -357,7 +350,7 @@ ClassLoad()
|
||||
KvRewind(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];
|
||||
@ -375,10 +368,7 @@ ClassLoad()
|
||||
if (ClassCount > ZR_CLASS_MAX)
|
||||
{
|
||||
// Maximum classes reached. Write a warning and exit the loop.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Classes", "Load", "Warning: Maximum classes reached (%d). Skipping other classes.", _, ZR_CLASS_MAX + 1);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Warning: Maximum classes reached (%d). Skipping other classes.", ZR_CLASS_MAX + 1);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -439,10 +429,7 @@ ClassLoad()
|
||||
// There's one or more invalid class attributes. Disable the class
|
||||
// and log an error message.
|
||||
ClassData[ClassCount][class_enabled] = false;
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", LOG_FORMAT_TYPE_ERROR, ClassCount, ClassErrorFlags);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Classes", "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", ClassCount, ClassErrorFlags);
|
||||
|
||||
failedcount++;
|
||||
}
|
||||
@ -454,13 +441,13 @@ ClassLoad()
|
||||
// Validate team requirements.
|
||||
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.
|
||||
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.
|
||||
@ -470,10 +457,7 @@ ClassLoad()
|
||||
ClassValidated = true;
|
||||
|
||||
// Log summary.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Classes", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", _, ClassCount, ClassCount - failedcount, failedcount);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "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
|
||||
// log a warning.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES))
|
||||
{
|
||||
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);
|
||||
}
|
||||
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\".");
|
||||
|
||||
// Use default class.
|
||||
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
|
||||
// log a warning.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CLASSES))
|
||||
{
|
||||
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);
|
||||
}
|
||||
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\".");
|
||||
|
||||
// Use default class.
|
||||
humanindex = ClassGetDefaultClass(ZR_CLASS_TEAM_HUMANS);
|
||||
|
@ -57,9 +57,6 @@ bool:AmbientSoundsValidateConfig()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize log boolean.
|
||||
new bool:enablelog = LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_AMBIENTSOUNDS);
|
||||
|
||||
// Get ambient sound file.
|
||||
decl String:sound[SOUND_MAX_PATH];
|
||||
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
|
||||
@ -69,11 +66,7 @@ bool:AmbientSoundsValidateConfig()
|
||||
if (!FileExists(sound, true))
|
||||
{
|
||||
// Log invalid sound file error.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Invalid sound file specified in zr_ambientsounds_file.", LOG_FORMAT_TYPE_ERROR);
|
||||
}
|
||||
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Invalid sound file specified in \"zr_ambientsounds_file\".");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -82,10 +75,7 @@ bool:AmbientSoundsValidateConfig()
|
||||
if (ambientvolume <= 0.0)
|
||||
{
|
||||
// Log invalid ambient sound volume error.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Ambient sound is either muted or invalid.", LOG_FORMAT_TYPE_ERROR);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Ambient sound is either muted or invalid.");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -95,10 +85,7 @@ bool:AmbientSoundsValidateConfig()
|
||||
if (ambientlength <= 0.0)
|
||||
{
|
||||
// Log invalid ambient sound length error.
|
||||
if (enablelog)
|
||||
{
|
||||
LogMessageFormatted(-1, "Ambient Sounds", "Config Validation", "Specified ambient sound length is invalid.", LOG_FORMAT_TYPE_ERROR);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Ambient Sounds", "Config Validation", "Specified ambient sound length is invalid.");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -91,10 +91,10 @@ SpawnProtectOnClientSpawn(client)
|
||||
pSpawnProtectTime[client] = protect_time;
|
||||
|
||||
// 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.
|
||||
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||
TranslationPrintHUDText(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||
|
||||
// Start repeating timer.
|
||||
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]--;
|
||||
|
||||
// Print time left to client.
|
||||
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||
TranslationPrintHUDText(client, "Spawn Protect", pSpawnProtectTime[client]);
|
||||
|
||||
// Time has expired.
|
||||
if (pSpawnProtectTime[client] <= 0)
|
||||
@ -151,7 +151,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
|
||||
bInfectImmune[client][INFECT_TYPE_NORMAL] = false;
|
||||
|
||||
// Tell client spawn protection is over.
|
||||
ZR_HudHint(client, "Spawn protection end");
|
||||
TranslationPrintHUDText(client, "Spawn protection end");
|
||||
|
||||
// Fix attributes.
|
||||
ToolsSetClientAlpha(client, ClassGetAlphaInitial(client));
|
||||
|
@ -62,70 +62,70 @@ ToolsFindOffsets()
|
||||
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
|
||||
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.
|
||||
g_iToolsBaseVelocity = FindSendPropInfo("CBasePlayer", "m_vecBaseVelocity");
|
||||
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.
|
||||
g_iToolsLMV = FindSendPropInfo("CCSPlayer", "m_flLaggedMovementValue");
|
||||
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.
|
||||
g_iToolsHasNightVision = FindSendPropInfo("CCSPlayer", "m_bHasNightVision");
|
||||
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.
|
||||
g_iToolsNightVisionOn = FindSendPropInfo("CCSPlayer", "m_bNightVisionOn");
|
||||
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.
|
||||
g_iToolsCollisionGroup = FindSendPropInfo("CBaseEntity", "m_CollisionGroup");
|
||||
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.
|
||||
g_iToolsAccount = FindSendPropInfo("CCSPlayer", "m_iAccount");
|
||||
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.
|
||||
g_iToolsDefaultFOV = FindSendPropInfo("CBasePlayer", "m_iDefaultFOV");
|
||||
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.
|
||||
g_iToolsInBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone");
|
||||
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.
|
||||
g_iToolsActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
|
||||
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 (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."
|
||||
@ -152,7 +152,7 @@ ToolsSetupGameData()
|
||||
// If offset "EyeAngles" can't be found, then stop the plugin.
|
||||
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."
|
||||
@ -165,7 +165,7 @@ ToolsSetupGameData()
|
||||
// If offset "TerminateRound" can't be found, then stop the plugin.
|
||||
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."
|
||||
@ -179,6 +179,6 @@ ToolsSetupGameData()
|
||||
// If offset "CSWeaponDrop" can't be found, then stop the plugin.
|
||||
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)
|
||||
{
|
||||
Format(text, maxlen, "@green[ZR] @default%s", text);
|
||||
|
||||
ReplaceString(text, maxlen, "@default","\x01");
|
||||
ReplaceString(text, maxlen, "@lgreen","\x03");
|
||||
ReplaceString(text, maxlen, "@green","\x04");
|
||||
}
|
||||
/**
|
||||
* @section Max length of different message formats.
|
||||
*/
|
||||
#define TRANSLATION_MAX_LENGTH_CHAT 192
|
||||
#define TRANSLATION_MAX_LENGTH_CONSOLE 1024
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Prefix on all messages printed from the plugin.
|
||||
*/
|
||||
#define TRANSLATION_PHRASE_PREFIX "[ZR]"
|
||||
|
||||
stock ZR_PrintCenterText(client, any:...)
|
||||
{
|
||||
SetGlobalTransTarget(client);
|
||||
|
||||
decl String:phrase[192];
|
||||
|
||||
VFormat(phrase, sizeof(phrase), "%t", 2);
|
||||
|
||||
PrintCenterText(client, phrase);
|
||||
}
|
||||
/**
|
||||
* @section Text color chars.
|
||||
*/
|
||||
#define TRANSLATION_TEXT_COLOR_DEFAULT "\x01"
|
||||
#define TRANSLATION_TEXT_COLOR_LGREEN "\x03"
|
||||
#define TRANSLATION_TEXT_COLOR_GREEN "\x04"
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* HUD text usermsg
|
||||
*/
|
||||
#define TRANSLATION_USERMSG_HINTTEXT "HintText"
|
||||
|
||||
stock ZR_PrintToServer(any:...)
|
||||
/**
|
||||
* Load translations file here.
|
||||
*/
|
||||
TranslationInit()
|
||||
{
|
||||
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);
|
||||
// Load translations phrases used by plugin.
|
||||
LoadTranslations("common.phrases.txt");
|
||||
LoadTranslations("zombiereloaded.phrases.txt");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 text The text to print.
|
||||
* @param ... Translation formatting parameters.
|
||||
*/
|
||||
stock ZR_ReplyToCommandLong(client, const String:text[])
|
||||
stock TranslationPrintToChat(client, any:...)
|
||||
{
|
||||
decl String:partbuffer[1024];
|
||||
new pos;
|
||||
new cellswritten = 1; // Initialize for the loop.
|
||||
// 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.
|
||||
PrintToChat(client, translation);
|
||||
}
|
||||
|
||||
while (cellswritten)
|
||||
/**
|
||||
* 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:...)
|
||||
{
|
||||
decl String:translation[TRANSLATION_MAX_LENGTH_CHAT];
|
||||
|
||||
if (server)
|
||||
{
|
||||
cellswritten = strcopy(partbuffer, sizeof(partbuffer), text[pos]);
|
||||
ReplyToCommand(client, partbuffer);
|
||||
pos += cellswritten;
|
||||
// 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;
|
||||
|
||||
/**
|
||||
* Set global market flag variable
|
||||
*/
|
||||
MarketInit()
|
||||
{
|
||||
// Set market variable to true if market is installed.
|
||||
g_bMarket = LibraryExists("market");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends market menu to client.
|
||||
*
|
||||
@ -26,7 +35,7 @@ bool:ZMarketMenu(client)
|
||||
if (!g_bMarket)
|
||||
{
|
||||
// Tell client market is disabled.
|
||||
ZR_PrintToChat(client, "Feature is disabled");
|
||||
TranslationPrintToChat(client, "Feature is disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -34,7 +43,7 @@ bool:ZMarketMenu(client)
|
||||
if (!IsPlayerAlive(client))
|
||||
{
|
||||
// Tell player they must be alive.
|
||||
ZR_PrintToChat(client, "Must be alive");
|
||||
TranslationPrintToChat(client, "Must be alive");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -43,7 +52,7 @@ bool:ZMarketMenu(client)
|
||||
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
||||
{
|
||||
// Tell client they must be in a buyzone.
|
||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
||||
TranslationPrintCenterText(client, "Market out of buyzone");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -93,7 +102,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
||||
// If player is a zombie, then stop.
|
||||
if (InfectIsClientInfected(client))
|
||||
{
|
||||
ZR_PrintToChat(client, "Zombie cant use weapon");
|
||||
TranslationPrintToChat(client, "Zombie cant use weapon");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -120,7 +129,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
||||
// If the weapon is restricted, then stop.
|
||||
if (RestrictIsWeaponRestricted(weapon))
|
||||
{
|
||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
||||
TranslationPrintToChat(client, "Weapon is restricted", weapon);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -129,7 +138,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
||||
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
||||
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
||||
{
|
||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
||||
TranslationPrintCenterText(client, "Market out of buyzone");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -105,10 +105,7 @@ RestrictOnMapStart()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing weapon groups config file: %s", LOG_FORMAT_TYPE_ERROR, pathweapongroups);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "Missing weapon groups config file: %s", pathweapongroups);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -159,12 +156,6 @@ RestrictDefaultRestrictions()
|
||||
*/
|
||||
RestrictValidateWeaponGroups()
|
||||
{
|
||||
// If log flag check fails, then don't log.
|
||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset keygroup's traversal stack.
|
||||
KvRewind(kvWeaponGroups);
|
||||
|
||||
@ -188,7 +179,7 @@ RestrictValidateWeaponGroups()
|
||||
// If weapon is invalid, then log it.
|
||||
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));
|
||||
|
||||
@ -197,7 +188,7 @@ RestrictValidateWeaponGroups()
|
||||
// If it couldn't traverse to the weapons, then log no weapons within group.
|
||||
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));
|
||||
}
|
||||
@ -259,19 +250,10 @@ RestrictOnClientSpawn(client)
|
||||
*/
|
||||
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 (InfectIsClientInfected(client))
|
||||
{
|
||||
ZR_PrintToChat(client, "Zombie cant use weapon");
|
||||
TranslationPrintToChat(client, "Zombie cant use weapon");
|
||||
|
||||
// Block command
|
||||
return Plugin_Handled;
|
||||
@ -285,7 +267,7 @@ public Action:RestrictBuyCommand(client, argc)
|
||||
// Check if the weapon is restricted, if so then block command.
|
||||
if (RestrictIsWeaponRestricted(weapon))
|
||||
{
|
||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
||||
TranslationPrintToChat(client, "Weapon is restricted", weapon);
|
||||
|
||||
// Block command.
|
||||
return Plugin_Handled;
|
||||
@ -480,12 +462,8 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
||||
// Weapon was successfully restricted.
|
||||
case Successful_Weapon:
|
||||
{
|
||||
ZR_PrintToChat(0, "Restrict weapon", weapon);
|
||||
|
||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(client, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
||||
}
|
||||
TranslationPrintToChatAll(true, false, "Restrict weapon", weapon);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon: \"%s\".", client, weapon);
|
||||
}
|
||||
// Weapon group was successfully restricted.
|
||||
case Successful_Group:
|
||||
@ -493,23 +471,19 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
||||
decl String:weaponlist[128];
|
||||
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||
|
||||
ZR_PrintToChat(0, "Restrict custom weapon group", weapon, weaponlist);
|
||||
|
||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(client, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon group: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
||||
}
|
||||
TranslationPrintToChatAll(true, false, "Restrict custom weapon group", weapon, weaponlist);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon group: \"%s\".", client, weapon);
|
||||
}
|
||||
// Weapon was already restricted.
|
||||
case Failed_Weapon:
|
||||
{
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Restrict weapon failed", weapon);
|
||||
TranslationReplyToCommand(client, "Restrict weapon failed", weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Restrict weapon failed", weapon);
|
||||
TranslationPrintToChat(client, "Restrict weapon failed", weapon);
|
||||
}
|
||||
}
|
||||
// Weapon group was already restricted.
|
||||
@ -520,11 +494,11 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
||||
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||
TranslationReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||
TranslationPrintToChat(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||
}
|
||||
}
|
||||
// Weapon name was invalid.
|
||||
@ -532,11 +506,11 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
||||
{
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Weapon invalid", weapon);
|
||||
TranslationReplyToCommand(client, "Weapon invalid", weapon);
|
||||
}
|
||||
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.
|
||||
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.
|
||||
case Successful_Group:
|
||||
@ -569,23 +540,19 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
||||
decl String:weaponlist[128];
|
||||
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||
|
||||
ZR_PrintToChat(0, "Unrestrict custom weapon group", weapon, weaponlist);
|
||||
|
||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(client, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon group: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
||||
}
|
||||
TranslationPrintToChatAll(true, false, "Unrestrict custom weapon group", weapon, weaponlist);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon group: \"%s\".", client, weapon);
|
||||
}
|
||||
// Weapon wasn't restricted.
|
||||
case Failed_Weapon:
|
||||
{
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Unrestrict weapon failed", weapon);
|
||||
TranslationReplyToCommand(client, "Unrestrict weapon failed", weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Unrestrict weapon failed", weapon);
|
||||
TranslationPrintToChat(client, "Unrestrict weapon failed", weapon);
|
||||
}
|
||||
}
|
||||
// Weapon group wasn't restricted.
|
||||
@ -596,11 +563,11 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
||||
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||
TranslationReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||
TranslationPrintToChat(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||
}
|
||||
}
|
||||
// Weapon name was invalid.
|
||||
@ -608,11 +575,11 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
||||
{
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Weapon invalid", weapon);
|
||||
TranslationReplyToCommand(client, "Weapon invalid", weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
||||
TranslationPrintToChat(client, "Weapon invalid", weapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -933,7 +900,7 @@ public Action:RestrictRestrictCommand(client, argc)
|
||||
if (!weapons)
|
||||
{
|
||||
// Tell client command is disabled.
|
||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
||||
TranslationReplyToCommand(client, "Feature is disabled");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -942,7 +909,7 @@ public Action:RestrictRestrictCommand(client, argc)
|
||||
if (!restrict)
|
||||
{
|
||||
// Tell client command is disabled.
|
||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
||||
TranslationReplyToCommand(client, "Feature is disabled");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -975,7 +942,7 @@ public Action:RestrictUnrestrictCommand(client, argc)
|
||||
if (!weapons)
|
||||
{
|
||||
// Tell client command is disabled.
|
||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
||||
TranslationReplyToCommand(client, "Feature is disabled");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -984,7 +951,7 @@ public Action:RestrictUnrestrictCommand(client, argc)
|
||||
if (!restrict)
|
||||
{
|
||||
// Tell client command is disabled.
|
||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
||||
TranslationReplyToCommand(client, "Feature is disabled");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
@ -93,10 +93,7 @@ WeaponsLoad()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing weapons config file: %s", LOG_FORMAT_TYPE_ERROR, pathweapons);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "Missing weapons config file: %s", pathweapons);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -116,16 +113,10 @@ WeaponsLoad()
|
||||
*/
|
||||
WeaponsValidateConfig()
|
||||
{
|
||||
// If log flag check fails, then don't log.
|
||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
KvRewind(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))
|
||||
{
|
||||
ZR_PrintToChat(client, "Must be admin");
|
||||
TranslationPrintToChat(client, "Must be admin");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -504,76 +504,14 @@ ZRLogFlagsMenu(client)
|
||||
|
||||
SetMenuTitle(menu_log_flags, "%t\n ", "!zadmin log flags title");
|
||||
|
||||
new client_flags = GetUserFlagBits(client);
|
||||
new item_state = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
|
||||
//new client_flags = GetUserFlagBits(client);
|
||||
//new item_state = (client_flags & ADMFLAG_ROOT) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
|
||||
|
||||
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_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));
|
||||
//decl String:z_log_core[64];
|
||||
|
||||
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);
|
||||
//Format(z_log_core, sizeof(z_log_core), "Log core events (%d)", LogCheckFlag(LOG_CORE_EVENTS));
|
||||
|
||||
//AddMenuItem(menu_log_flags, z_log_core, z_log_core, item_state);
|
||||
|
||||
SetMenuExitBackButton(menu_log_flags, true);
|
||||
DisplayMenu(menu_log_flags, client, MENU_TIME_FOREVER);
|
||||
@ -585,116 +523,6 @@ public ZRLogFlagsMenuHandle(Handle:menu_log_flags, MenuAction:action, client, sl
|
||||
{
|
||||
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)
|
||||
|
@ -132,7 +132,7 @@ bool:ZHPToggle(client)
|
||||
if (!zhp)
|
||||
{
|
||||
// Tell client feature is disabled.
|
||||
ZR_PrintToChat(client, "Feature is disabled");
|
||||
TranslationPrintToChat(client, "Feature is disabled");
|
||||
|
||||
// Stop.
|
||||
return false;
|
||||
@ -141,12 +141,12 @@ bool:ZHPToggle(client)
|
||||
// If ZHP is enabled, then tell client it's being disabled.
|
||||
if (pZHP[client])
|
||||
{
|
||||
ZR_PrintToChat(client, "ZHP disable");
|
||||
TranslationPrintToChat(client, "ZHP disable");
|
||||
}
|
||||
// If ZHP is disabled, then tell client it's being enabled.
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "ZHP enable");
|
||||
TranslationPrintToChat(client, "ZHP enable");
|
||||
|
||||
// Update HP display.
|
||||
ZHPUpdateHUD(client);
|
||||
@ -186,7 +186,7 @@ ZHPUpdateHUD(client)
|
||||
}
|
||||
|
||||
// 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.
|
||||
*/
|
||||
@ -43,7 +48,7 @@ Float:ZRConvertUnitsFloat(Float:number, Float:conversion)
|
||||
* on it when finished!
|
||||
* @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.
|
||||
arrayEligibleClients = CreateArray();
|
||||
@ -90,7 +95,7 @@ ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool
|
||||
* @param console True to include console (index 0), false if not.
|
||||
* @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 (client > MaxClients)
|
||||
@ -102,6 +107,19 @@ bool:ZRIsClientValid(client, bool:console = false)
|
||||
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.
|
||||
*
|
||||
@ -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.
|
||||
* @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 (!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.
|
||||
* @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 (!ZRIsClientValid(client))
|
||||
@ -185,7 +203,7 @@ bool:ZRIsClientOnTeam(client, team = -1)
|
||||
*
|
||||
* @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 == -1)
|
||||
@ -204,7 +222,7 @@ bool:ZRTeamHasClients(team = -1)
|
||||
* @param client The client index.
|
||||
* @return True if generic admin, false otherwise.
|
||||
*/
|
||||
bool:ZRIsClientAdmin(client)
|
||||
stock bool:ZRIsClientAdmin(client)
|
||||
{
|
||||
// If index is invalid, then stop.
|
||||
if (!ZRIsClientValid(client))
|
||||
|
@ -132,7 +132,7 @@ bool:ZSpawnClient(client)
|
||||
new bool:zspawn = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN]);
|
||||
if (!zspawn)
|
||||
{
|
||||
ZR_PrintToChat(client, "Feature is disabled");
|
||||
TranslationPrintToChat(client, "Feature is disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ bool:ZSpawnClient(client)
|
||||
if (!ZRIsClientOnTeam(client))
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ bool:ZSpawnClient(client)
|
||||
if (IsPlayerAlive(client))
|
||||
{
|
||||
// Tell client the command may only be used when dead.
|
||||
ZR_PrintToChat(client, "Must be dead");
|
||||
TranslationPrintToChat(client, "Must be dead");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ bool:ZSpawnClient(client)
|
||||
if (SerialClientExists(client))
|
||||
{
|
||||
// Tell client the command may only be used when joining late.
|
||||
ZR_PrintToChat(client, "ZSpawn double spawn");
|
||||
TranslationPrintToChat(client, "ZSpawn double spawn");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ bool:ZSpawnClient(client)
|
||||
new Float:zspawntime = GetConVarFloat(g_hCvarsList[CVAR_ZSPAWN_TIMELIMIT_TIME]);
|
||||
|
||||
// Tell client the timelimit for this command has expired.
|
||||
ZR_PrintToChat(client, "ZSpawn timelimit", RoundToNearest(zspawntime));
|
||||
TranslationPrintToChat(client, "ZSpawn timelimit", RoundToNearest(zspawntime));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ bool:ZTeleClient(client)
|
||||
if (infected && !ztelezombie)
|
||||
{
|
||||
// Tell client they must be human to use this feature.
|
||||
ZR_PrintToChat(client, "Must be human");
|
||||
TranslationPrintToChat(client, "Must be human");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ bool:ZTeleClient(client)
|
||||
if (!infected && !ztelehuman)
|
||||
{
|
||||
// Tell client that feature is restricted at this time.
|
||||
ZR_PrintToChat(client, "ZTele restricted human");
|
||||
TranslationPrintToChat(client, "ZTele restricted human");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -143,14 +143,14 @@ bool:ZTeleClient(client)
|
||||
if (g_iZTeleCount[client] >= ztelemax)
|
||||
{
|
||||
// Tell client that they have already reached their limit.
|
||||
ZR_PrintToChat(client, "ZTele max", ztelemax);
|
||||
TranslationPrintToChat(client, "ZTele max", ztelemax);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If teleport is already in progress, then stop.
|
||||
if (tZTele[client] != INVALID_HANDLE)
|
||||
{
|
||||
ZR_PrintToChat(client, "ZTele in progress");
|
||||
TranslationPrintToChat(client, "ZTele in progress");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ bool:ZTeleClient(client)
|
||||
if (g_iZTeleTimeLeft[client] > 0)
|
||||
{
|
||||
// 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.
|
||||
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);
|
||||
|
||||
// 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.
|
||||
g_iZTeleCount[client]++;
|
||||
@ -225,8 +225,8 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
||||
tZTele[client] = INVALID_HANDLE;
|
||||
|
||||
// Tell client teleport has been cancelled.
|
||||
ZR_PrintCenterText(client, "ZTele autocancel centertext");
|
||||
ZR_PrintToChat(client, "ZTele autocancel text", RoundToNearest(autocanceldistance));
|
||||
TranslationPrintCenterText(client, "ZTele autocancel centertext");
|
||||
TranslationPrintToChat(client, "ZTele autocancel text", RoundToNearest(autocanceldistance));
|
||||
|
||||
// Stop timer.
|
||||
return Plugin_Stop;
|
||||
@ -237,7 +237,7 @@ public Action:ZTeleTimer(Handle:timer, any:client)
|
||||
g_iZTeleTimeLeft[client]--;
|
||||
|
||||
// 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.
|
||||
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]);
|
||||
|
||||
// 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.
|
||||
tZTele[client] = INVALID_HANDLE;
|
||||
|
Loading…
Reference in New Issue
Block a user