So far I have this, and it's working:
PHP Code:
enum TFiaSlotType
{
TFia_Slot_unknown=0, // items will never be put in this category, but it may have uses
TFia_Slot_head, // this is the most important item class, so it comes first :)
TFia_Slot_misc,
TFia_Slot_action,
TFia_Slot_primary,
TFia_Slot_secondary,
TFia_Slot_melee,
TFia_Slot_building,
TFia_Slot_pda,
TFia_Slot_pda2,
TFia_Slot_wearable, // items will never be put in this category, but it may overriden to this category (ItemsApi_GetSlotEx)
};
/**
* Returns true if the items schema is cached and available
*
**/
native bool:ItemsApi_Ready();
/**
* Returns the item equip slot of an item, unknown on failure
*
* @param num1 An Item Definition Index
**/
native TFiaSlotType:ItemsApi_GetSlot(index);
/**
* Returns the item equip slot of an item, unknown on failure
* Use this to filter out "tf_wearable" items which may be returned as weapons otherwise (items like the razorback or buff banner)
*
* @param num1 An Item Definition Index
* @param num2 A TFiaSlotType to override the return slot index if it is a "tf_werable" but not a TFia_Slot_head or TFia_Slot_misc type (usually a weapon wearable)
**/
native TFiaSlotType:ItemsApi_GetSlotEx(index, TFiaSlotType:weapon_wearable = TFia_Slot_wearable);
/**
* Returns true if an item is paintable
*
* @param num1 An Item Definition Index
**/
native bool:ItemsApi_Paintable(index);
/**
* Returns true if an item is wearable (tf_wearable)
*
* @param num1 An Item Definition Index
**/
native bool:ItemsApi_Wearable(index);
/**
* Returns length of string written to buffer, 0 on failure.
*
* @param num1 An Item Definition Index
* @param num2 buffer to write item name.
**/
native ItemsApi_GetName(index, String:name[]);
there are however, still a few bugs to work out.
this should be better....
Edit. This idea moved here
https://forums.alliedmods.net/showthread.php?t=216573
__________________