Extended ZMarkets feature to include overwriting their current loadout with their current weapons, and viewing their custom loadout.

* Restructured ZMarkets menus.
This commit is contained in:
Greyscale
2009-06-18 20:41:54 -07:00
parent 424a852d3a
commit ed752979b8
4 changed files with 398 additions and 67 deletions

View File

@ -371,6 +371,32 @@ stock WeaponsNameToIndex(const String:weapon[])
return -1;
}
/**
* Takes a weapon's classname and returns the display name in weapons config file.
*
* @param
*/
stock WeaponsClassnameToDisplay(String:classname[], classnamemaxlen, String:display[], displaymaxlen)
{
// Strip off classnames' weapon prefix.
ReplaceString(classname, classnamemaxlen, "weapon_", "");
ReplaceString(classname, classnamemaxlen, "item_", "");
// Get the index of the weapon.
new weaponindex = WeaponsNameToIndex(classname);
// If weapon index is invalid, then return an empty string.
if (weaponindex == -1)
{
// Return an empty string.
strcopy(display, displaymaxlen, "");
return;
}
// Return the display name.
WeaponsGetName(weaponindex, display, displaymaxlen);
}
/**
* Checks if a weapon is valid. (E.G. listed in weapons.txt)
* @param weapon The weapon name.