add "identifier" to playerclasses (kv section name) and use it as default for cookies, zr_class_modify, etc.

This commit is contained in:
2019-11-01 16:17:50 +01:00
parent a7caf1de7b
commit 7265c1922f
11 changed files with 342 additions and 107 deletions

View File

@ -33,6 +33,41 @@
* ------------------------------------
*/
/**
* Gets the class identifier (config class section name).
*
* @param index Index of the class in a class cache or a client index,
* depending on the cache type specified.
* @param buffer The destination string buffer.
* @param maxlen The length of the destination string buffer.
* @param cachetype Optional. Specifies what class cache to read from. Options:
* ZR_CLASS_CACHE_ORIGINAL - Unchanced class data.
* ZR_CLASS_CACHE_MODIFIED - Changed/newest class data.
* ZR_CLASS_CACHE_PLAYER (default) - Player cache. If this one
* is used, index will be used as a client index.
* @return Number of cells written. -1 on error.
*/
stock ClassGetIdentifier(index, String:buffer[], maxlen, cachetype = ZR_CLASS_CACHE_PLAYER)
{
switch (cachetype)
{
case ZR_CLASS_CACHE_ORIGINAL:
{
return strcopy(buffer, maxlen, ClassData[index][Class_Identifier]);
}
case ZR_CLASS_CACHE_MODIFIED:
{
return strcopy(buffer, maxlen, ClassDataCache[index][Class_Identifier]);
}
case ZR_CLASS_CACHE_PLAYER:
{
return strcopy(buffer, maxlen, ClassPlayerCache[index][Class_Identifier]);
}
}
return -1;
}
/**
* Checks if the specified class is enabled.
*
@ -1401,7 +1436,8 @@ stock ClassDataTypes:ClassGetAttributeType(attributeflag)
}
// String.
case ZR_CLASS_GROUP,
case ZR_CLASS_IDENTIFIER,
ZR_CLASS_GROUP,
ZR_CLASS_NAME,
ZR_CLASS_DESCRIPTION,
ZR_CLASS_MODEL_PATH,