Merged heads. Fixed conflicts in cvars.inc and zadmin.inc.

Readded some functions in zadmin.inc, but made them as comments. No reason to remove these so we don't have to remake them again.
This commit is contained in:
richard
2009-05-30 04:42:23 +02:00
44 changed files with 2843 additions and 2585 deletions

View File

@ -71,8 +71,8 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
if (strcmp(modelpath, "random", false) == 0)
{
// TODO: Make a function that gets a random model from the specified team.
new randmodel = GetRandomInt(0, GetArraySize(arrayModelsList) - 1);
GetArrayString(arrayModelsList, randmodel, modelpath, sizeof(modelpath));
new randmodel = GetRandomInt(0, GetArraySize(arrayModels) - 1);
GetArrayString(arrayModels, randmodel, modelpath, sizeof(modelpath));
Format(modelpath, sizeof(modelpath), "%s.mdl", modelpath);
}

View File

@ -9,10 +9,30 @@
* ============================================================================
*/
ClassOnCommandsCreate()
{
// Create base class commands.
RegConsoleCmd("zr_class_dump", ClassDumpCommand, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump <cachetype> <index|targetname>");
RegAdminCmd("zr_class_modify", ClassModifyCommand, ADMFLAG_GENERIC, "Modify class data on one or more classes. Usage: zr_class_modify <classname|\"zombies\"|\"humans\"|\"admins\"> <attribute> <value> [is_multiplier]");
}
/**
* Dumps class data at a specified index in the specified cache.
* Hook commands related to classes here.
*/
public Action:Command_ClassDump(client, argc)
ClassOnCommandsHook()
{
// Forward event to sub-modules.
ClassOverlayOnCommandsHook();
}
/**
* Command callback. (zr_class_dump)
* Dumps class data at a specified index in the specified cache.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ClassDumpCommand(client, argc)
{
decl String:syntax[1024];
syntax[0] = 0;
@ -124,7 +144,7 @@ public Action:Command_ClassDump(client, argc)
* Note: Original values are retrieved from the original class cache, not the
* modified class cache.
*/
public Action:Command_ClassModify(client, argc)
public Action:ClassModifyCommand(client, argc)
{
decl String:syntax[1024];
syntax[0] = 0;
@ -335,7 +355,7 @@ public Action:Command_ClassModify(client, argc)
* @param value New value to set.
* @return True on success, false otherwise.
*/
bool:ClassModifyBoolean(classindex, attributeflag, bool:value)
stock bool:ClassModifyBoolean(classindex, attributeflag, bool:value)
{
// Validate class index.
if (!ClassValidateIndex(classindex))
@ -378,7 +398,7 @@ bool:ClassModifyBoolean(classindex, attributeflag, bool:value)
* disable. Value is ignored if this is non-zero.
* @return True on success, false otherwise.
*/
ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.0)
stock ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.0)
{
// Validate class index.
if (!ClassValidateIndex(classindex))
@ -481,7 +501,7 @@ ClassModifyInteger(classindex, attributeflag, value, Float:multiplier = 0.0)
* Not all attributes support multipliers.
* @return True on success, false otherwise.
*/
ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier = false)
stock ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier = false)
{
// Validate class index.
if (!ClassValidateIndex(classindex))
@ -568,7 +588,7 @@ ClassModifyFloat(classindex, attributeflag, Float:value, bool:ismultiplier = fal
* @param value New value to set.
* @return True on success, false otherwise.
*/
ClassModifyString(classindex, attributeflag, const String:value[])
stock ClassModifyString(classindex, attributeflag, const String:value[])
{
// Validate class index.
if (!ClassValidateIndex(classindex))

View File

@ -34,15 +34,6 @@ ClassClientInit(client)
ClassOverlayClientInit(client);
}
/**
* Hook commands related to classes here.
*/
ClassOnCommandsHook()
{
// Forward event to sub-modules.
ClassOverlayOnCommandsHook();
}
/**
* Called when all modules are done loading.
*/
@ -108,7 +99,6 @@ ClassOnClientSpawn(client)
// Check if the player should spawn in admin mode.
if (ClassPlayerAdminMode[client])
{
// Mark player as in admin mode.
ClassPlayerInAdminMode[client] = true;
@ -137,11 +127,11 @@ ClassOnClientDeath(client)
// Disable class attributes with timers.
ClassHealthRegenStop(client);
// Disable overlay.
OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, false, true);
// Set client's FOV back to normal.
ToolsSetClientDefaultFOV(client, 90);
// Forward event to sub-modules.
ClassOverlayOnClientDeath(client);
}
ClassOnClientInfected(client, bool:motherzombie = false)

View File

@ -209,14 +209,6 @@ ClassMenuSelect(client, teamid)
AddMenuItem(menu, classname, menuitem);
}
}
else
{
// No classes found. Display message. The main class menu should
// prevent this from happening, but we print a message just in case.
// THIS TRANSLATION PHRASES IS NOT IN FILE.
Format(menuitem, sizeof(menuitem), "%t\n", "Classes menu not found");
AddMenuItem(menu, classname, menuitem, ITEMDRAW_RAWLINE);
}
SetMenuExitBackButton(menu, true);
DisplayMenu(menu, client, MENU_TIME_FOREVER);

