diff --git a/src/zr/commands.inc b/src/zr/commands.inc index 2008702..96a2012 100644 --- a/src/zr/commands.inc +++ b/src/zr/commands.inc @@ -17,6 +17,7 @@ CommandsInit() { // Forward event to modules. (create commands) ConfigOnCommandsCreate(); + ClassOnCommandsCreate(); WeaponsOnCommandsCreate(); // Forward event to modules. (hook commands) @@ -41,10 +42,6 @@ CommandsInit() RegAdminCmd("zr_anticamp_list", Command_AnticampList, ADMFLAG_GENERIC, "List current volumes."); RegConsoleCmd("zr_log_flags", Command_LogFlags, "List available logging flags."); - - RegConsoleCmd("zr_class_dump", Command_ClassDump, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump "); - RegAdminCmd("zr_class_modify", Command_ClassModify, ADMFLAG_GENERIC, "Modify class data on one or more classes. Usage: zr_class_modify [is_multiplier]"); - }*/ /*public Action:Command_Infect(client, argc) diff --git a/src/zr/config.inc b/src/zr/config.inc index 7a5d577..ef15d41 100644 --- a/src/zr/config.inc +++ b/src/zr/config.inc @@ -85,8 +85,8 @@ new Handle:kvHitgroups = INVALID_HANDLE; ConfigOnCommandsCreate() { // Create config admin commands. - RegAdminCmd("zr_reloadconfig", ConfigReloadCommand, ADMFLAG_GENERIC, "zr_reloadconfig - Reloads a config file."); - RegAdminCmd("zr_reloadconfigall", ConfigReloadAllCommand, ADMFLAG_GENERIC, "zr_reloadconfigall - Reloads all config files."); + RegAdminCmd("zr_config_reload", ConfigReloadCommand, ADMFLAG_GENERIC, "Reloads a config file. Usage: zr_config_reload "); + RegAdminCmd("zr_config_reloadall", ConfigReloadAllCommand, ADMFLAG_GENERIC, "Reloads all config files. Usage: zr_config_reloadall"); } /** diff --git a/src/zr/event.inc b/src/zr/event.inc index 7e22b7d..cd9705d 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -154,8 +154,7 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad new index = GetClientOfUserId(GetEventInt(event, "userid")); // Forward event to modules. - InfectOnClientSpawn(index); // Multiple modules depend on this to finish first. - OverlaysOnClientSpawn(index); + InfectOnClientSpawn(index); // Some modules depend on this to finish first. ClassOnClientSpawn(index); RestrictOnClientSpawn(index); SEffectsOnClientSpawn(index); diff --git a/src/zr/overlays.inc b/src/zr/overlays.inc index f9b129a..e39a901 100644 --- a/src/zr/overlays.inc +++ b/src/zr/overlays.inc @@ -129,17 +129,6 @@ public OverlaysQueryClientDXLevel(QueryCookie:cookie, client, ConVarQueryResult: g_iOverlaysDXL[client] = StringToInt(cvarValue); } -/** - * Client is spawning into the game. - * - * @param client The client index. - */ -OverlaysOnClientSpawn(client) -{ - // Update overlay. - OverlaysClientUpdateOverlay(client); -} - /** * The round is starting. */ @@ -175,6 +164,7 @@ OverlaysClientUpdateOverlay(client, OverlaysChannel:channel = OVERLAYS_CHANNEL_N { channel = OverlaysClientFindChannel(client); } + // Stop here if client has no overlay channel enabled. if (channel == OVERLAYS_CHANNEL_NONE) { @@ -183,6 +173,12 @@ OverlaysClientUpdateOverlay(client, OverlaysChannel:channel = OVERLAYS_CHANNEL_N return; } + // If channel we are updating is disabled, then stop. + if (!g_bOverlayChannel[client][channel]) + { + return; + } + // If dxLevel is 0, then query on client failed, so try again, then stop. if (!g_iOverlaysDXL[client]) { diff --git a/src/zr/playerclasses/classcommands.inc b/src/zr/playerclasses/classcommands.inc index 11f66ec..7c6520e 100644 --- a/src/zr/playerclasses/classcommands.inc +++ b/src/zr/playerclasses/classcommands.inc @@ -9,10 +9,30 @@ * ============================================================================ */ +ClassOnCommandsCreate() +{ + // Create base class commands. + RegConsoleCmd("zr_class_dump", ClassDumpCommand, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump "); + RegAdminCmd("zr_class_modify", ClassModifyCommand, ADMFLAG_GENERIC, "Modify class data on one or more classes. Usage: zr_class_modify [is_multiplier]"); +} + /** - * Dumps class data at a specified index in the specified cache. + * Hook commands related to classes here. */ -public Action:Command_ClassDump(client, argc) +ClassOnCommandsHook() +{ + // Forward event to sub-modules. + ClassOverlayOnCommandsHook(); +} + +/** + * Command callback. (zr_class_dump) + * Dumps class data at a specified index in the specified cache. + * + * @param client The client index. + * @param argc Argument count. + */ +public Action:ClassDumpCommand(client, argc) { decl String:syntax[1024]; syntax[0] = 0; @@ -124,7 +144,7 @@ public Action:Command_ClassDump(client, argc) * Note: Original values are retrieved from the original class cache, not the * modified class cache. */ -public Action:Command_ClassModify(client, argc) +public Action:ClassModifyCommand(client, argc) { decl String:syntax[1024]; syntax[0] = 0; @@ -335,7 +355,7 @@ public Action:Command_ClassModify(client, argc) * @param value New value to set. * @return True on success, false otherwise. */ -bool:ClassModifyBoolean(classindex, attributeflag, bool:value) +stock bool:ClassModifyBoolean(classindex, attributeflag, bool:value) { // Validate class index. if (!ClassValidateIndex(classindex)) @@ -378,7 +398,7 @@ bool:ClassModifyBoolean(classindex, attributeflag, bool:value) * disable. Value is ignored if this is non-zero. * @return True on success, false otherwise. */ -ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.0) +stock ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.0) { // Validate class index. if (!ClassValidateIndex(classindex)) @@ -481,7 +501,7 @@ ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.0) * Not all attributes support multipliers. * @return True on success, false otherwise. */ -ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier = false) +stock ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier = false) { // Validate class index. if (!ClassValidateIndex(classindex)) @@ -568,7 +588,7 @@ ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier = fal * @param value New value to set. * @return True on success, false otherwise. */ -ClassModifyString(classindex, attributeflag, const String:value[]) +stock ClassModifyString(classindex, attributeflag, const String:value[]) { // Validate class index. if (!ClassValidateIndex(classindex)) diff --git a/src/zr/playerclasses/classevents.inc b/src/zr/playerclasses/classevents.inc index a8be2d7..e033469 100644 --- a/src/zr/playerclasses/classevents.inc +++ b/src/zr/playerclasses/classevents.inc @@ -34,15 +34,6 @@ ClassClientInit(client) ClassOverlayClientInit(client); } -/** - * Hook commands related to classes here. - */ -ClassOnCommandsHook() -{ - // Forward event to sub-modules. - ClassOverlayOnCommandsHook(); -} - /** * Called when all modules are done loading. */ @@ -108,7 +99,6 @@ ClassOnClientSpawn(client) // Check if the player should spawn in admin mode. if (ClassPlayerAdminMode[client]) - { // Mark player as in admin mode. ClassPlayerInAdminMode[client] = true; @@ -137,11 +127,11 @@ ClassOnClientDeath(client) // Disable class attributes with timers. ClassHealthRegenStop(client); - // Disable overlay. - OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, false, true); - // Set client's FOV back to normal. ToolsSetClientDefaultFOV(client, 90); + + // Forward event to sub-modules. + ClassOverlayOnClientDeath(client); } ClassOnClientInfected(client, bool:motherzombie = false) diff --git a/src/zr/playerclasses/clientoverlays.inc b/src/zr/playerclasses/clientoverlays.inc index 9b24616..30978b0 100644 --- a/src/zr/playerclasses/clientoverlays.inc +++ b/src/zr/playerclasses/clientoverlays.inc @@ -83,6 +83,20 @@ ClassOverlayOnClientSpawn(client) TranslationPrintHUDText(client, "Classes overlay toggle", togglecmds); } + + // Update class overlay. + OverlaysClientUpdateOverlay(client, OVERLAYS_CHANNEL_CLASSES); +} + +/** + * Client has been killed. + * + * @param client The client index. + */ +ClassOverlayOnClientDeath(client) +{ + // Disable overlay. + OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, false, true); } /** @@ -127,7 +141,7 @@ ClassOverlayInitialize(client, const String:overlay[]) } /** - * Command callback (See zr_classes_overlay_togglecmds) + * Command callback. (See zr_classes_overlay_togglecmds) * Toggles nightvision of a client. * * @param client The client index. diff --git a/src/zr/weapons/restrict.inc b/src/zr/weapons/restrict.inc index de01c65..ad1570d 100644 --- a/src/zr/weapons/restrict.inc +++ b/src/zr/weapons/restrict.inc @@ -58,8 +58,8 @@ RestrictInit() RestrictOnCommandsCreate() { // Create weapon admin commands. - RegAdminCmd("zr_restrict", RestrictRestrictCommand, ADMFLAG_GENERIC, "zr_restrict - Restrict a weapon."); - RegAdminCmd("zr_unrestrict", RestrictUnrestrictCommand, ADMFLAG_GENERIC, "zr_unrestrict - Unrestrict a weapon."); + RegAdminCmd("zr_restrict", RestrictRestrictCommand, ADMFLAG_GENERIC, "Restrict a weapon. Usage: zr_restrict "); + RegAdminCmd("zr_unrestrict", RestrictUnrestrictCommand, ADMFLAG_GENERIC, "Unrestrict a weapon. Usage: zr_unrestrict "); } /**