Merge pull request #342 from Arkshine/feature/cs_get_item_alias

Add cs_get_item_alias(), improve cs_get_item_id() & cleanup alias datas
This commit is contained in:
Vincent Herbet
2016-03-16 15:15:00 +01:00
8 changed files with 165 additions and 233 deletions

View File

@ -361,7 +361,7 @@ native cs_set_user_plant(index, plant = 1, showbombicon = 1);
* @param index Client index
* @param team Team id
* @param model Internal model id, if CS_DONTCHANGE the game will choose the model
or if CS_NORESET the game will not update it.
* or if CS_NORESET the game will not update it.
* @param send_teaminfo If true, a TeamInfo message will be sent
*
* @noreturn
@ -1074,6 +1074,19 @@ native cs_set_ent_class(index, const classname[]);
*/
native any:cs_get_item_id(const name[], &CsWeaponClassType:classid = CS_WEAPONCLASS_NONE);
/**
* Returns the alias name associated with an item index.
*
* @param itemid Item id (CSI_* constants)
* @param name Buffer to store alias name to
* @param name_maxlen Maximum buffer size
* @param altname Optional buffer to store if available alternative alias name to
* @param altname_maxlen Maximum buffer size
*
* @return True if alias is found, false otherwise
*/
native bool:cs_get_item_alias(itemid, name[], name_maxlen, altname[] = "", altname_maxlen = 0);
/**
* Returns an item name associated with a command alias.
*

View File

@ -21,6 +21,7 @@
*/
#define CSW_NONE 0
#define CSW_P228 1
#define CSW_GLOCK 2 // Unused by game, See CSW_GLOCK18.
#define CSW_SCOUT 3
#define CSW_HEGRENADE 4
#define CSW_XM1014 5
@ -147,6 +148,7 @@ enum
*/
#define CSI_NONE CSW_NONE
#define CSI_P228 CSW_P228
#define CSI_GLOCK CSW_GLOCK // Unused by game, See CSI_GLOCK18.
#define CSI_SCOUT CSW_SCOUT
#define CSI_HEGRENADE CSW_HEGRENADE
#define CSI_XM1014 CSW_XM1014