What code, if any, can I use to properly set the quality name on a weapon?
If I use the code below the correct quality color is properly displayed when you view the item. However, the quality label such as vintage, genuine, unusual, self-made will not be displayed.
PHP Code:
bool CreateWeapon(int client, char[] classname, int itemindex, int quality, int level = 0)
{
int weapon = CreateEntityByName(classname);
if (!IsValidEntity(weapon))
{
return false;
}
char entclass[64];
GetEntityNetClass(weapon, entclass, sizeof(entclass));
SetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex", itemindex);
SetEntProp(weapon, Prop_Send, "m_bInitialized", 1);
SetEntData(weapon, FindSendPropInfo(entclass, "m_iEntityQuality"), quality);
SetEntProp(weapon, Prop_Send, "m_iEntityLevel", level);
DispatchSpawn(weapon);
EquipPlayerWeapon(client, weapon);
return true;
}
Quality Numbers and Colors (borrowed from TF2Items post):
http://imgur.com/53erbdK
For example, let's suppose I use the code above to create a weapon with quality of '11' which is 'Strange' quality. When that weapon is viewed the weapon name will appear with an orange color (which is Strange quality) but the word 'Strange' will be missing in the weapon name.