remove trailing whitespaces from sourcecode

This commit is contained in:
2016-02-06 00:47:47 +01:00
parent 6f9558373d
commit d88e748f0e
85 changed files with 3559 additions and 3559 deletions

View File

@ -43,19 +43,19 @@ new Float:g_flClassApplySpeed[MAXPLAYERS + 1];
bool:ClassApplyAttributes(client, bool:improved = false)
{
new classindex = ClassGetActiveIndex(client);
// Validate class index.
if (!ClassValidateIndex(classindex))
{
return false;
}
// Override improved settings if it's a mother zombie class.
if (ClassHasFlags(classindex, ZR_CLASS_FLAG_MOTHER_ZOMBIE))
{
improved = false;
}
ClassApplyModel(client, classindex);
ClassApplyAlpha(client, classindex);
ClassApplyOverlay(client, classindex);
@ -64,7 +64,7 @@ bool:ClassApplyAttributes(client, bool:improved = false)
ClassApplyHealth(client, classindex, improved);
ClassApplyHealthRegen(client, classindex);
ClassApplySpeed(client, classindex);
return true;
}
@ -89,7 +89,7 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
new access;
new model;
new skinIndex = 0;
// Get correct index according to cache type.
if (cachetype == ZR_CLASS_CACHE_PLAYER)
{
@ -99,26 +99,26 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
index = classindex;
}
// Get the model path from the specified cache.
ClassGetModelPath(index, modelpath, sizeof(modelpath), cachetype);
// Get model skin index.
skinIndex = ClassGetModelSkinIndex(index, cachetype);
// Get model team setting from the specified cache.
team = ModelsTeamIdToTeam(ClassGetTeamID(index, cachetype));
// Check if the user specified a pre-defined model setting. If so, setup
// model filter settings.
if (StrEqual(modelpath, "random", false))
{
// Set access filter flags.
access = MODEL_ACCESS_PUBLIC | MODEL_ACCESS_ADMINS;
// Specify client for including admin models if client is admin.
index = client;
isAttributePreset = true;
}
else if (StrEqual(modelpath, "random_public", false))
@ -149,7 +149,7 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
// Get current model.
GetClientModel(client, modelpath, sizeof(modelpath));
// Restore original model if not already set.
if (!StrEqual(ClassOriginalPlayerModel[client], modelpath))
{
@ -166,13 +166,13 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
// Do nothing.
return true;
}
// Check if model setting is a attribute preset.
if (isAttributePreset)
{
// Get model based on filter settings set up earlier.
model = ModelsGetRandomModel(index, team, access);
// Check if found.
if (model >= 0)
{
@ -187,10 +187,10 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
ModelsGetFullPath(model, modelpath, sizeof(modelpath));
}
}
SetEntityModel(client, modelpath);
SetEntProp(client, Prop_Send, "m_nSkin", skinIndex);
return true;
}
@ -209,7 +209,7 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
bool:ClassApplyAlpha(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
new alpha;
// Get the alpha value from the specified cache.
if (cachetype == ZR_CLASS_CACHE_PLAYER)
{
@ -219,12 +219,12 @@ bool:ClassApplyAlpha(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
alpha = ClassGetAlphaInitial(classindex, cachetype);
}
if (alpha < 0)
{
return false;
}
ToolsSetClientAlpha(client, alpha);
return true;
}
@ -244,7 +244,7 @@ bool:ClassApplyAlpha(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
bool:ClassApplyOverlay(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
decl String:overlaypath[PLATFORM_MAX_PATH];
// Get the overlay path from the specified cache.
if (cachetype == ZR_CLASS_CACHE_PLAYER)
{
@ -254,7 +254,7 @@ bool:ClassApplyOverlay(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
ClassGetOverlayPath(classindex, overlaypath, sizeof(overlaypath), cachetype);
}
ClassOverlayInitialize(client, overlaypath);
return true;
}
@ -274,7 +274,7 @@ bool:ClassApplyOverlay(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
bool:ClassApplyNightVision(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
new bool:nvgs;
// Get the night vision setting from the specified cache.
if (cachetype == ZR_CLASS_CACHE_PLAYER)
{
@ -284,10 +284,10 @@ bool:ClassApplyNightVision(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER
{
nvgs = ClassGetNvgs(classindex, cachetype);
}
ToolsSetClientNightVision(client, nvgs);
ToolsSetClientNightVision(client, nvgs, false);
return true;
}
@ -306,7 +306,7 @@ bool:ClassApplyNightVision(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER
bool:ClassApplyFOV(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
new fov;
// Get the field of view setting from the specified cache.
if (cachetype == ZR_CLASS_CACHE_PLAYER)
{
@ -316,7 +316,7 @@ bool:ClassApplyFOV(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
fov = ClassGetFOV(classindex, cachetype);
}
ToolsSetClientDefaultFOV(client, fov);
return true;
}
@ -337,7 +337,7 @@ bool:ClassApplyFOV(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
bool:ClassApplyHealth(client, classindex, bool:boost = false, cachetype = ZR_CLASS_CACHE_PLAYER)
{
new health;
// Get the health points from the specified cache.
if (cachetype == ZR_CLASS_CACHE_PLAYER)
{
@ -347,12 +347,12 @@ bool:ClassApplyHealth(client, classindex, bool:boost = false, cachetype = ZR_CLA
{
health = ClassGetHealth(classindex, cachetype);
}
if (boost)
{
health *= 2;
}
SetEntityHealth(client, health);
return true;
}
@ -375,7 +375,7 @@ bool:ClassApplyHealthRegen(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER
new Float:interval;
new amount;
new max;
// Get the health regeneration info from the specified cache.
if (cachetype == ZR_CLASS_CACHE_PLAYER)
{
@ -389,7 +389,7 @@ bool:ClassApplyHealthRegen(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER
amount = ClassGetHealthRegenAmount(classindex, cachetype);
max = ClassGetHealth(classindex, cachetype);
}
if (interval > 0)
{
ClassHealthRegenInitClient(client, interval, amount, max);
@ -418,7 +418,7 @@ bool:ClassApplyHealthRegen(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER
bool:ClassApplySpeed(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
new Float:speed;
// Get the health points from the specified cache.
if (cachetype == ZR_CLASS_CACHE_PLAYER)
{
@ -428,7 +428,7 @@ bool:ClassApplySpeed(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
{
speed = ClassGetSpeed(classindex, cachetype);
}
ClassApplySpeedEx(client, speed);
return true;
}
@ -458,7 +458,7 @@ ClassApplySpeedEx(client, Float:speed)
/**
* Called before the client can "think"
* Here we can change the client's speed through m_flMaxSpeed.
*
*
* @param client The client index.
*/
public ClassPreThinkPost(client)
@ -470,7 +470,7 @@ public ClassPreThinkPost(client)
{
return;
}
// Note: Default is around 200.0 - 250.0
new Float:newspeed = GetEntPropFloat(client, Prop_Data, "m_flMaxspeed") + g_flClassApplySpeed[client];
SetEntPropFloat(client, Prop_Data, "m_flMaxspeed", newspeed);
@ -487,21 +487,21 @@ Class_OnPlayerRunCmd(client, Float:vel[3])
{
if (!IsPlayerAlive(client))
return;
// Only modify speed if the prop method is used.
if (ClassSpeedMethod == ClassSpeed_Prop)
{
// x-axis speed.
if (vel[0] < 0.0)
vel[0] = -5000.0;
else if (vel[0] > 0.0)
vel[0] = 5000.0;
// y-axis speed.
if (vel[1] < 0.0)
vel[1] = -5000.0;
else if (vel[1] > 0.0)
vel[1] = 5000.0;
}

View File

@ -32,7 +32,7 @@
*
* ------------------------------------
*/
/**
* Checks if the specified class is enabled.
*
@ -230,7 +230,7 @@ stock ClassGetGroup(index, String:buffer[], maxlen, cachetype = ZR_CLASS_CACHE_P
return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_Group]);
}
}
return -1;
}
@ -265,7 +265,7 @@ stock ClassGetSM_Flags(index, String:buffer[], maxlen, cachetype = ZR_CLASS_CACH
return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_SM_Flags]);
}
}
return -1;
}
@ -300,7 +300,7 @@ stock ClassGetName(index, String:buffer[], maxlen, cachetype = ZR_CLASS_CACHE_PL
return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_Name]);
}
}
return -1;
}
@ -553,7 +553,7 @@ stock ClassGetOverlayPath(index, String:buffer[], maxlen, cachetype = ZR_CLASS_C
return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_OverlayPath]);
}
}
return -1;
return -1;
}
/**
@ -1037,16 +1037,16 @@ stock Float:ClassGetSpeed(index, cachetype = ZR_CLASS_CACHE_PLAYER)
{
new Float:speed = ClassPlayerCache[index][Class_Speed];
new Float:multiplier = ClassGetAttributeMultiplier(index, ClassM_Speed);
// Apply multiplier.
if (ClassSpeedMethod == ClassSpeed_Prop)
{
// Prop speed is an offset. Convert to absolute value.
speed += 250;
// Apply multiplier.
speed *= multiplier;
// Convert back to speed offset.
speed -= 250;
}
@ -1296,7 +1296,7 @@ stock ClassAttributeNameToFlag(const String:attributename[])
{
return ZR_CLASS_JUMP_DISTANCE;
}
// Invalid attribute name.
return -1;
}
@ -1347,7 +1347,7 @@ stock ClassMultipliers:ClassAttributeNameToMultiplier(const String:attributename
{
return ClassM_JumpDistance;
}
// Invalid attribute name or not a multiplier.
return ClassM_Invalid;
}
@ -1371,7 +1371,7 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
{
return ClassDataType_Boolean;
}
// Integer.
case ZR_CLASS_FLAGS,
ZR_CLASS_MODEL_SKIN_INDEX,
@ -1388,7 +1388,7 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
{
return ClassDataType_Integer;
}
// Float.
case ZR_CLASS_NAPALM_TIME,
ZR_CLASS_HEALTH_REGEN_INTERVAL,
@ -1399,7 +1399,7 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
{
return ClassDataType_Float;
}
// String.
case ZR_CLASS_GROUP,
ZR_CLASS_NAME,
@ -1411,7 +1411,7 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
return ClassDataType_String;
}
}
// Invalid flag or multiple flags combined.
return ClassDataType_InvalidType;
}

View File

@ -4,7 +4,7 @@
* Zombie:Reloaded
*
* File: classcommands.inc
* Type: Core
* Type: Core
* Description: Console commands for working with classes.
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
@ -29,7 +29,7 @@ ClassOnCommandsCreate()
{
// Register ZClass command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZCLASS, ZClassCommand, "Opens class selection menu.");
// 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>");
RegConsoleCmd("zr_class_dump_multipliers", ClassDumpMultipliersCommand, "Dumps class attribute multipliers for the specified team. Usage: zr_class_dump_multipliers <\"zombies\"|\"humans\">");
@ -50,7 +50,7 @@ ClassOnCommandsHook()
/**
* Command callback (zclass)
* Opens class selection menu.
*
*
* @param client The client index.
* @param argc Argument count.
*/
@ -62,10 +62,10 @@ public Action:ZClassCommand(client, argc)
TranslationPrintToChat(client, "Must be player");
return Plugin_Handled;
}
// Send class menu.
ClassMenuMain(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
@ -73,7 +73,7 @@ public Action:ZClassCommand(client, argc)
/**
* 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.
*/
@ -81,14 +81,14 @@ public Action:ClassDumpCommand(client, argc)
{
decl String:syntax[320];
syntax[0] = 0;
// Check if privileged.
if (!ZRIsClientPrivileged(client, OperationType_Generic))
{
TranslationReplyToCommand(client, "No access to command");
return Plugin_Handled;
}
if (argc < 2)
{
// Write syntax info.
@ -98,23 +98,23 @@ public Action:ClassDumpCommand(client, argc)
StrCat(syntax, sizeof(syntax), "modified - Newest class data\n");
StrCat(syntax, sizeof(syntax), "player - Players class data\n");
ReplyToCommand(client, syntax);
return Plugin_Handled;
}
new cachetype = -1;
new index = -1;
decl String:type[64];
decl String:target[64];
decl String:buffer[2048];
// Quick initialize buffer.
buffer[0] = 0;
// Get cache type.
GetCmdArg(1, type, sizeof(type));
// Set cache type depending on parameter setting.
if (StrEqual(type, "original", false))
{
@ -127,11 +127,11 @@ public Action:ClassDumpCommand(client, argc)
else if (StrEqual(type, "player", false))
{
cachetype = ZR_CLASS_CACHE_PLAYER;
// Get client index.
GetCmdArg(2, target, sizeof(target));
index = FindTarget(client, target, _, false);
// Check if failed.
if (index < 0)
{
@ -139,32 +139,32 @@ public Action:ClassDumpCommand(client, argc)
return Plugin_Handled;
}
}
// Check if cachetype is valid.
if (cachetype < 0)
{
ReplyToCommand(client, "Invalid cache type.");
return Plugin_Handled;
}
// Validate class index.
if (cachetype != ZR_CLASS_CACHE_PLAYER)
{
// Get class index.
GetCmdArg(2, target, sizeof(target));
index = StringToInt(target);
if (!ClassValidateIndex(index))
{
ReplyToCommand(client, "Invalid class index.");
return Plugin_Handled;
}
}
// Dump the specified cache.
ReplyToCommand(client, "DUMPING CACHE: \"%s\" (%d classes total)\n========================================\n", type, ClassCount);
ClassDumpData(index, cachetype, buffer, sizeof(buffer));
// Print all data to client.
decl String:partbuffer[1024];
new pos;
@ -176,14 +176,14 @@ public Action:ClassDumpCommand(client, argc)
ReplyToCommand(client, partbuffer);
pos += cellswritten;
}
return Plugin_Handled;
}
/**
* Command callback. (zr_class_dump_multipliers)
* Dumps class attribute multipliers for the specified team.
*
*
* @param client The client index.
* @param argc Argument count.
*/
@ -193,23 +193,23 @@ public Action:ClassDumpMultipliersCommand(client, argc)
decl String:linebuffer[128];
decl String:arg[16];
buffer[0] = 0;
// Check if privileged.
if (!ZRIsClientPrivileged(client, OperationType_Generic))
{
TranslationReplyToCommand(client, "No access to command");
return Plugin_Handled;
}
if (argc < 1)
{
// Write syntax info.
ReplyToCommand(client, "Dumps class attribute multipliers for the specified team. Usage: zr_class_dump_multipliers <\"zombies\"|\"humans\">");
return Plugin_Handled;
}
new teamid = -1;
// Get team id.
GetCmdArg(1, arg, sizeof(arg));
if (StrEqual(arg, "zombies", false))
@ -220,12 +220,12 @@ public Action:ClassDumpMultipliersCommand(client, argc)
{
teamid = ZR_CLASS_TEAM_HUMANS;
}
if (teamid >= 0)
{
Format(linebuffer, sizeof(linebuffer), "Dumping multipliers for team: %s\n----------------------------------------\n", arg);
StrCat(buffer, sizeof(buffer), linebuffer);
Format(linebuffer, sizeof(linebuffer), "Napalm time: %f\n", ClassMultiplierCache[teamid][ClassM_NapalmTime]);
StrCat(buffer, sizeof(buffer), linebuffer);
Format(linebuffer, sizeof(linebuffer), "Health: %f\n", ClassMultiplierCache[teamid][ClassM_Health]);
@ -244,7 +244,7 @@ public Action:ClassDumpMultipliersCommand(client, argc)
StrCat(buffer, sizeof(buffer), linebuffer);
Format(linebuffer, sizeof(linebuffer), "Jump distance: %f", ClassMultiplierCache[teamid][ClassM_JumpDistance]);
StrCat(buffer, sizeof(buffer), linebuffer);
ReplyToCommand(client, buffer);
return Plugin_Handled;
}
@ -275,14 +275,14 @@ public Action:ClassModifyCommand(client, argc)
{
decl String:syntax[1024];
syntax[0] = 0;
// Check if privileged.
if (!ZRIsClientPrivileged(client, OperationType_Configuration))
{
TranslationReplyToCommand(client, "No access to command");
return Plugin_Handled;
}
if (argc < 3)
{
// Write syntax info.
@ -293,30 +293,30 @@ public Action:ClassModifyCommand(client, argc)
StrCat(syntax, sizeof(syntax), "is_multiplier: Optional. specifies wether the original value should be multiplied by the specified value. Not all attributes support multipliers. Defaults to false.\n\n");
StrCat(syntax, sizeof(syntax), "Note: Original values are retrieved from the original class cache, not the modified class cache.");
ReplyToCommand(client, syntax);
return Plugin_Handled;
}
decl String:classname[64];
decl String:attributename[128];
decl String:value[256];
decl String:ismultiplier[4];
new attributeflag;
new ClassDataTypes:attributetype;
new bool:isgroup;
new bool:hasmultiplier;
new Handle:classlist;
new classindex;
new bool:listresult;
classlist = CreateArray();
// Get command arguments.
GetCmdArg(1, classname, sizeof(classname));
GetCmdArg(2, attributename, sizeof(attributename));
GetCmdArg(3, value, sizeof(value));
// Get last command argument if specified.
if (argc == 4)
{
@ -326,20 +326,20 @@ public Action:ClassModifyCommand(client, argc)
hasmultiplier = true;
}
}
// Get attribute flag.
attributeflag = ClassAttributeNameToFlag(attributename);
// Validate attribute flag.
if (attributeflag < 0)
{
ReplyToCommand(client, "Invalid class attribute specified.");
return Plugin_Handled;
}
// Get attribute data type.
attributetype = ClassGetAttributeType(attributeflag);
// Check if classname is a group. Add classes to the class list
// and use the specified team filter.
if (StrEqual(classname, "all", false))
@ -362,7 +362,7 @@ public Action:ClassModifyCommand(client, argc)
listresult = ClassAddToArray(classlist, ZR_CLASS_TEAM_ADMINS);
isgroup = true;
}
// Check if classname is a group.
if (isgroup)
{
@ -372,14 +372,14 @@ public Action:ClassModifyCommand(client, argc)
ReplyToCommand(client, "Failed to get classes in the specified team: \"%s\".", classname);
return Plugin_Handled;
}
// Loop through all classes in the list.
new listsize = GetArraySize(classlist);
for (new i = 0; i < listsize; i++)
{
classindex = GetArrayCell(classlist, i);
switch (attributetype)
{
case ClassDataType_Boolean:
@ -427,14 +427,14 @@ public Action:ClassModifyCommand(client, argc)
{
// It's a single class.
classindex = ClassGetIndex(classname);
// Validate classindex.
if (!ClassValidateIndex(classindex))
{
ReplyToCommand(client, "Invalid class name specified.");
return Plugin_Handled;
}
switch (attributetype)
{
case ClassDataType_Boolean:
@ -477,7 +477,7 @@ public Action:ClassModifyCommand(client, argc)
}
}
}
return Plugin_Handled;
}
@ -501,14 +501,14 @@ public Action:ClassSetMultiplierCommand(client, argc)
{
decl String:syntax[320];
syntax[0] = 0;
// Check if privileged.
if (!ZRIsClientPrivileged(client, OperationType_Configuration))
{
TranslationReplyToCommand(client, "No access to command");
return Plugin_Handled;
}
if (argc < 3)
{
// Write syntax info.
@ -518,20 +518,20 @@ public Action:ClassSetMultiplierCommand(client, argc)
ReplyToCommand(client, syntax);
return Plugin_Handled;
}
decl String:teamname[16];
decl String:attributename[32];
decl String:multiplier[32];
new teamid = -1;
new ClassMultipliers:attribute;
new Float:value;
// Get arguments.
GetCmdArg(1, teamname, sizeof(teamname));
GetCmdArg(2, attributename, sizeof(attributename));
GetCmdArg(3, multiplier, sizeof(multiplier));
// Get team id.
if (StrEqual(teamname, "zombies", false))
{
@ -541,37 +541,37 @@ public Action:ClassSetMultiplierCommand(client, argc)
{
teamid = ZR_CLASS_TEAM_HUMANS;
}
// Validate team id.
if (teamid < 0)
{
ReplyToCommand(client, "Invalid team name: %s", teamname);
return Plugin_Handled;
}
// Get attribute type.
attribute = ClassAttributeNameToMultiplier(attributename);
// Validate type.
if (attribute == ClassM_Invalid)
{
ReplyToCommand(client, "Attribute is invalid or not a multiplier: %s", attributename);
return Plugin_Handled;
}
// Get value.
value = StringToFloat(multiplier);
// Set multiplier.
ClassMultiplierCache[teamid][attribute] = value;
return Plugin_Handled;
}
/**
* Command callback. (zr_class_reload)
* Dumps class data at a specified index in the specified cache.
*
*
* @param client The client index.
* @param argc Argument count.
*/
@ -582,25 +582,25 @@ public Action:ClassReloadCommand(client, argc)
new targetlist[MAXPLAYERS + 1];
new targetcount;
new bool:tn_is_ml;
// Check if privileged.
if (!ZRIsClientPrivileged(client, OperationType_Generic))
{
TranslationReplyToCommand(client, "No access to command");
return Plugin_Handled;
}
if (argc < 1)
{
// Write syntax info.
ReplyToCommand(client, "Refreshes the player cache and reloads class attributes on one or more players. Usage: zr_class_reload <target>");
return Plugin_Handled;
}
// Get the target string.
GetCmdArg(1, arg, sizeof(arg));
// Get target clients.
if ((targetcount = ProcessTargetString(arg, client, targetlist, sizeof(targetlist), 0, targetname, sizeof(targetname), tn_is_ml)) <= 0)
{
@ -608,13 +608,13 @@ public Action:ClassReloadCommand(client, argc)
ReplyToTargetError(client, targetcount);
return Plugin_Handled;
}
// Loop through each target.
for (new target = 0; target < targetcount; target++)
{
ClassReloadPlayer(targetlist[target]);
}
// Check phrase format.
if (tn_is_ml)
{
@ -624,7 +624,7 @@ public Action:ClassReloadCommand(client, argc)
{
ReplyToCommand(client, "Refreshed cache to %s.", targetname);
}
return Plugin_Handled;
}
@ -643,7 +643,7 @@ stock bool:ClassModifyBoolean(classindex, attributeflag, bool:value)
{
return false;
}
switch (attributeflag)
{
case ZR_CLASS_ENABLED:
@ -667,7 +667,7 @@ stock bool:ClassModifyBoolean(classindex, attributeflag, bool:value)
return true;
}
}
// Invalid flag or multiple flags combined.
return false;
}
@ -691,10 +691,10 @@ stock ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.
{
return false;
}
// Check if multiplier is specified.
new bool:ismultiplier = (multiplier != 0.0) ? true : false;
switch (attributeflag)
{
case ZR_CLASS_FLAGS:
@ -794,7 +794,7 @@ stock ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.
return true;
}
}
// Invalid flag or multiple flags combined.
return false;
}
@ -817,7 +817,7 @@ stock ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier
{
return false;
}
switch (attributeflag)
{
case ZR_CLASS_NAPALM_TIME:
@ -875,7 +875,7 @@ stock ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier
return true;
}
}
// Invalid flag or multiple flags combined.
return false;
}
@ -895,7 +895,7 @@ stock ClassModifyString(classindex, attributeflag, const String:value[])
{
return false;
}
switch (attributeflag)
{
case ZR_CLASS_GROUP:
@ -932,7 +932,7 @@ stock ClassModifyString(classindex, attributeflag, const String:value[])
{
// Convert to mode.
new ImmunityMode:mode = ImmunityStringToMode(value);
// Validate.
if (mode != Immunity_Invalid)
{
@ -945,7 +945,7 @@ stock ClassModifyString(classindex, attributeflag, const String:value[])
}
}
}
// Invalid flag or multiple flags combined.
return false;
}

View File

@ -44,7 +44,7 @@ ClassOnCookiesCreate()
{
// Forward event to sub-modules.
ClassOverlayOnCookiesCreate();
// Create cookie handles only if they don't exist.
if (g_hClassCookieClassSelected[ZR_CLASS_TEAM_HUMANS] == INVALID_HANDLE)
{
@ -77,7 +77,7 @@ ClassOnMapStart()
{
// Clear multipliers.
ClassResetMultiplierCache();
// Prepare hp regeneration module.
ClassHealthRegenInit();
}
@ -88,7 +88,7 @@ ClassOnMapStart()
ClassOnConfigsExecuted()
{
new ClassSpeedMethods:speedMethod = ClassGetSpeedMethod();
if (speedMethod != ClassSpeed_Invalid)
{
// Set speed method.
@ -109,7 +109,7 @@ ClassOnClientConnected(client)
{
// Unhook "PreThinkPost" on the client.
SDKUnhook(client, SDKHook_PreThinkPost, ClassPreThinkPost);
// Initialize the admin checked variable.
g_bAdminChecked[client] = false;
}
@ -121,16 +121,16 @@ ClassClientInit(client)
{
// Hook "PreThinkPost" on the client.
SDKHook(client, SDKHook_PreThinkPost, ClassPreThinkPost);
// Reset spawn flag.
ClassPlayerSpawned[client] = false;
}
/**
* Called once a client is authorized and fully in-game, and
* after all post-connection authorizations have been performed.
* Called once a client is authorized and fully in-game, and
* after all post-connection authorizations have been performed.
*
* This callback is gauranteed to occur on all clients, and always
* This callback is gauranteed to occur on all clients, and always
* after each OnClientPutInServer() call.
*
* @param client Client index.
@ -140,11 +140,11 @@ ClassOnClientPostAdminCheck(client)
{
// Client has been checked.
g_bAdminChecked[client] = true;
// Below this depends on client cookies.
if (!AreClientCookiesCached(client))
return;
// Check if classes are loaded successfully and the client is valid.
if (ClassValidated)
{
@ -155,7 +155,7 @@ ClassOnClientPostAdminCheck(client)
/**
* Called once a client's saved cookies have been loaded from the database.
*
*
* @param client Client index.
*/
ClassOnCookiesCached(client)
@ -166,11 +166,11 @@ ClassOnCookiesCached(client)
// Forward event to sub-modules.
ClassOverlayOnCookiesCached(client);
}
// Below this depends on client authorization.
if (!g_bAdminChecked[client])
return;
// Check if classes are loaded successfully and the client is valid.
if (ClassValidated)
{
@ -186,14 +186,14 @@ ClassOnClientDisconnect(client)
{
// Disable class attributes with timers.
ClassHealthRegenStop(client);
// Reset previously selected class indexes.
ClassResetNextIndexes(client);
}
/**
* Client is spawning into the game.
*
*
* @param client The client index.
*/
ClassOnClientSpawn(client)
@ -201,37 +201,37 @@ ClassOnClientSpawn(client)
decl String:originalmodel[PLATFORM_MAX_PATH];
decl String:classname[64];
new filter[ClassFilter];
// Check if the player is dead. Spawning into the game is also a event in
// the connection process.
if (!IsPlayerAlive(client))
{
return;
}
// Check if there are no valid classes. Block this event if classes aren't
// done loading.
if (!ClassValidated)
{
return;
}
// Reset attributes by triggering death event.
ClassOnClientDeath(client);
// Restore class indexes to be selected on spawn, if available.
ClassRestoreNextIndexes(client);
// Cache original player model.
GetClientModel(client, originalmodel, sizeof(originalmodel));
strcopy(ClassOriginalPlayerModel[client], PLATFORM_MAX_PATH, originalmodel);
// Check if the player should spawn in admin mode.
if (ClassPlayerInAdminMode[client])
{
// Mark player as in admin mode.
ClassPlayerInAdminMode[client] = true;
// TODO: This is the place to initialize admin mode stuff like no-block
// and other stuff.
}
@ -239,43 +239,43 @@ ClassOnClientSpawn(client)
{
// Mark player as not in admin mode.
ClassPlayerInAdminMode[client] = false;
// Get random class setting.
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
// Assign random classes if enabled. Always do it for bots.
if (randomclass || IsFakeClient(client))
{
// Setup filtering
// ---------------
// Exclude special class flags like mother zombies and admin classes.
filter[ClassFilter_DenyFlags] = ZR_CLASS_SPECIALFLAGS;
// Allow admin classes if admin.
filter[ClassFilter_DenyFlags] -= ZRIsClientAdmin(client) ? ZR_CLASS_FLAG_ADMIN_ONLY : 0;
// Specify client for checking group permissions.
filter[ClassFilter_Client] = client;
// Get classes
// -----------
// Get random classes for each type.
new randomzombie = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, filter);
new randomhuman = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS, filter);
// Set selected zombie class index.
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = randomzombie;
ClassGetName(randomzombie, classname, sizeof(classname), ZR_CLASS_TEAM_ZOMBIES);
TranslationPrintToChat(client, "Classes random assignment", classname);
// Set selected human class index.
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = randomhuman;
ClassGetName(randomhuman, classname, sizeof(classname), ZR_CLASS_TEAM_HUMANS);
TranslationPrintToChat(client, "Classes random assignment", classname);
}
// Display class menu if either menu cvar is set.
new bool:menuspawn = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_SPAWN]);
new bool:menujoin = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_JOIN]);
@ -285,19 +285,19 @@ ClassOnClientSpawn(client)
ClassMenuMain(client);
}
}
// Load class attributes for the active class.
ClassReloadPlayerCache(client, ClassGetActiveIndex(client));
// Note: Class attributes are applied in ClassOnClientSpawnPost.
// Check if instant class change cvar is set.
new Float:instantspawn = GetConVarFloat(g_hCvarsList[CVAR_CLASSES_CHANGE_TIMELIMIT]);
if (instantspawn > 0)
{
// Allow instant class change.
ClassAllowInstantChange[client] = true;
// Create timer to disable instant change.
CreateTimer(instantspawn, Event_ClassDisableInstantSpawn, client, TIMER_FLAG_NO_MAPCHANGE);
}
@ -310,7 +310,7 @@ ClassOnClientSpawn(client)
/**
* Client have just spawned (delayed event).
*
*
* @param client The client index.
*/
ClassOnClientSpawnPost(client)
@ -321,31 +321,31 @@ ClassOnClientSpawnPost(client)
{
return;
}
ClassApplyAttributes(client);
}
/**
* Client died. Stops timers and reset certain attributes. Call this event to
* clean up class related stuff.
*
*
* @param client The client index.
*/
ClassOnClientDeath(client)
{
// Disable class attributes with timers.
ClassHealthRegenStop(client);
// Set client's FOV back to normal.
ToolsSetClientDefaultFOV(client, 90);
// Forward event to sub-modules.
ClassOverlayOnClientDeath(client);
}
/**
* Client got infected. Reloads class attributes.
*
*
* @param client The client index.
*/
ClassOnClientInfected(client, bool:motherzombie = false)
@ -354,25 +354,25 @@ ClassOnClientInfected(client, bool:motherzombie = false)
new isadmin;
new motherindex;
new filter[ClassFilter];
decl String:motherzombiesetting[64];
// Disable class attributes with timers.
ClassHealthRegenStop(client);
// Make sure the player is not allowed to instantly change class.
ClassAllowInstantChange[client] = false;
// Check if it's a mother zombie.
if (motherzombie)
{
// Set admin flag if client is admin, so it's removed in special class
// flags.
isadmin = ZRIsClientAdmin(client) ? ZR_CLASS_FLAG_ADMIN_ONLY : 0;
// Get default mother zombie setting.
GetConVarString(g_hCvarsList[CVAR_CLASSES_DEFAULT_M_ZOMB], motherzombiesetting, sizeof(motherzombiesetting));
if (StrEqual(motherzombiesetting, "disabled", false))
{
// Do nothing. Keep current class.
@ -381,28 +381,28 @@ ClassOnClientInfected(client, bool:motherzombie = false)
{
// Setup filtering
// ---------------
// Exclude special class flags.
filter[ClassFilter_DenyFlags] = ZR_CLASS_SPECIALFLAGS;
// Allow admin classes if admin.
filter[ClassFilter_DenyFlags] -= isadmin;
// Specify client for checking group permissions.
filter[ClassFilter_Client] = client;
// Get class
// ---------
// Get random regular zombie class. Remove admin flag if admin.
motherindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, filter);
// Validate index. Do not change class if it's invalid.
if (ClassValidateIndex(motherindex))
{
// Save active class index to be restored next spawn.
ClassSelectedNext[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
// Change class.
classindex = motherindex;
}
@ -411,35 +411,35 @@ ClassOnClientInfected(client, bool:motherzombie = false)
{
// Setup filtering
// ---------------
// Exclude special class flags except mother zombies.
filter[ClassFilter_DenyFlags] = ZR_CLASS_SPECIALFLAGS - ZR_CLASS_FLAG_MOTHER_ZOMBIE;
// Require mother zombie class flag.
filter[ClassFilter_RequireFlags] = ZR_CLASS_FLAG_MOTHER_ZOMBIE;
// Allow admin classes if admin.
filter[ClassFilter_DenyFlags] -= isadmin;
// Specify client for checking group permissions.
filter[ClassFilter_Client] = client;
// Get class
// ---------
// Get random mother zombie class. Include admin classes if admin.
motherindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES, filter);
// Validate index. Do not change class if it's invalid.
if (ClassValidateIndex(motherindex))
{
// This is a mother zombie class. Reset mother zombie setting
// so class skills aren't improved.
motherzombie = false;
// Save active class index to be restored next spawn.
ClassSelectedNext[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
// Change class.
classindex = motherindex;
}
@ -448,28 +448,28 @@ ClassOnClientInfected(client, bool:motherzombie = false)
{
// Assume it's a class name. Get index for the specified class name.
motherindex = ClassGetIndex(motherzombiesetting);
// Validate index.
if (ClassValidateIndex(motherindex))
{
// Save active class index to be restored next spawn.
ClassSelectedNext[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
// Change class.
classindex = motherindex;
}
}
}
// Update the player's selected class index.
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
// Restore next indexes, if available. But don't restore the zombie index.
ClassRestoreNextIndexes(client, ZR_CLASS_TEAM_ZOMBIES);
// Update the player's cache with zombie attributes.
ClassReloadPlayerCache(client, classindex);
// Apply the new attributes.
ClassApplyAttributes(client, motherzombie);
}

View File

@ -41,60 +41,60 @@
ClassMenuMain(client)
{
new Handle:menu = CreateMenu(ClassMenuMainHandle);
SetGlobalTransTarget(client);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:zombieclass[MENU_LINE_REG_LENGTH];
decl String:humanclass[MENU_LINE_REG_LENGTH];
decl String:adminclass[MENU_LINE_REG_LENGTH];
decl String:nextzombiename[MENU_LINE_REG_LENGTH];
decl String:nexthumanname[MENU_LINE_REG_LENGTH];
decl String:nextadminname[MENU_LINE_REG_LENGTH];
decl String:zombieselect[MENU_LINE_BIG_LENGTH];
decl String:humanselect[MENU_LINE_BIG_LENGTH];
decl String:adminselect[MENU_LINE_BIG_LENGTH];
decl String:inadminmnode[MENU_LINE_BIG_LENGTH];
decl String:adminmode[MENU_LINE_BIG_LENGTH];
decl String:toggleadminmode[MENU_LINE_BIG_LENGTH];
// Setup filtering.
// ----------------
new filter[ClassFilter];
// Hide mother zombie classes.
filter[ClassFilter_DenyFlags] = ZR_CLASS_FLAG_MOTHER_ZOMBIE;
// Hide admin-only classes if not admin.
filter[ClassFilter_DenyFlags] += !ZRIsClientAdmin(client) ? ZR_CLASS_FLAG_ADMIN_ONLY : 0;
// Specify client for checking class group permissions.
filter[ClassFilter_Client] = client;
// Setup item draw style.
// ----------------------
// Get number of enabled classes per team.
new zombiecount = ClassCountTeam(ZR_CLASS_TEAM_ZOMBIES, filter);
new humancount = ClassCountTeam(ZR_CLASS_TEAM_HUMANS, filter);
new admincount = ClassCountTeam(ZR_CLASS_TEAM_ADMINS, filter);
// Get next class indexes, if set.
new nextzombie = ClassSelectedNext[client][ZR_CLASS_TEAM_ZOMBIES];
new nexthuman = ClassSelectedNext[client][ZR_CLASS_TEAM_HUMANS];
new nextadmin = ClassSelectedNext[client][ZR_CLASS_TEAM_ADMINS];
// Set draw style on class options depending on number of enabled classes
// and selection permissions. Disable class selection if there's only one
// class.
new zombie_itemdraw = (zombiecount > 1 && ClassAllowSelection(client, ZR_CLASS_TEAM_ZOMBIES, filter)) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
new human_itemdraw = (humancount > 1 && ClassAllowSelection(client, ZR_CLASS_TEAM_HUMANS, filter)) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
new admin_itemdraw = (admincount > 1 && ClassAllowSelection(client, ZR_CLASS_TEAM_ADMINS, filter)) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED;
// Check if the player is in admin mode.
if (ClassPlayerInAdminMode[client])
{
@ -102,19 +102,19 @@ ClassMenuMain(client)
Format(inadminmnode, sizeof(inadminmnode), "%t\n", "Classes admin mode enabled");
AddMenuItem(menu, "", inadminmnode, ITEMDRAW_RAWLINE);
}
// List zombie class options.
// --------------------------
// Get current class name.
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES], zombieclass, sizeof(zombieclass), ZR_CLASS_CACHE_MODIFIED);
// Check if next index is set.
if (ClassValidateIndex(nextzombie))
{
// Get name of previous class index and format item text.
ClassGetName(nextzombie, nextzombiename, sizeof(nextzombiename), ZR_CLASS_CACHE_MODIFIED);
Format(zombieselect, sizeof(zombieselect), "%t\n %t\n %t", "Classes menu select zombie", "Classes menu active", zombieclass, "Classes menu next", nextzombiename);
}
else
@ -122,23 +122,23 @@ ClassMenuMain(client)
// Use current class name and format item text.
Format(zombieselect, sizeof(zombieselect), "%t\n %s", "Classes menu select zombie", zombieclass);
}
// Add item to list.
AddMenuItem(menu, "", zombieselect, zombie_itemdraw);
// List human class options.
// -------------------------
// Get current class name.
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_HUMANS], humanclass, sizeof(humanclass), ZR_CLASS_CACHE_MODIFIED);
// Check if next index is set.
if (ClassValidateIndex(nexthuman))
{
// Get name of previous class index and format item text.
ClassGetName(nexthuman, nexthumanname, sizeof(nexthumanname), ZR_CLASS_CACHE_MODIFIED);
Format(humanselect, sizeof(humanselect), "%t\n %t\n %t", "Classes menu select human", "Classes menu active", humanclass, "Classes menu next", nexthumanname);
}
else
@ -146,20 +146,20 @@ ClassMenuMain(client)
// Use current class name and format item text.
Format(humanselect, sizeof(humanselect), "%t\n %s", "Classes menu select human", humanclass);
}
// Add item to list.
AddMenuItem(menu, "", humanselect, human_itemdraw);
// List admin class options, if they exist.
// ----------------------------------------
// Only display admin class options for admins, and if admin classes exist.
if (ZRIsClientAdmin(client) && ClassCountTeam(ZR_CLASS_TEAM_ADMINS))
{
// Get current class name.
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ADMINS], adminclass, sizeof(adminclass), ZR_CLASS_CACHE_MODIFIED);
// Check if next index is set.
if (ClassValidateIndex(nextadmin))
{
@ -172,10 +172,10 @@ ClassMenuMain(client)
// Use current class name and format item text.
Format(adminselect, sizeof(adminselect), "%t\n %s", "Classes menu select admin", adminclass);
}
// Add item to list.
AddMenuItem(menu, "", adminselect, admin_itemdraw);
// Set admin mode status string.
if (ClassPlayerInAdminMode[client])
{
@ -185,18 +185,18 @@ ClassMenuMain(client)
{
Format(adminmode, sizeof(adminmode), "%t", "Off");
}
// Spacer. ITEMDRAW_SPACER not used because it use a slot.
AddMenuItem(menu, "", " ", ITEMDRAW_RAWLINE);
// Show admin mode toggle option.
Format(toggleadminmode, sizeof(toggleadminmode), "%t\n %s", "Classes menu admin mode toggle", adminmode);
AddMenuItem(menu, "", toggleadminmode, admin_itemdraw);
}
Format(title, sizeof(title), "%t\n", "Classes menu title");
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
@ -263,14 +263,14 @@ ClassMenuSelect(client, teamid)
new Handle:menu = CreateMenu(ClassMenuSelectHandle);
new arraycount;
new classindex;
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:classname[MENU_LINE_REG_LENGTH];
decl String:description[MENU_LINE_BIG_LENGTH];
decl String:menuitem[MENU_LINE_HUGE_LENGTH];
SetGlobalTransTarget(client);
// Set correct menu title depending on team ID.
switch (teamid)
{
@ -288,32 +288,32 @@ ClassMenuSelect(client, teamid)
}
}
SetMenuTitle(menu, title);
// Create buffer array.
new Handle:classarray = CreateArray();
// Set up filtering
// ----------------
new filter[ClassFilter];
// Hide mother zombie classes.
filter[ClassFilter_DenyFlags] = ZR_CLASS_FLAG_MOTHER_ZOMBIE;
// Hide admin-only classes if not admin.
filter[ClassFilter_DenyFlags] += !ZRIsClientAdmin(client) ? ZR_CLASS_FLAG_ADMIN_ONLY : 0;
// Specify client for checking class group permissions.
filter[ClassFilter_Client] = client;
// Get classes
// -----------
// Copy all class indexes into the array, with the specified filter settings.
if (ClassAddToArray(classarray, teamid, filter))
{
// Get number of classes.
arraycount = GetArraySize(classarray);
// Loop through each class.
for (new i = 0; i < arraycount; i++)
{
@ -321,16 +321,16 @@ ClassMenuSelect(client, teamid)
classindex = GetArrayCell(classarray, i);
ClassGetName(classindex, classname, sizeof(classname), ZR_CLASS_CACHE_MODIFIED);
ClassGetDescription(classindex, description, sizeof(description), ZR_CLASS_CACHE_MODIFIED);
// Add menu item. Using extra spaces for indention on the second line.
Format(menuitem, sizeof(menuitem), "%s\n %s", classname, description);
AddMenuItem(menu, classname, menuitem);
}
}
// Destroy array.
CloseHandle(classarray);
SetMenuExitBackButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
@ -343,17 +343,17 @@ public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot)
decl String:className[MENU_LINE_REG_LENGTH];
new classIndex;
new bool:autoclose = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_AUTOCLOSE]);
switch (action)
{
case MenuAction_Select:
{
// Get class name from the information string.
GetMenuItem(menu, slot, className, sizeof(className));
// Solve class index from the name.
classIndex = ClassGetIndex(className);
// Select (and eventually apply) class.
ClassSelectClientClass(client, classIndex);
}
@ -363,19 +363,19 @@ public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot)
{
ClassMenuMain(client);
}
// Stop so menu doesn't reopen.
return;
}
case MenuAction_End:
{
CloseHandle(menu);
// Stop so menu doesn't reopen.
return;
}
}
// Redisplay the main class menu if autoclose is disabled.
if (!autoclose)
{
@ -397,36 +397,36 @@ public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot)
* @return True if displayed, false otherwise.
*/
bool:ClassTeamSelect(client)
{
{
// Validate permissions.
if (!ZRIsClientPrivileged(client, OperationType_Configuration))
{
return false;
}
// Create menu.
new Handle:menu = CreateMenu(ClassTeamSelectHandle);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:zombies[MENU_LINE_SMALL_LENGTH];
decl String:humans[MENU_LINE_SMALL_LENGTH];
// Set translation language.
SetGlobalTransTarget(client);
// Translate phrases.
Format(title, sizeof(title), "%t", "Classes Menu Team Select Title");
Format(zombies, sizeof(zombies), "%t", "Classes Menu Zombies");
Format(humans, sizeof(humans), "%t", "Classes Menu Humans");
SetMenuTitle(menu, title);
AddMenuItem(menu, "zombies", zombies);
AddMenuItem(menu, "humans", humans);
SetMenuExitBackButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
return true;
}
@ -450,7 +450,7 @@ public ClassTeamSelectHandle(Handle:menu, MenuAction:action, client, slot)
ClassAdminTeamSelected[client] = ZR_CLASS_TEAM_HUMANS;
}
}
// Display multiplier menu.
ClassMultiplierSelectMenu(client);
}
@ -484,10 +484,10 @@ ClassMultiplierSelectMenu(client)
{
// Create menu.
new Handle:menu = CreateMenu(ClassMultiplierSelectHandle);
new teamid = ClassAdminTeamSelected[client];
new bool:zombiesselected = bool:(teamid == ZR_CLASS_TEAM_ZOMBIES);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:napalmtime[MENU_LINE_REG_LENGTH];
decl String:health[MENU_LINE_REG_LENGTH];
@ -498,7 +498,7 @@ ClassMultiplierSelectMenu(client)
decl String:knockback[MENU_LINE_REG_LENGTH];
decl String:jumpheight[MENU_LINE_REG_LENGTH];
decl String:jumpdistance[MENU_LINE_REG_LENGTH];
new Float:currentnapalmtime;
new Float:currenthealth;
new Float:currentregeninterval;
@ -508,7 +508,7 @@ ClassMultiplierSelectMenu(client)
new Float:currentknockback;
new Float:currentjumpheight;
new Float:currentjumpdistance;
// Get current multipliers.
currentnapalmtime = Float:ClassMultiplierCache[teamid][ClassM_NapalmTime];
currenthealth = Float:ClassMultiplierCache[teamid][ClassM_Health];
@ -519,9 +519,9 @@ ClassMultiplierSelectMenu(client)
currentknockback = Float:ClassMultiplierCache[teamid][ClassM_Knockback];
currentjumpheight = Float:ClassMultiplierCache[teamid][ClassM_JumpHeight];
currentjumpdistance = Float:ClassMultiplierCache[teamid][ClassM_JumpDistance];
SetGlobalTransTarget(client);
// Translate phrases.
Format(title, sizeof(title), "%t\n", "Classes Menu Multiplier Select Title");
Format(health, sizeof(health), "%t\n %.2f", "Classes Attrib Health", currenthealth);
@ -530,7 +530,7 @@ ClassMultiplierSelectMenu(client)
Format(speed, sizeof(speed), "%t\n %.2f", "Classes Attrib Speed", currentspeed);
Format(jumpheight, sizeof(jumpheight), "%t\n %.2f", "Classes Attrib Jump Height", currentjumpheight);
Format(jumpdistance, sizeof(jumpdistance), "%t\n %.2f", "Classes Attrib Jump Distance", currentjumpdistance);
// Only translate zombie phrases if zombie team is selected.
if (zombiesselected)
{
@ -538,9 +538,9 @@ ClassMultiplierSelectMenu(client)
Format(infectgain, sizeof(infectgain), "%t\n %.2f", "Classes Attrib Infect Gain", currentinfectgain);
Format(knockback, sizeof(knockback), "%t\n %.2f", "Classes Attrib Knockback", currentknockback);
}
SetMenuTitle(menu, title);
// Add items. Don't add zombie attributes if human team is selected.
if (zombiesselected) AddMenuItem(menu, "napalmtime", napalmtime);
AddMenuItem(menu, "health", health);
@ -551,7 +551,7 @@ ClassMultiplierSelectMenu(client)
if (zombiesselected) AddMenuItem(menu, "knockback", knockback);
AddMenuItem(menu, "jumpheight", jumpheight);
AddMenuItem(menu, "jumpdistance", jumpdistance);
SetMenuExitBackButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
@ -563,17 +563,17 @@ public ClassMultiplierSelectHandle(Handle:menu, MenuAction:action, client, slot)
{
decl String:attributename[48];
new ClassMultipliers:attribute;
switch (action)
{
case MenuAction_Select:
{
// Get attribute name.
GetMenuItem(menu, slot, attributename, sizeof(attributename));
// Initialize in case of errors.
attribute = ClassM_Knockback;
// Convert type.
if (StrEqual(attributename, "napalmtime", false))
{
@ -611,7 +611,7 @@ public ClassMultiplierSelectHandle(Handle:menu, MenuAction:action, client, slot)
{
attribute = ClassM_JumpDistance;
}
// Display multiplier menu for the selected attribute.
ClassMultiplierMenu(client, attribute);
}
@ -643,20 +643,20 @@ ClassMultiplierMenu(client, ClassMultipliers:attribute)
{
// Cache selected attribute.
ClassAdminAttributeSelected[client] = attribute;
new Handle:menu = CreateMenu(ClassMultiplierHandle);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:attributename[MENU_LINE_REG_LENGTH];
decl String:linebuffer[MENU_LINE_REG_LENGTH];
// Get attribute string.
ClassMultiplierToString(client, attribute, attributename, sizeof(attributename));
SetGlobalTransTarget(client);
Format(title, sizeof(title), "%t %s\n%t %.2f\n", "Classes Menu Adjust Value", attributename, "Current Value", Float:ClassMultiplierCache[ClassAdminTeamSelected[client]][attribute]);
SetMenuTitle(menu, title);
SetGlobalTransTarget(client);
Format(linebuffer, sizeof(linebuffer), "%t", "Increase by", "0.5");
AddMenuItem(menu, "increasehalf", linebuffer);
@ -666,7 +666,7 @@ ClassMultiplierMenu(client, ClassMultipliers:attribute)
AddMenuItem(menu, "decreasedeci", linebuffer);
Format(linebuffer, sizeof(linebuffer), "%t", "Decrease by", "0.5");
AddMenuItem(menu, "decreasehalf", linebuffer);
SetMenuExitBackButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
@ -674,7 +674,7 @@ ClassMultiplierMenu(client, ClassMultipliers:attribute)
public ClassMultiplierHandle(Handle:menu, MenuAction:action, client, slot)
{
new Float:value;
switch (action)
{
case MenuAction_Select:
@ -698,10 +698,10 @@ public ClassMultiplierHandle(Handle:menu, MenuAction:action, client, slot)
value = -0.5;
}
}
// Update multiplier.
ClassAddToMultiplier(ClassAdminTeamSelected[client], ClassAdminAttributeSelected[client], value);
// Re-display menu.
ClassMultiplierMenu(client, ClassAdminAttributeSelected[client]);
}

View File

@ -33,7 +33,7 @@ ClassAlphaUpdate(client)
new current_health = GetClientHealth(client);
new max_health = ClassGetHealth(client);
new max_damage = ClassGetAlphaDamage(client);
// Calculate if enough damage is done to change alpha.
if ((max_health - current_health) > max_damage)
{

View File

@ -4,7 +4,7 @@
* Zombie:Reloaded
*
* File: clientoverlays.inc
* Type: Core
* Type: Core
* Description: Handles overlays on clients, as a part of class attributes.
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
@ -51,13 +51,13 @@ ClassOverlayOnCommandsHook()
{
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
// Array to store commands.
new String:arrayCmds[CLASSOVERLAY_TOGGLE_MAX_CMDS][CLASSOVERLAY_TOGGLE_MAX_LENGTH];
// Put the commands into an array.
new cmdcount = ExplodeString(togglecmds, ",", arrayCmds, sizeof(arrayCmds), sizeof(arrayCmds[]));
// Register all overlay commands.
for (new i = 0; i < cmdcount; i++)
{
@ -80,7 +80,7 @@ ClassOverlayOnCookiesCreate()
/**
* Called once a client's saved cookies have been loaded from the database.
*
*
* @param client Client index.
*/
ClassOverlayOnCookiesCached(client)
@ -88,11 +88,11 @@ ClassOverlayOnCookiesCached(client)
// Get overlay toggle cvar values.
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
new bool:overlaydefault = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_DEFAULT]);
// Get ZHP enabled cookie value.
decl String:overlayenabled[8];
GetClientCookie(client, g_hOverlayEnabledCookie, overlayenabled, sizeof(overlayenabled));
// If the cookie is empty, then set the default value.
if (!overlayenabled[0])
{
@ -104,7 +104,7 @@ ClassOverlayOnCookiesCached(client)
/**
* Client has been killed.
*
*
* @param client The client index.
*/
ClassOverlayOnClientDeath(client)
@ -119,28 +119,28 @@ ClassOverlayInitialize(client, const String:overlay[])
{
return;
}
// If overlay path is empty, then disable channel, then stop.
if (!overlay[0])
{
OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, false, true);
return;
}
// If overlay toggle is enabled and class has an overlay, then send center text.
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
decl String:overlaypath[PLATFORM_MAX_PATH];
ClassGetOverlayPath(client, overlaypath, sizeof(overlaypath));
if (overlaytoggle && overlaypath[0])
{
decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH];
GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds));
TranslationPrintHintText(client, "Classes overlay toggle", togglecmds);
}
// Display class overlays.
OverlaysClientSetChannelPath(client, OVERLAYS_CHANNEL_CLASSES, overlay);
OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, CookiesGetClientCookieBool(client, g_hOverlayEnabledCookie));
@ -149,7 +149,7 @@ ClassOverlayInitialize(client, const String:overlay[])
/**
* Command callback. (See zr_classes_overlay_togglecmds)
* Toggles nightvision of a client.
*
*
* @param client The client index.
* @param argc Argument count.
*/
@ -160,14 +160,14 @@ public Action:ClassOverlayEnableCommand(client, argc)
{
return;
}
// If overlay toggle is disabled, then stop.
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
if (!overlaytoggle)
{
return;
}
// Toggle current overlay channel, retrieve new value, and update cookie.
new bool:overlayenabled = OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, true);
CookiesSetClientCookieBool(client, g_hOverlayEnabledCookie, overlayenabled);

