Getting Started (for Developers) - nosoop/SM-TFCustomWeaponsX GitHub Wiki
Since developers' needs vary, there isn't really any one-guide-fits-all for them.
Natives
Entity
CWX_GetItemUIDFromEntityreturns the custom item UID attached to an weapon / wearable, if one exists. (It does not check the UID for validity.)CWX_EquipPlayerItemimmediately spawns and equips the given item UID.- ⚠️ This functionality is not intended for production use. Use
CWX_SetPlayerLoadoutItemand regenerate the player instead.
- ⚠️ This functionality is not intended for production use. Use
Inventory
CWX_GetPlayerLoadoutItemreturns the UID located in the given player's inventory for the specified class / loadout slot.CWX_SetPlayerLoadoutItemadds the item with the given UID to the player's inventory.- If
LOADOUT_FLAG_UPDATE_BACKENDis not present, the loadout item is applied temporarily — it will not replace any item the player has selected themselves.
- If
CWX_RemovePlayerLoadoutItemclears out any existing UID on a player's inventory, restoring it to default.CWX_CanPlayerAccessItemreturns whether or not the given client is allowed to access the specified item UID. This only checks for access restrictions based on theaccessitem key.
Schema
CWX_GetItemListreturns anArrayListcontaining all valid item UIDs.CWX_IsItemUIDValidchecks if the given item UID is valid.CWX_GetItemLoadoutSlotreturns the loadout slot that the custom item definition is assigned to for a given class.CWX_GetItemExtDatareturns the extended data subsection for a custom item definition by name, if one exists. (You do not have to check the UID for validity.)- For an example, see its usage in CW3toX.
Item information: CWX module vs attribute
If it needs to be tied to a custom item definition and can't be used outside of CWX, it should be a module. Examples include:
- Item descriptions
- Defining resources to precache / mark for download
Otherwise, writing something as an attribute provides far greater flexibility.