I do not know if Ash has already made methodmaps for tf2items but here's a custom made one since tf2items utilizes handles
PHP Code:
methodmap TF2Item < Handle
{
// C O N S T R U C T O R ===============================================================
public TF2Item(int iFlags)
{
return view_as<TF2Item>( TF2Items_CreateItem(iFlags) );
}
// =====================================================================================
// P R O P E R T I E S =================================================================
property int Flags
{
public get() { return TF2Items_GetFlags(this); }
public set( int iFlags ) { TF2Items_SetFlags(this, iFlags); }
}
property int ItemIndex
{
public get() {return TF2Items_GetItemIndex(this);}
public set( int iItemDefIndex ) {TF2Items_SetItemIndex(this, iItemDefIndex);}
}
property int Quality
{
public get() {return TF2Items_GetQuality(this);}
public set( int iEntityQuality ) {TF2Items_SetQuality(this, iEntityQuality);}
}
property int Level
{
public get() {return TF2Items_GetLevel(this);}
public set( int iEntityLevel ) {TF2Items_SetLevel(this, iEntityLevel);}
}
property int NumAttribs
{
public get() {return TF2Items_GetNumAttributes(this);}
public set( int iNumAttributes ) {TF2Items_SetNumAttributes(this, iNumAttributes);}
}
//=======================================================================================
public int GiveNamedItem(int iClient)
{
return TF2Items_GiveNamedItem(iClient, this);
}
public void SetClassname(char[] strClassName)
{
TF2Items_SetClassname(this, strClassName);
}
public void GetClassname(char[] strDest, int iDestSize)
{
TF2Items_GetClassname(this, strDest, iDestSize);
}
public void SetAttribute(int iSlotIndex, int iAttribDefIndex, float flValue)
{
TF2Items_SetAttribute(this, iSlotIndex, iAttribDefIndex, flValue);
}
public int GetAttribID(int iSlotIndex)
{
return TF2Items_GetAttributeId(this, iSlotIndex);
}
public float GetAttribValue(int iSlotIndex)
{
return TF2Items_GetAttributeValue(this, iSlotIndex);
}
};
How to use!
PHP Code:
TF2Item hWep = new TF2Item(OVERRIDE_ALL|PRESERVE_ATTRIBUTES|FORCE_GENERATION);
hWep.SetClassname("tf_weapon_example");
hWep.Quality = 6;
hWep.Level = 1;
hWep.NumAttribs = 0;
delete hWep;
__________________