View File

@ -4,7 +4,7 @@
* Zombie:Reloaded
*
* File: filtertools.inc
* Type: Core
* Type: Core
* Description: Class system tools; validating, getting indexes or lists
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
@ -39,23 +39,23 @@ stock bool:ClassValidateTeamRequirements(cachetype = ZR_CLASS_CACHE_ORIGINAL)
{
new zombieindex;
new humanindex;
// Check if there are no classes.
if (ClassCount == 0)
{
return false;
}
// Test if a zombie and human class was found.
zombieindex = ClassGetFirstClass(ZR_CLASS_TEAM_ZOMBIES, _, cachetype);
humanindex = ClassGetFirstClass(ZR_CLASS_TEAM_HUMANS, _, cachetype);
// Validate indexes.
if (ClassValidateIndex(zombieindex) && ClassValidateIndex(humanindex))
{
return true;
}
return false;
}
@ -71,17 +71,17 @@ stock bool:ClassValidateTeamDefaults(cachetype = ZR_CLASS_CACHE_ORIGINAL)
{
new zombieindex;
new humanindex;
// Check if there are no classes.
if (ClassCount == 0)
{
return false;
}
// Test if a default zombie and human class was found.
zombieindex = ClassGetDefaultClass(ZR_CLASS_TEAM_ZOMBIES, _, cachetype);
humanindex = ClassGetDefaultClass(ZR_CLASS_TEAM_HUMANS, _, cachetype);
// Validate indexes.
if (ClassValidateIndex(zombieindex) && ClassValidateIndex(humanindex))
{
@ -104,7 +104,7 @@ stock bool:ClassValidateTeamDefaults(cachetype = ZR_CLASS_CACHE_ORIGINAL)
stock ClassValidateAttributes(classindex, bool:logErrors = false)
{
new flags;
// Team.
new team = ClassData[classindex][Class_Team];
if (team < ZR_CLASS_TEAM_MIN || team > ZR_CLASS_TEAM_MAX)
@ -115,7 +115,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid team at index %d: %d", classindex, team);
}
}
// Class flags.
new class_flags = ClassData[classindex][Class_Flags];
if (class_flags < ZR_CLASS_FLAGS_MIN || class_flags > ZR_CLASS_FLAGS_MAX)
@ -126,7 +126,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid flags at index %d: %d", classindex, class_flags);
}
}
// Group.
decl String:group[64];
group[0] = 0;
@ -142,7 +142,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
}
}
}
// Name.
decl String:name[64];
name[0] = 0;
@ -169,7 +169,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
}
}
}
// Description.
if (strlen(ClassData[classindex][Class_Description]) < ZR_CLASS_DESCRIPTION_MIN)
{
@ -179,7 +179,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Missing description at index %d.", classindex);
}
}
// Model path.
decl String:model_path[PLATFORM_MAX_PATH];
if (strcopy(model_path, sizeof(model_path), ClassData[classindex][Class_ModelPath]) == 0)
@ -212,7 +212,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
}
}
}
// Model skin index.
new model_skin_index = ClassData[classindex][Class_ModelSkinIndex];
if (model_skin_index < ZR_CLASS_MODEL_SKIN_INDEX_MIN)
@ -223,7 +223,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid model_skin_index at index %d: %d", classindex, model_skin_index);
}
}
// Alpha, initial.
new alpha_initial = ClassData[classindex][Class_AlphaInitial];
if (!(alpha_initial >= ZR_CLASS_ALPHA_INITIAL_MIN && alpha_initial <= ZR_CLASS_ALPHA_INITIAL_MAX))
@ -234,7 +234,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid alpha_inital at index %d: %d", classindex, alpha_initial);
}
}
// Alpha, damaged.
new alpha_damaged = ClassData[classindex][Class_AlphaDamaged];
if (!(alpha_damaged >= ZR_CLASS_ALPHA_DAMAGED_MIN && alpha_damaged <= ZR_CLASS_ALPHA_DAMAGED_MAX))
@ -245,7 +245,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid alpha_damaged at index %d: %d", classindex, alpha_damaged);
}
}
// Alpha, damage.
new alpha_damage = ClassData[classindex][Class_AlphaDamage];
if (!(alpha_damage >= ZR_CLASS_ALPHA_DAMAGE_MIN && alpha_damage <= ZR_CLASS_ALPHA_DAMAGE_MAX))
@ -256,7 +256,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid alpha_damage at index %d: %d", classindex, alpha_damage);
}
}
// Overlay path.
decl String:overlay_path[PLATFORM_MAX_PATH];
decl String:overlay[PLATFORM_MAX_PATH];
@ -273,7 +273,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
}
}
}
// Field of view.
new fov = ClassData[classindex][Class_Fov];
if (!(fov >= ZR_CLASS_FOV_MIN && fov <= ZR_CLASS_FOV_MAX))
@ -284,7 +284,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid fov at index %d: %d", classindex, fov);
}
}
// Napalm time.
new Float:napalm_time = ClassData[classindex][Class_NapalmTime];
if (!(napalm_time >= ZR_CLASS_NAPALM_TIME_MIN && napalm_time <= ZR_CLASS_NAPALM_TIME_MAX))
@ -295,7 +295,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid napalm_time at index %d: %0.2f", classindex, napalm_time);
}
}
// Immunity mode.
new ImmunityMode:immunityMode = ClassData[classindex][Class_ImmunityMode];
if (immunityMode == Immunity_Invalid)
@ -306,7 +306,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid immunity_mode at index %d.", classindex);
}
}
// Immunity amount.
new immunityAmount = ClassData[classindex][Class_ImmunityAmount];
if (!ImmunityIsValidAmount(immunityMode, immunityAmount))
@ -317,7 +317,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid immunity_amount at index %d.", classindex);
}
}
// Immunity cooldown.
new immunityCooldown = ClassData[classindex][Class_ImmunityCooldown];
if (!ImmunityIsValidCooldown(immunityMode, immunityCooldown))
@ -328,7 +328,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid immunity_cooldown at index %d.", classindex);
}
}
// Health.
new health = ClassData[classindex][Class_Health];
if (!(health >= ZR_CLASS_HEALTH_MIN && health <= ZR_CLASS_HEALTH_MAX))
@ -339,7 +339,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid health at index %d: %d", classindex, health);
}
}
// Health regen interval.
new Float:regen_interval = ClassData[classindex][Class_HealthRegenInterval];
if (!(regen_interval >= ZR_CLASS_REGEN_INTERVAL_MIN && regen_interval <= ZR_CLASS_REGEN_INTERVAL_MAX))
@ -350,7 +350,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid health_regen_interval at index %d: %0.2f", classindex, regen_interval);
}
}
// Health regen amount.
new regen_amount = ClassData[classindex][Class_HealthRegenAmount];
if (!(regen_amount >= ZR_CLASS_REGEN_AMOUNT_MIN && regen_amount <= ZR_CLASS_REGEN_AMOUNT_MAX))
@ -361,7 +361,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid health_regen_amount at index %d: %d", classindex, regen_amount);
}
}
// Health infect gain.
new infect_gain = ClassData[classindex][Class_HealthInfectGain];
if (!(infect_gain >= ZR_CLASS_HEALTH_INFECT_GAIN_MIN && infect_gain <= ZR_CLASS_HEALTH_INFECT_GAIN_MAX))
@ -372,7 +372,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid health_infect_gain at index %d: %d", classindex, infect_gain);
}
}
// Kill bonus.
new kill_bonus = ClassData[classindex][Class_KillBonus];
if (!(kill_bonus >= ZR_CLASS_KILL_BONUS_MIN && kill_bonus <= ZR_CLASS_KILL_BONUS_MAX))
@ -383,7 +383,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid kill_bonus at index %d: %d", classindex, kill_bonus);
}
}
// Speed.
new Float:speed = ClassData[classindex][Class_Speed];
new Float:min;
@ -409,7 +409,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid speed at index %d: %0.2f", classindex, speed);
}
}
// Knockback.
new Float:knockback = ClassData[classindex][Class_KnockBack];
if (!(knockback >= ZR_CLASS_KNOCKBACK_MIN && knockback <= ZR_CLASS_KNOCKBACK_MAX))
@ -420,7 +420,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid knockback at index %d: %0.2f", classindex, knockback);
}
}
// Jump height.
new Float:jump_height = ClassData[classindex][Class_JumpHeight];
if (!(jump_height >= ZR_CLASS_JUMP_HEIGHT_MIN && jump_height <= ZR_CLASS_JUMP_HEIGHT_MAX))
@ -431,7 +431,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid jump_height at index %d: %0.2f", classindex, jump_height);
}
}
// Jump distance.
new Float:jump_distance = ClassData[classindex][Class_JumpDistance];
if (!(jump_distance >= ZR_CLASS_JUMP_DISTANCE_MIN && jump_distance <= ZR_CLASS_JUMP_DISTANCE_MAX))
@ -442,7 +442,7 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid jump_distance at index %d: %0.2f", classindex, jump_distance);
}
}
return flags;
}
@ -456,14 +456,14 @@ stock ClassValidateAttributes(classindex, bool:logErrors = false)
stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
{
new flags;
// Model skin index.
new model_skin_index = attributes[ClassEdit_ModelSkinIndex];
if (model_skin_index < ZR_CLASS_MODEL_SKIN_INDEX_MIN)
{
flags += ZR_CLASS_MODEL_SKIN_INDEX;
}
// Alpha initial.
new alphaInitial = attributes[ClassEdit_AlphaInitial];
if (alphaInitial >= 0)
@ -473,7 +473,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_ALPHA_INITIAL;
}
}
// Alpha damaged.
new alphaDamaged = attributes[ClassEdit_AlphaDamaged];
if (alphaDamaged >= 0)
@ -483,7 +483,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_ALPHA_DAMAGED;
}
}
// Alpha damage.
new alphaDamage = attributes[ClassEdit_AlphaDamage];
if (alphaDamage >= 0)
@ -493,7 +493,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_ALPHA_DAMAGE;
}
}
// Overlay.
if (!StrEqual(attributes[ClassEdit_OverlayPath], "nochange", false))
{
@ -509,7 +509,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
}
}
}
// Fov.
new fov = attributes[ClassEdit_Fov];
if (fov >= 0)
@ -519,7 +519,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_FOV;
}
}
// Napalm time.
new Float:napalmTime = attributes[ClassEdit_NapalmTime];
if (napalmTime >= 0.0)
@ -529,17 +529,17 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_NAPALM_TIME;
}
}
// Immunity mode.
new ImmunityMode:immunityMode = attributes[ClassEdit_ImmunityMode];
if (immunityMode == Immunity_Invalid)
{
flags += ZR_CLASS_IMMUNITY_MODE;
}
// Immunity amount.
// TODO: Validate amount value. This depends on the immunity mode.
// Health regen interval.
new Float:healthRegenInterval = attributes[ClassEdit_RegenInterval];
if (healthRegenInterval >= 0.0)
@ -549,7 +549,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_REGEN_INTERVAL;
}
}
// Health regen amount.
new healthRegenAmount = attributes[ClassEdit_RegenAmount];
if (healthRegenAmount >= 0)
@ -559,7 +559,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_REGEN_AMOUNT;
}
}
// Infect gain.
new infectGain = attributes[ClassEdit_InfectGain];
if (infectGain >= 0)
@ -569,7 +569,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_HEALTH_INFECT_GAIN;
}
}
// Kill bonus.
new killBonus = attributes[ClassEdit_KillBonus];
if (killBonus >= 0)
@ -579,7 +579,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_KILL_BONUS;
}
}
// Speed.
new Float:speed = attributes[ClassEdit_Speed];
if (speed >= 0)
@ -604,7 +604,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_SPEED;
}
}
// Knock back.
new Float:knockBack = attributes[ClassEdit_KnockBack];
if (knockBack > ZR_CLASS_KNOCKBACK_IGNORE)
@ -614,7 +614,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_KNOCKBACK;
}
}
// Jump heigt.
new Float:jumpHeight = attributes[ClassEdit_JumpHeight];
if (jumpHeight >= 0.0)
@ -624,7 +624,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_JUMP_HEIGHT;
}
}
// Jump distance.
new Float:jumpDistance = attributes[ClassEdit_JumpDistance];
if (jumpDistance >= 0.0)
@ -634,7 +634,7 @@ stock ClassValidateEditableAttributes(attributes[ClassEditableAttributes])
flags += ZR_CLASS_JUMP_DISTANCE;
}
}
return flags;
}
@ -719,7 +719,7 @@ stock ClassGetIndex(const String:name[], cachetype = ZR_CLASS_CACHE_MODIFIED)
{
return -1;
}
// Loop through all classes.
for (new classindex = 0; classindex < ClassCount; classindex++)
{
@ -730,7 +730,7 @@ stock ClassGetIndex(const String:name[], cachetype = ZR_CLASS_CACHE_MODIFIED)
return classindex;
}
}
// The class index wasn't found.
return -1;
}
@ -745,13 +745,13 @@ stock ClassGetIndex(const String:name[], cachetype = ZR_CLASS_CACHE_MODIFIED)
stock ClassGetActiveIndex(client)
{
new teamid;
if (!ZRIsClientOnTeam(client))
{
// No active team.
return -1;
}
// Check if the player currently is in admin mode.
if (ClassPlayerInAdminMode[client])
{
@ -769,7 +769,7 @@ stock ClassGetActiveIndex(client)
teamid = ZR_CLASS_TEAM_ZOMBIES;
}
}
// Return the active class for the active team.
return ClassSelected[client][teamid];
}
@ -785,7 +785,7 @@ stock ClassGetActiveIndex(client)
stock Float:ClassGetAttributeMultiplier(client, ClassMultipliers:attribute)
{
new teamid;
// Check if player is not in admin mode.
if (!ClassPlayerInAdminMode[client])
{
@ -798,7 +798,7 @@ stock Float:ClassGetAttributeMultiplier(client, ClassMultipliers:attribute)
{
teamid = ZR_CLASS_TEAM_ZOMBIES;
}
// Get multiplier for the specified team and attribute.
return Float:ClassMultiplierCache[teamid][attribute];
}
@ -811,7 +811,7 @@ stock Float:ClassGetAttributeMultiplier(client, ClassMultipliers:attribute)
/**
* Check if a class pass the specified filter.
*
*
* @param index Index of the class in a class cache or a client index,
* depending on the cache type specified.
* @param filter Structure with filter settings.
@ -830,23 +830,23 @@ stock bool:ClassFilterMatch(index, filter[ClassFilter], cachetype = ZR_CLASS_CAC
{
return false;
}
// Check if class flags pass the flag filter.
if (!ClassFlagFilterMatch(index, filter[ClassFilter_RequireFlags], filter[ClassFilter_DenyFlags], cachetype))
{
return false;
}
// Get class group name.
decl String:groupname[64];
groupname[0] = 0;
ClassGetGroup(index, groupname, sizeof(groupname), cachetype);
// Get class sm_flags.
decl String:sm_flags[64];
sm_flags[0] = 0;
ClassGetSM_Flags(index, sm_flags, sizeof(sm_flags), cachetype);
// Check if a client is specified in the filter.
new client = filter[ClassFilter_Client];
if (ZRIsClientValid(client))
@ -874,7 +874,7 @@ stock bool:ClassFilterMatch(index, filter[ClassFilter], cachetype = ZR_CLASS_CAC
return false;
}
}
// Check if classes with groups are set to be excluded.
if (client < 0)
{
@ -890,14 +890,14 @@ stock bool:ClassFilterMatch(index, filter[ClassFilter], cachetype = ZR_CLASS_CAC
return false;
}
}
// The class passed the filter.
return true;
}
/**
* Check if a class pass the specified flag filters.
*
*
* @param index Index of the class in a class cache or a client index,
* depending on the cache type specified.
* @param require Class flags to require. 0 for no filter.
@ -915,37 +915,37 @@ stock bool:ClassFlagFilterMatch(index, require, deny, cachetype)
new flags;
new bool:requirepassed = false;
new bool:denypassed = false;
// Do quick check for optimization reasons: Check if no flags are specified.
if (require == 0 && deny == 0)
{
return true;
}
// Cache flags.
flags = ClassGetFlags(index, cachetype);
// Match require filter.
if (require == 0 || flags & require)
{
// All required flags are set.
requirepassed = true;
}
// Match deny filter.
if (deny == 0 || !(flags & deny))
{
// No denied flags are set.
denypassed = true;
}
// Check if required and denied flags passed the filter.
if (requirepassed && denypassed)
{
// The class pass the filter.
return true;
}
// The class didn't pass the filter.
return false;
}
@ -964,20 +964,20 @@ bool:ClassAllowSelection(client, team = -1, filter[ClassFilter] = ClassNoFilter)
new bool:zombie = GetConVarBool(g_hCvarsList[CVAR_CLASSES_ZOMBIE_SELECT]);
new bool:human = GetConVarBool(g_hCvarsList[CVAR_CLASSES_HUMAN_SELECT]);
new bool:admin = GetConVarBool(g_hCvarsList[CVAR_CLASSES_ADMIN_SELECT]);
// Since admin mode classes are optional they must be counted to verify
// that they exist.
new bool:adminexist;
// Check if player is admin.
new bool:isadmin = ZRIsClientAdmin(client);
// Only count admin mode classes if client is admin.
if (isadmin)
{
adminexist = ClassCountTeam(ZR_CLASS_TEAM_ADMINS, filter) > 0;
}
// Check if a team id is specified.
if (team >= 0)
{
@ -998,7 +998,7 @@ bool:ClassAllowSelection(client, team = -1, filter[ClassFilter] = ClassNoFilter)
return admin && isadmin && adminexist;
}
}
// Team ID didn't match.
return false;
}
@ -1012,7 +1012,7 @@ bool:ClassAllowSelection(client, team = -1, filter[ClassFilter] = ClassNoFilter)
/**
* Gets all class indexes or from a specified team, and adds them to the
* specified array.
*
*
* @param array The destination array to add class indexes.
* @param teamfilter Optional. The team ID to filter. A negative value
* for no filter (default).
@ -1032,17 +1032,17 @@ stock bool:ClassAddToArray(Handle:array, teamfilter = -1, filter[ClassFilter] =
{
return false;
}
// Check if there are no classes.
if (ClassCount == 0)
{
return false;
}
// Store a local boolean that says if the user specified a team filter or not.
new bool:hasteamfilter = bool:(teamfilter >= 0);
new classesadded;
// Loop through all classes.
for (new classindex = 0; classindex < ClassCount; classindex++)
{
@ -1052,7 +1052,7 @@ stock bool:ClassAddToArray(Handle:array, teamfilter = -1, filter[ClassFilter] =
// The class is didn't pass the filter, skip class.
continue;
}
// Check team filtering.
if (hasteamfilter)
{
@ -1071,7 +1071,7 @@ stock bool:ClassAddToArray(Handle:array, teamfilter = -1, filter[ClassFilter] =
classesadded++;
}
}
if (classesadded)
{
return true;
@ -1103,11 +1103,11 @@ stock ClassCountTeam(teamfilter = -1, filter[ClassFilter] = ClassNoFilter, cache
{
return 0;
}
// Store a local boolean that says if the user specified a team filter or not.
new bool:hasteamfilter = bool:(teamfilter >= 0);
new count;
// Loop through all classes.
for (new classindex = 0; classindex < ClassCount; classindex++)
{
@ -1117,7 +1117,7 @@ stock ClassCountTeam(teamfilter = -1, filter[ClassFilter] = ClassNoFilter, cache
// The class is didn't pass the filter, skip class.
continue;
}
// Check team filtering.
if (hasteamfilter)
{
@ -1134,7 +1134,7 @@ stock ClassCountTeam(teamfilter = -1, filter[ClassFilter] = ClassNoFilter, cache
count++;
}
}
// Return number of classes found.
return count;
}
@ -1158,16 +1158,16 @@ stock ClassGetRandomClass(teamfilter = -1, filter[ClassFilter] = ClassNoSpecialC
new arraycount;
new randnum;
new buffer;
classarray = CreateArray();
// Try to get a class list.
if (ClassAddToArray(classarray, teamfilter, filter, cachetype))
{
// Get a random index from the new class array.
arraycount = GetArraySize(classarray);
randnum = GetRandomInt(0, arraycount - 1);
// Return the value at the random index.
buffer = GetArrayCell(classarray, randnum);
CloseHandle(classarray);
@ -1203,9 +1203,9 @@ stock ClassGetFirstClass(teamfilter = -1, filter[ClassFilter] = ClassNoSpecialCl
{
return false;
}
new bool:hasteamfilter = bool:(teamfilter >= 0);
// Loop through all classes.
for (new classindex = 0; classindex < ClassCount; classindex++)
{
@ -1215,7 +1215,7 @@ stock ClassGetFirstClass(teamfilter = -1, filter[ClassFilter] = ClassNoSpecialCl
// The class is didn't pass the filter, skip class.
continue;
}
if (hasteamfilter)
{
if (teamfilter == ClassGetTeamID(classindex, cachetype))
@ -1230,7 +1230,7 @@ stock ClassGetFirstClass(teamfilter = -1, filter[ClassFilter] = ClassNoSpecialCl
return classindex;
}
}
return -1;
}
@ -1253,9 +1253,9 @@ stock ClassGetDefaultClass(teamid, filter[ClassFilter] = ClassNoSpecialClasses,
new Handle:classarray;
new arraycount;
new classindex;
classarray = CreateArray();
// Get all classes from the specified team.
if (!ClassAddToArray(classarray, teamid, filter, cachetype))
{
@ -1263,14 +1263,14 @@ stock ClassGetDefaultClass(teamid, filter[ClassFilter] = ClassNoSpecialClasses,
CloseHandle(classarray);
return -1;
}
// Loop through all classes and return the first class marked as team default.
arraycount = GetArraySize(classarray);
for (new i = 0; i < arraycount; i++)
{
// Get class index from the array.
classindex = GetArrayCell(classarray, i);
// Check if the current class is marked as team default.
if (ClassGetTeamDefault(classindex, cachetype))
{
@ -1279,7 +1279,7 @@ stock ClassGetDefaultClass(teamid, filter[ClassFilter] = ClassNoSpecialClasses,
return classindex;
}
}
CloseHandle(classarray);
return -1;
}
@ -1303,7 +1303,7 @@ stock ClassGetDefaultSpawnClass(teamid, filter[ClassFilter] = ClassNoSpecialClas
{
decl String:classname[64];
new classindex;
// Get the default class name from the correct CVAR depending on teamid.
switch (teamid)
{
@ -1325,7 +1325,7 @@ stock ClassGetDefaultSpawnClass(teamid, filter[ClassFilter] = ClassNoSpecialClas
return -1;
}
}
// Check if the class name isn't empty.
if (strlen(classname) > 0)
{
@ -1335,7 +1335,7 @@ stock ClassGetDefaultSpawnClass(teamid, filter[ClassFilter] = ClassNoSpecialClas
// Get a list of all classes with the specified team ID. Deny
// classes with special flags.
classindex = ClassGetRandomClass(teamid, filter, cachetype);
// Validate the result, in case there were errors.
if (ClassValidateIndex(classindex))
{
@ -1352,10 +1352,10 @@ stock ClassGetDefaultSpawnClass(teamid, filter[ClassFilter] = ClassNoSpecialClas
else
{
// The user set a spesific class.
// Try to get the class index with the specified class name.
classindex = ClassGetIndex(classname, cachetype);
// Validate the class index and check if the team IDs match.
if (ClassValidateIndex(classindex) && (teamid == ClassGetTeamID(classindex, cachetype)))
{
@ -1367,9 +1367,9 @@ stock ClassGetDefaultSpawnClass(teamid, filter[ClassFilter] = ClassNoSpecialClas
// Because it's user input, we'll fall back to the first class
// in the specified team, and log a warning.
classindex = ClassGetFirstClass(teamid, filter, cachetype);
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Default Spawn Class", "Warning: Failed to set \"%s\" as default spawn class for team %d. The class doesn't exist or the team IDs doesn't match. Falling back to the first class in the team.", classname, teamid);
// Validate the new index.
if (ClassValidateIndex(classindex))
{

View File

@ -4,7 +4,7 @@
* Zombie:Reloaded
*
* File: healthregen.inc
* Type: Core
* Type: Core
* Description: Functions for managing health regeneration on a client.
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
@ -66,7 +66,7 @@ ClassHealthRegenStart(client, Float:interval)
{
// Stop timer if it already exist.
ClassHealthRegenStop(client);
// Create new timer.
tHealthRegen[client] = CreateTimer(interval, ClassHealthRegenTimer, client, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
@ -97,16 +97,16 @@ public Action:ClassHealthRegenTimer(Handle:timer, any:client)
tHealthRegen[client] = INVALID_HANDLE;
return Plugin_Stop;
}
new health = GetClientHealth(client);
new health = GetClientHealth(client);
health += ClientHealthRegenAmount[client];
// Check if the health points is below the limit.
if (health < ClientHealthRegenMax[client])
{
// Increase health.
SetEntityHealth(client, health);
}
return Plugin_Continue;
}

View File

@ -4,7 +4,7 @@
* Zombie:Reloaded
*
* File: playerclasses.inc
* Type: Core
* Type: Core
* Description: Provides functions for managing classes.
*
* Copyright (C) 2009-2013 Greyscale, Richard Helgeby
@ -32,11 +32,11 @@
below) they turn into zombies.
- Fully imune to all damage. Can't take or give damage. Sould only be used
on admin mode classes.
TODO: Make class attributes for for changing model render mode and colors.
TODO: Make class attributes for fancy effects, like a glow (if possible).
TODO: Make immunity settings suitable for both teams, or certain zombie-
only/human-only settings.
*/
@ -249,38 +249,38 @@ enum ClassAttributes
Class_Flags,
String:Class_Group[64],
String:Class_SM_Flags[64],
String:Class_Name[64],
String:Class_Description[256],
/* Model */
String:Class_ModelPath[PLATFORM_MAX_PATH],
Class_ModelSkinIndex,
Class_AlphaInitial,
Class_AlphaDamaged,
Class_AlphaDamage,
/* Hud */
String:Class_OverlayPath[PLATFORM_MAX_PATH],
bool:Class_Nvgs,
Class_Fov,
/* Effects */
bool:Class_HasNapalm,
Float:Class_NapalmTime,
/* Player behaviour */
ImmunityMode:Class_ImmunityMode,
Class_ImmunityAmount,
Class_ImmunityCooldown,
bool:Class_NoFallDamage,
Class_Health,
Float:Class_HealthRegenInterval,
Class_HealthRegenAmount,
Class_HealthInfectGain,
Class_KillBonus,
Float:Class_Speed,
Float:Class_KnockBack,
Float:Class_JumpHeight,
@ -304,27 +304,27 @@ enum ClassEditableAttributes
ClassEdit_AlphaInitial,
ClassEdit_AlphaDamaged,
ClassEdit_AlphaDamage,
/* Hud */
String:ClassEdit_OverlayPath[PLATFORM_MAX_PATH],
ClassEdit_Nvgs,
ClassEdit_Fov,
/* Effects */
ClassEdit_HasNapalm,
Float:ClassEdit_NapalmTime,
/* Player behavior */
ImmunityMode:ClassEdit_ImmunityMode,
ClassEdit_ImmunityAmount,
ClassEdit_ImmunityCooldown,
ClassEdit_NoFallDamage,
Float:ClassEdit_RegenInterval,
ClassEdit_RegenAmount,
ClassEdit_InfectGain,
ClassEdit_KillBonus,
Float:ClassEdit_Speed,
Float:ClassEdit_KnockBack,
Float:ClassEdit_JumpHeight,
@ -525,41 +525,41 @@ ClassLoad()
{
// Register config file.
ConfigRegisterConfig(File_Classes, Structure_Keyvalue, CONFIG_FILE_ALIAS_CLASSES);
new Handle:kvClassData;
// Make sure kvClassData is ready to use.
kvClassData = CreateKeyValues(CONFIG_FILE_ALIAS_CLASSES);
// Get weapons config path.
decl String:pathclasses[PLATFORM_MAX_PATH];
new bool:exists = ConfigGetCvarFilePath(CVAR_CONFIG_PATH_CLASSES, pathclasses);
// If file doesn't exist, then log and stop.
if (!exists)
{
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Missing playerclasses config file \"%s\"", pathclasses);
// Remove key/value cache.
CloseHandle(kvClassData);
kvClassData = INVALID_HANDLE;
return;
}
// Log what class file that is loaded.
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Loading classes from file \"%s\".", pathclasses);
// Put file data into memory.
FileToKeyValues(kvClassData, pathclasses);
// Try to find the first class.
KvRewind(kvClassData);
if (!KvGotoFirstSubKey(kvClassData))
{
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Can't find any classes in \"%s\"", pathclasses);
}
new String:name[64];
new String:group[64];
new String:sm_flags[64];
@ -567,11 +567,11 @@ ClassLoad()
new String:model_path[PLATFORM_MAX_PATH];
new String:immunity_mode[32];
new String:overlay_path[PLATFORM_MAX_PATH];
ClassCount = 0;
new failedcount;
new ClassErrorFlags;
// Loop through all classes and store attributes in the ClassData array.
do
{
@ -579,70 +579,70 @@ ClassLoad()
{
// Maximum classes reached. Write a warning and exit the loop.
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Maximum classes reached (%d). Skipping other classes.", ZR_CLASS_MAX + 1);
break;
}
/* General */
ClassData[ClassCount][Class_Enabled] = ConfigKvGetStringBool(kvClassData, "enabled", ZR_CLASS_DEFAULT_ENABLED);
ClassData[ClassCount][Class_Team] = KvGetNum(kvClassData, "team", ZR_CLASS_DEFAULT_TEAM);
ClassData[ClassCount][Class_TeamDefault] = ConfigKvGetStringBool(kvClassData, "team_default", ZR_CLASS_DEFAULT_TEAM_DEFAULT);
ClassData[ClassCount][Class_Flags] = KvGetNum(kvClassData, "flags", ZR_CLASS_DEFAULT_FLAGS);
KvGetString(kvClassData, "group", group, sizeof(group), ZR_CLASS_DEFAULT_GROUP);
strcopy(ClassData[ClassCount][Class_Group], 64, group);
KvGetString(kvClassData, "sm_flags", sm_flags, sizeof(sm_flags), ZR_CLASS_DEFAULT_SM_FLAGS);
strcopy(ClassData[ClassCount][Class_SM_Flags], 64, sm_flags);
KvGetString(kvClassData, "name", name, sizeof(name), ZR_CLASS_DEFAULT_NAME);
strcopy(ClassData[ClassCount][Class_Name], 64, name);
KvGetString(kvClassData, "description", description, sizeof(description), ZR_CLASS_DEFAULT_DESCRIPTION);
strcopy(ClassData[ClassCount][Class_Description], 256, description);
/* Model */
KvGetString(kvClassData, "model_path", model_path, sizeof(model_path), ZR_CLASS_DEFAULT_MODEL_PATH);
strcopy(ClassData[ClassCount][Class_ModelPath], PLATFORM_MAX_PATH, model_path);
ClassData[ClassCount][Class_ModelSkinIndex] = KvGetNum(kvClassData, "model_skin_index", ZR_CLASS_DEFAULT_MODEL_SKIN_INDEX);
ClassData[ClassCount][Class_AlphaInitial] = KvGetNum(kvClassData, "alpha_initial", ZR_CLASS_DEFAULT_ALPHA_INITIAL);
ClassData[ClassCount][Class_AlphaDamaged] = KvGetNum(kvClassData, "alpha_damaged", ZR_CLASS_DEFAULT_ALPHA_DAMAGED);
ClassData[ClassCount][Class_AlphaDamage] = KvGetNum(kvClassData, "alpha_damage", ZR_CLASS_DEFAULT_ALPHA_DAMAGE);
/* Hud */
KvGetString(kvClassData, "overlay_path", overlay_path, sizeof(overlay_path), ZR_CLASS_DEFAULT_OVERLAY_PATH);
strcopy(ClassData[ClassCount][Class_OverlayPath], PLATFORM_MAX_PATH, overlay_path);
ClassData[ClassCount][Class_Nvgs] = ConfigKvGetStringBool(kvClassData, "nvgs", ZR_CLASS_DEFAULT_NVGS);
ClassData[ClassCount][Class_Fov] = KvGetNum(kvClassData, "fov", ZR_CLASS_DEFAULT_FOV);
/* Effects */
ClassData[ClassCount][Class_HasNapalm] = ConfigKvGetStringBool(kvClassData, "has_napalm", ZR_CLASS_DEFAULT_HAS_NAPALM);
ClassData[ClassCount][Class_NapalmTime] = KvGetFloat(kvClassData, "napalm_time", ZR_CLASS_DEFAULT_NAPALM_TIME);
/* Player behaviour */
KvGetString(kvClassData, "immunity_mode", immunity_mode, sizeof(immunity_mode), ZR_CLASS_DEFAULT_IMMUNITY_MODE);
ClassData[ClassCount][Class_ImmunityMode] = ImmunityStringToMode(immunity_mode);
ClassData[ClassCount][Class_ImmunityAmount] = KvGetNum(kvClassData, "immunity_amount", ZR_CLASS_DEFAULT_IMMUNITY_AMOUNT);
ClassData[ClassCount][Class_ImmunityCooldown] = KvGetNum(kvClassData, "immunity_cooldown", ZR_CLASS_DEFAULT_IMMUNITY_COOLDOWN);
ClassData[ClassCount][Class_NoFallDamage] = ConfigKvGetStringBool(kvClassData, "no_fall_damage", ZR_CLASS_DEFAULT_NO_FALL_DAMAGE);
ClassData[ClassCount][Class_Health] = KvGetNum(kvClassData, "health", ZR_CLASS_DEFAULT_HEALTH);
ClassData[ClassCount][Class_HealthRegenInterval] = KvGetFloat(kvClassData, "health_regen_interval", ZR_CLASS_DEFAULT_HEALTH_REGEN_INTERVAL);
ClassData[ClassCount][Class_HealthRegenAmount] = KvGetNum(kvClassData, "health_regen_amount", ZR_CLASS_DEFAULT_HEALTH_REGEN_AMOUNT);
ClassData[ClassCount][Class_HealthInfectGain] = KvGetNum(kvClassData, "health_infect_gain", ZR_CLASS_DEFAULT_HEALTH_INFECT_GAIN);
ClassData[ClassCount][Class_KillBonus] = KvGetNum(kvClassData, "kill_bonus", ZR_CLASS_DEFAULT_KILL_BONUS);
ClassData[ClassCount][Class_Speed] = KvGetFloat(kvClassData, "speed", ZR_CLASS_DEFAULT_SPEED);
ClassData[ClassCount][Class_KnockBack] = KvGetFloat(kvClassData, "knockback", ZR_CLASS_DEFAULT_KNOCKBACK);
ClassData[ClassCount][Class_JumpHeight] = KvGetFloat(kvClassData, "jump_height", ZR_CLASS_DEFAULT_JUMP_HEIGHT);
ClassData[ClassCount][Class_JumpDistance] = KvGetFloat(kvClassData, "jump_distance", ZR_CLASS_DEFAULT_JUMP_DISTANCE);
// Validate class attributes if class is enabled.
if (ClassData[ClassCount][Class_Enabled])
{
@ -653,44 +653,44 @@ ClassLoad()
// and log an error message.
ClassData[ClassCount][Class_Enabled] = false;
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Warning: Invalid class at index %d, disabled class. Class error flags: %d.", ClassCount, ClassErrorFlags);
failedcount++;
}
}
// Update the counter.
ClassCount++;
} while (KvGotoNextKey(kvClassData));
// Validate team requirements.
if (!ClassValidateTeamRequirements())
{
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "The class configuration doesn't match the team requirements.");
}
// Validate team default requirements.
if (!ClassValidateTeamDefaults())
{
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Couldn't find a default class for one or more teams. At least one class per team must be marked as default.");
}
// Cache class data.
ClassReloadDataCache();
// Reset selected class indexes for next spawn.
ClassResetNextIndexes();
// Mark classes as valid.
ClassValidated = true;
// Log summary.
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", ClassCount, ClassCount - failedcount, failedcount);
// Set config data.
ConfigSetConfigLoaded(File_Classes, true);
ConfigSetConfigReloadFunc(File_Classes, GetFunctionByName(GetMyHandle(), "ClassOnConfigReload"));
ConfigSetConfigPath(File_Classes, pathclasses);
// Remove key/value cache.
CloseHandle(kvClassData);
kvClassData = INVALID_HANDLE;
@ -698,7 +698,7 @@ ClassLoad()
/**
* Called when configs are being reloaded.
*
*
* @param config The config being reloaded. (only if 'all' is false)
*/
public ClassOnConfigReload(ConfigFile:config)
@ -707,7 +707,7 @@ public ClassOnConfigReload(ConfigFile:config)
ClassLoad();
}
/**
/**
* Gets the speed method.
*
* @return Speed method, or ClassSpeed_Invalid on error.
@ -716,9 +716,9 @@ ClassSpeedMethods:ClassGetSpeedMethod()
{
decl String:speedMethod[16];
speedMethod[0] = 0;
GetConVarString(g_hCvarsList[CVAR_CLASSES_SPEED_METHOD], speedMethod, sizeof(speedMethod));
if (StrEqual(speedMethod, "lmv", false))
{
return ClassSpeed_LMV;
@ -727,7 +727,7 @@ ClassSpeedMethods:ClassGetSpeedMethod()
{
return ClassSpeed_Prop;
}
return ClassSpeed_Invalid;
}
@ -743,7 +743,7 @@ bool:ClassReloadDataCache()
{
return false;
}
// Loop through all classes.
for (new classindex = 0; classindex < ClassCount; classindex++)
{
@ -756,23 +756,23 @@ bool:ClassReloadDataCache()
strcopy(ClassDataCache[classindex][Class_SM_Flags], 64, ClassData[classindex][Class_SM_Flags]);
strcopy(ClassDataCache[classindex][Class_Name], 64, ClassData[classindex][Class_Name]);
strcopy(ClassDataCache[classindex][Class_Description], 256, ClassData[classindex][Class_Description]);
/* Model */
strcopy(ClassDataCache[classindex][Class_ModelPath], PLATFORM_MAX_PATH, ClassData[classindex][Class_ModelPath]);
ClassDataCache[classindex][Class_ModelSkinIndex] = ClassData[classindex][Class_ModelSkinIndex];
ClassDataCache[classindex][Class_AlphaInitial] = ClassData[classindex][Class_AlphaInitial];
ClassDataCache[classindex][Class_AlphaDamaged] = ClassData[classindex][Class_AlphaDamaged];
ClassDataCache[classindex][Class_AlphaDamage] = ClassData[classindex][Class_AlphaDamage];
/* Hud */
strcopy(ClassDataCache[classindex][Class_OverlayPath], PLATFORM_MAX_PATH, ClassData[classindex][Class_OverlayPath]);
ClassDataCache[classindex][Class_Nvgs] = ClassData[classindex][Class_Nvgs];
ClassDataCache[classindex][Class_Fov] = ClassData[classindex][Class_Fov];
/* Effects */
ClassDataCache[classindex][Class_HasNapalm] = ClassData[classindex][Class_HasNapalm];
ClassDataCache[classindex][Class_NapalmTime] = ClassData[classindex][Class_NapalmTime];
/* Player behavior */
ClassDataCache[classindex][Class_ImmunityMode] = ClassData[classindex][Class_ImmunityMode];
ClassDataCache[classindex][Class_ImmunityAmount] = ClassData[classindex][Class_ImmunityAmount];
@ -788,7 +788,7 @@ bool:ClassReloadDataCache()
ClassDataCache[classindex][Class_JumpHeight] = ClassData[classindex][Class_JumpHeight];
ClassDataCache[classindex][Class_JumpDistance] = ClassData[classindex][Class_JumpDistance];
}
return true;
}
@ -810,7 +810,7 @@ bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIF
{
return false;
}
switch (cachetype)
{
case ZR_CLASS_CACHE_ORIGINAL:
@ -824,23 +824,23 @@ bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIF
strcopy(ClassPlayerCache[client][Class_SM_Flags], 64, ClassData[classindex][Class_SM_Flags]);
strcopy(ClassPlayerCache[client][Class_Name], 64, ClassData[classindex][Class_Name]);
strcopy(ClassPlayerCache[client][Class_Description], 256, ClassData[classindex][Class_Description]);
/* Model */
strcopy(ClassPlayerCache[client][Class_ModelPath], PLATFORM_MAX_PATH, ClassData[classindex][Class_ModelPath]);
ClassPlayerCache[client][Class_ModelSkinIndex] = ClassData[classindex][Class_ModelSkinIndex];
ClassPlayerCache[client][Class_AlphaInitial] = ClassData[classindex][Class_AlphaInitial];
ClassPlayerCache[client][Class_AlphaDamaged] = ClassData[classindex][Class_AlphaDamaged];
ClassPlayerCache[client][Class_AlphaDamage] = ClassData[classindex][Class_AlphaDamage];
/* Hud */
strcopy(ClassPlayerCache[client][Class_OverlayPath], PLATFORM_MAX_PATH, ClassData[classindex][Class_OverlayPath]);
ClassPlayerCache[client][Class_Nvgs] = ClassData[classindex][Class_Nvgs];
ClassPlayerCache[client][Class_Fov] = ClassData[classindex][Class_Fov];
/* Effects */
ClassPlayerCache[client][Class_HasNapalm] = ClassData[classindex][Class_HasNapalm];
ClassPlayerCache[client][Class_NapalmTime] = ClassData[classindex][Class_NapalmTime];
/* Player behavior */
ClassPlayerCache[client][Class_ImmunityMode] = ClassData[classindex][Class_ImmunityMode];
ClassPlayerCache[client][Class_ImmunityAmount] = ClassData[classindex][Class_ImmunityAmount];
@ -867,23 +867,23 @@ bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIF
strcopy(ClassPlayerCache[client][Class_SM_Flags], 64, ClassDataCache[classindex][Class_SM_Flags]);
strcopy(ClassPlayerCache[client][Class_Name], 64, ClassDataCache[classindex][Class_Name]);
strcopy(ClassPlayerCache[client][Class_Description], 256, ClassDataCache[classindex][Class_Description]);
/* Model */
strcopy(ClassPlayerCache[client][Class_ModelPath], PLATFORM_MAX_PATH, ClassDataCache[classindex][Class_ModelPath]);
ClassPlayerCache[client][Class_ModelSkinIndex] = ClassDataCache[classindex][Class_ModelSkinIndex];
ClassPlayerCache[client][Class_AlphaInitial] = ClassDataCache[classindex][Class_AlphaInitial];
ClassPlayerCache[client][Class_AlphaDamaged] = ClassDataCache[classindex][Class_AlphaDamaged];
ClassPlayerCache[client][Class_AlphaDamage] = ClassDataCache[classindex][Class_AlphaDamage];
/* Hud */
strcopy(ClassPlayerCache[client][Class_OverlayPath], PLATFORM_MAX_PATH, ClassDataCache[classindex][Class_OverlayPath]);
ClassPlayerCache[client][Class_Nvgs] = ClassDataCache[classindex][Class_Nvgs];
ClassPlayerCache[client][Class_Fov] = ClassDataCache[classindex][Class_Fov];
/* Effects */
ClassPlayerCache[client][Class_HasNapalm] = ClassDataCache[classindex][Class_HasNapalm];
ClassPlayerCache[client][Class_NapalmTime] = ClassDataCache[classindex][Class_NapalmTime];
/* Player behavior */
ClassPlayerCache[client][Class_ImmunityMode] = ClassDataCache[classindex][Class_ImmunityMode];
ClassPlayerCache[client][Class_ImmunityAmount] = ClassDataCache[classindex][Class_ImmunityAmount];
@ -905,7 +905,7 @@ bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIF
return false;
}
}
return true;
}
@ -918,21 +918,21 @@ bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIF
bool:ClassReloadPlayer(client)
{
new activeclass;
// Get active class index.
activeclass = ClassGetActiveIndex(client);
// Validate index.
if (activeclass < 0)
{
return false;
}
// Refresh cache and re-apply attributes.
ClassOnClientDeath(client); // Dummy event to clean up and turn off stuff.
ClassReloadPlayerCache(client, activeclass);
ClassApplyAttributes(client);
return true;
}
@ -964,7 +964,7 @@ ClassResetMultiplierCache()
ClassResetNextIndexes(client = -1)
{
new teamid;
if (client > 0)
{
for (teamid = 0; teamid < ZR_CLASS_TEAMCOUNT; teamid++)
@ -997,7 +997,7 @@ ClassRestoreNextIndexes(client, excludeTeam = -1)
new zombie = ClassSelectedNext[client][ZR_CLASS_TEAM_ZOMBIES];
new human = ClassSelectedNext[client][ZR_CLASS_TEAM_HUMANS];
new admin = ClassSelectedNext[client][ZR_CLASS_TEAM_ADMINS];
// Check if the zombie team should be excluded.
if (excludeTeam != ZR_CLASS_TEAM_ZOMBIES)
{
@ -1007,11 +1007,11 @@ ClassRestoreNextIndexes(client, excludeTeam = -1)
// Mark next zombie class as selected.
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = zombie;
}
// Reset index.
ClassSelectedNext[client][ZR_CLASS_TEAM_ZOMBIES] = -1;
}
// Check if the human team should be excluded.
if (excludeTeam != ZR_CLASS_TEAM_HUMANS)
{
@ -1021,11 +1021,11 @@ ClassRestoreNextIndexes(client, excludeTeam = -1)
// Mark next zombie class as selected.
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = human;
}
// Reset index.
ClassSelectedNext[client][ZR_CLASS_TEAM_HUMANS] = -1;
}
// Check if the human team should be excluded.
if (excludeTeam != ZR_CLASS_TEAM_ADMINS)
{
@ -1035,7 +1035,7 @@ ClassRestoreNextIndexes(client, excludeTeam = -1)
// Mark next zombie class as selected.
ClassSelected[client][ZR_CLASS_TEAM_ADMINS] = admin;
}
// Reset index.
ClassSelectedNext[client][ZR_CLASS_TEAM_ADMINS] = -1;
}
@ -1052,37 +1052,37 @@ ClassClientSetDefaultIndexes(client = -1)
new bool:clientvalid = ZRIsClientValid(client);
new filter[ClassFilter];
new bool:saveclasses = GetConVarBool(g_hCvarsList[CVAR_CLASSES_SAVE]);
new zombieindex;
new humanindex;
new adminindex;
new bool:haszombie;
new bool:hashuman;
new bool:hasadmin;
/*
* SETUP CLASS FILTER
*/
// Do not require any class flags to be set.
filter[ClassFilter_RequireFlags] = 0;
// Set filter to hide mother zombie classes.
filter[ClassFilter_DenyFlags] = ZR_CLASS_FLAG_MOTHER_ZOMBIE;
// Set filter to also hide admin-only classes if not admin.
filter[ClassFilter_DenyFlags] += !ZRIsClientAdmin(client) ? ZR_CLASS_FLAG_ADMIN_ONLY : 0;
// Specify client so it can check group permissions.
filter[ClassFilter_Client] = client;
/*
* GET CLASS INDEXES
*/
// Check if a client is specified.
if (clientvalid)
{
@ -1101,11 +1101,11 @@ ClassClientSetDefaultIndexes(client = -1)
humanindex = 0;
adminindex = 0;
}
// Note: When class indexes are set on cookies, they're incremented by
// one so zero means no class set and will result in a invalid
// class index when restored.
// Check if class indexes are set and that the client pass the filter.
// Also check that the saved class' team id match with the loaded class.
// If not, fall back to default class indexes. Otherwise substract
@ -1121,7 +1121,7 @@ ClassClientSetDefaultIndexes(client = -1)
zombieindex--;
haszombie = true;
}
if (humanindex <= 0 ||
!ClassTeamCompare(humanindex - 1, ZR_CLASS_TEAM_HUMANS) ||
!ClassFilterMatch(humanindex - 1, filter))
@ -1133,7 +1133,7 @@ ClassClientSetDefaultIndexes(client = -1)
humanindex--;
hashuman = true;
}
if (adminindex <= 0 ||
!ClassTeamCompare(adminindex - 1, ZR_CLASS_TEAM_ADMINS) ||
!ClassFilterMatch(adminindex - 1, filter))
@ -1150,14 +1150,14 @@ ClassClientSetDefaultIndexes(client = -1)
{
// Set filter to exclude classes that require groups.
filter[ClassFilter_Client] = -1;
// Get default class indexes.
zombieindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_ZOMBIES, filter);
humanindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_HUMANS, filter);
adminindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_ADMINS, filter);
}
/*
* VALIDATE INDEXES
*/
@ -1166,21 +1166,21 @@ ClassClientSetDefaultIndexes(client = -1)
// Invalid class index. Fall back to default class in class config and
// log a warning.
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Set Default Indexes", "Warning: Failed to get the specified 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, filter);
}
if (!ClassValidateIndex(humanindex))
{
// Invalid class index. Fall back to default class in class config and
// log a warning.
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Playerclasses, "Set Default Indexes", "Warning: Failed to get the specified 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, filter);
}
if (!ClassValidateIndex(adminindex))
{
// Invalid class index. Fall back to default class in class config if
@ -1188,12 +1188,12 @@ ClassClientSetDefaultIndexes(client = -1)
// no admin classes at all.
adminindex = ClassGetDefaultClass(ZR_CLASS_TEAM_ADMINS, filter);
}
/*
* MARK INDEXES AS SELECTED, UPDATE CACHE AND COOKIES
*/
// Check if a client is specified.
if (clientvalid)
{
@ -1201,10 +1201,10 @@ ClassClientSetDefaultIndexes(client = -1)
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = zombieindex;
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = humanindex;
ClassSelected[client][ZR_CLASS_TEAM_ADMINS] = adminindex;
// Copy human class data to player cache.
ClassReloadPlayerCache(client, humanindex);
// Save indexes in cookies if enabled, and not already saved.
if (saveclasses)
{
@ -1231,7 +1231,7 @@ ClassClientSetDefaultIndexes(client = -1)
ClassSelected[clientindex][ZR_CLASS_TEAM_ZOMBIES] = zombieindex;
ClassSelected[clientindex][ZR_CLASS_TEAM_HUMANS] = humanindex;
ClassSelected[clientindex][ZR_CLASS_TEAM_ADMINS] = adminindex;
// Copy human class data to player cache.
ClassReloadPlayerCache(client, humanindex);
}
@ -1261,7 +1261,7 @@ ClassSelectResult:ClassSelectClientClass(client, classIndex, bool:applyIfPossibl
new bool:iszombie = InfectIsClientInfected(client);
new teamid = ClassGetTeamID(classIndex, ZR_CLASS_CACHE_MODIFIED);
new ClassSelectResult:selectResult = ClassSelected_NoChange;
// Allow instant class change if enabled and both class and player is human.
if (applyIfPossible &&
ClassAllowInstantChange[client] &&
@ -1269,11 +1269,11 @@ ClassSelectResult:ClassSelectClientClass(client, classIndex, bool:applyIfPossibl
{
// Update selected class index.
ClassSelected[client][teamid] = classIndex;
// Update cache and apply attributes.
ClassReloadPlayerCache(client, classIndex);
ClassApplyAttributes(client);
selectResult = ClassSelected_Instant;
}
else
@ -1307,14 +1307,14 @@ ClassSelectResult:ClassSelectClientClass(client, classIndex, bool:applyIfPossibl
selectResult = ClassSelected_NextSpawn;
}
}
// Save selected class index in cookie if enabled.
// Note: Saved indexes are increased by one.
if (saveIfEnabled && GetConVarBool(g_hCvarsList[CVAR_CLASSES_SAVE]))
{
CookiesSetInt(client, g_hClassCookieClassSelected[teamid], classIndex + 1);
}
return selectResult;
}
@ -1337,123 +1337,123 @@ ClassDumpData(index, cachetype, String:buffer[], maxlen)
new cellcount;
decl String:attribute[320];
decl String:format_buffer[256];
if (maxlen == 0)
{
return 0;
}
Format(format_buffer, sizeof(format_buffer), "Class data at index %d:\n", index);
cellcount += StrCat(buffer, maxlen, format_buffer);
cellcount += StrCat(buffer, maxlen, "-------------------------------------------------------------------------------\n");
Format(attribute, sizeof(attribute), "enabled: \"%d\"\n", ClassIsEnabled(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "team: \"%d\"\n", ClassGetTeamID(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "team_default: \"%d\"\n", ClassGetTeamDefault(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "flags: \"%d\"\n", ClassGetFlags(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
ClassGetGroup(index, format_buffer, sizeof(format_buffer), cachetype);
Format(attribute, sizeof(attribute), "group: \"%s\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute);
ClassGetSM_Flags(index, format_buffer, sizeof(format_buffer), cachetype);
Format(attribute, sizeof(attribute), "sm_flags: \"%s\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute);
ClassGetName(index, format_buffer, sizeof(format_buffer), cachetype);
Format(attribute, sizeof(attribute), "name: \"%s\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute);
ClassGetDescription(index, format_buffer, sizeof(format_buffer), cachetype);
Format(attribute, sizeof(attribute), "description: \"%s\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute);
ClassGetModelPath(index, format_buffer, sizeof(format_buffer), cachetype);
Format(attribute, sizeof(attribute), "model_path: \"%s\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "model_skin_index: \"%d\"\n", ClassGetModelSkinIndex(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "alpha_initial: \"%d\"\n", ClassGetAlphaInitial(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "alpha_damaged: \"%d\"\n", ClassGetAlphaDamaged(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "alpha_damage: \"%d\"\n", ClassGetAlphaDamage(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
ClassGetOverlayPath(index, format_buffer, sizeof(format_buffer), cachetype);
Format(attribute, sizeof(attribute), "overlay_path: \"%s\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "nvgs: \"%d\"\n", ClassGetNvgs(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "fov: \"%d\"\n", ClassGetFOV(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "has_napalm: \"%d\"\n", ClassGetHasNapalm(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "napalm_time: \"%f\"\n", ClassGetNapalmTime(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
ImmunityModeToString(ClassGetImmunityMode(index, cachetype), format_buffer, sizeof(format_buffer));
Format(attribute, sizeof(attribute), "immunity_mode: \"%s\"\n", format_buffer);
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "immunity_amount: \"%d\"\n", ClassGetImmunityAmount(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "immunity_cooldown: \"%d\"\n", ClassGetImmunityCooldown(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "no_fall_damage: \"%d\"\n", ClassGetNoFallDamage(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "health: \"%d\"\n", ClassGetHealth(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "health_regen_interval: \"%f\"\n", ClassGetHealthRegenInterval(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "health_regen_amount: \"%d\"\n", ClassGetHealthRegenAmount(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "health_infect_gain: \"%d\"\n", ClassGetHealthInfectGain(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "kill_bonus: \"%d\"\n", ClassGetKillBonus(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "speed: \"%f\"\n", ClassGetSpeed(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "knockback: \"%f\"\n", ClassGetKnockback(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "jump_height: \"%f\"\n", ClassGetJumpHeight(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
Format(attribute, sizeof(attribute), "jump_distance: \"%f\"\n", ClassGetJumpDistance(index, cachetype));
cellcount += StrCat(buffer, maxlen, attribute);
return cellcount;
}
/**
* Converts a multiplier attribute to a human readable string.
*
* @param client The client index to translate correct language.
* @param client The client index to translate correct language.
* @param attribute Attribute to convert.
* @param buffer Destination string buffer.
* @param maxlen Size of buffer.
@ -1462,7 +1462,7 @@ ClassDumpData(index, cachetype, String:buffer[], maxlen)
ClassMultiplierToString(client, ClassMultipliers:attribute, String:buffer[], maxlen)
{
decl String:phrase[48];
SetGlobalTransTarget(client);
switch (attribute)
{
@ -1512,6 +1512,6 @@ ClassMultiplierToString(client, ClassMultipliers:attribute, String:buffer[], max
return strcopy(buffer, maxlen, phrase);
}
}
return 0;
}