View File

@ -54,7 +54,7 @@ ClassOverlayOnCommandsHook()
// Explode string into array indexes.
new cmdcount = ExplodeString(togglecmds, ", ", arrayCmds, CLASSOVERLAY_TOGGLE_MAX_CMDS, CLASSOVERLAY_TOGGLE_MAX_LENGTH);
// x = array index.
// x = Array index.
// arrayCmds[x] = suicide command.
for (new x = 0; x <= cmdcount - 1; x++)
{
@ -83,6 +83,20 @@ ClassOverlayOnClientSpawn(client)
TranslationPrintHUDText(client, "Classes overlay toggle", togglecmds);
}
// Update class overlay.
OverlaysClientUpdateOverlay(client, OVERLAYS_CHANNEL_CLASSES);
}
/**
* Client has been killed.
*
* @param client The client index.
*/
ClassOverlayOnClientDeath(client)
{
// Disable overlay.
OverlaysClientSetChannelState(client, OVERLAYS_CHANNEL_CLASSES, true, false, false, true);
}
/**
@ -127,7 +141,7 @@ ClassOverlayInitialize(client, const String:overlay[])
}
/**
* Command callback (See zr_classes_overlay_togglecmds)
* Command callback. (See zr_classes_overlay_togglecmds)
* Toggles nightvision of a client.
*
* @param client The client index.

View File

@ -252,9 +252,8 @@ enum ClassDataTypes
/**
* Keyvalue handle to store class data.
*
* @redir config.inc
*/
new Handle:kvClassData = INVALID_HANDLE;
/**
* The original class data. This array only changed when class data is loaded.
@ -322,20 +321,20 @@ new ClassPlayerNextAdminClass[MAXPLAYERS + 1];
*/
ClassLoad()
{
// Register config file.
ConfigRegisterConfig(File_Classes, Structure_Keyvalue, CONFIG_FILE_ALIAS_CLASSES);
// Make sure kvClassData is ready to use.
if (kvClassData != INVALID_HANDLE)
{
CloseHandle(kvClassData);
}
kvClassData = CreateKeyValues("classes");
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);
// Register config info.
ConfigRegisterConfig(ConfigClasses, false, GetFunctionByName(GetMyHandle(), "ClassOnConfigReload"), _, pathclasses, CONFIG_FILE_ALIAS_CLASSES);
// If file doesn't exist, then log and stop.
if (!exists)
{
@ -463,8 +462,10 @@ ClassLoad()
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Classes", "Config Validation", "Total: %d | Successful: %d | Unsuccessful: %d", ClassCount, ClassCount - failedcount, failedcount);
// Set config data.
ConfigSetConfigLoaded(ConfigClasses, true);
ConfigSetConfigHandle(ConfigClasses, kvClassData);
ConfigSetConfigLoaded(File_Classes, true);
ConfigSetConfigReloadFunc(File_Classes, GetFunctionByName(GetMyHandle(), "ClassOnConfigReload"));
// ConfigSetConfigHandle(File_Classes, INVALID_HANDLE);
ConfigSetConfigPath(File_Classes, pathclasses);
}
/**
@ -475,9 +476,6 @@ ClassLoad()
public ClassOnConfigReload(ConfigFile:config)
{
// Reload class config.
if (config == ConfigClasses)
{
}
}
/**