Renamed some commands, updated class command creation, and minor overlay changes.

This commit is contained in:
Greyscale
2009-05-20 22:13:51 -07:00
parent d4449dbab7
commit bb05cbccd0
8 changed files with 58 additions and 42 deletions

View File

@ -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 <cachetype> <index|targetname>");
RegAdminCmd("zr_class_modify", ClassModifyCommand, ADMFLAG_GENERIC, "Modify class data on one or more classes. Usage: zr_class_modify <classname|\"zombies\"|\"humans\"|\"admins\"> <attribute> <value> [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))

View File

@ -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)

View File

@ -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.