[HAMSANDWICH] Bad arg count. Expected 3, got 2.
That's the runtime error i got (WIN32, listenserver).
My code :
Code:
ExecuteHam(Ham_Item_Holster, pActiveItem)
HLSDK code :
Code:
m_pActiveItem->Holster( );
ham_const description :
Code:
/**
* Description: Whether or not the entity (usually weapon) can be holstered.
* Forward params: function(this)
* Return type: Integer (boolean).
* Execute params: ExecuteHam(Ham_Item_Holster, this);
*/
Ham_Item_Holster,
hamdata.ini is default one, last amxx release.
Any idea ? hamdata.ini would be false for win32 ? listenserver related ?
If someone wnat to try out the code :
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Strip"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"
//#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))
const MAX_ITEM_TYPES = 6
const MAX_AMMO_SLOTS = 14 // real is 32 but cs uses only 14
const m_rgpPlayerItems_Slot0 = 367
const m_pActiveItem = 373
const m_pLastItem = 375
const m_rgAmmo_Slot0 = 376
const EXTRAOFFSET_WEAPONS = 4
const m_pNext = 42
new gmsgCurWeapon
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
gmsgCurWeapon = get_user_msgid("CurWeapon")
register_clcmd("drop", "drop")
}
public drop( id )
{
RemoveAllItems(id)
return PLUGIN_HANDLED
}
RemoveAllItems(id/*, bool: removeSuit*/)
{
new pActiveItem = get_pdata_cbase(id, m_pActiveItem)
if(pActiveItem > 0)
{
ExecuteHam(Ham_Item_Holster, pActiveItem)
set_pdata_cbase(id, m_pActiveItem, -1)
}
set_pdata_cbase(id, m_pLastItem, -1)
//set_pdata_int(id, m_pLastItem, 0) ?
new rgpPlayerItems, pPendingItem;
for(rgpPlayerItems = m_rgpPlayerItems_Slot0; rgpPlayerItems < m_rgpPlayerItems_Slot0 + MAX_ITEM_TYPES; rgpPlayerItems++)
{
pActiveItem = get_pdata_cbase(id, rgpPlayerItems)
while(pActiveItem)
{
pPendingItem = get_pdata_cbase(pActiveItem, m_pNext, EXTRAOFFSET_WEAPONS)
ExecuteHam(Ham_Item_Drop, pActiveItem)
pActiveItem = pPendingItem
}
set_pdata_cbase(id, rgpPlayerItems, -1)
}
//m_pActiveItem = NULL;
set_pev(id, pev_viewmodel, 0)
set_pev(id, pev_weaponmodel, 0)
/* if ( removeSuit )
{
*/ set_pev(id, pev_weapons, 0)
/* }
else
{
set_pev(id, pev_weapons, pev(id, pev_weapons) & ~WEAPON_ALLWEAPONS)
}
*/
for(new m_rgAmmo = m_rgAmmo_Slot0; m_rgAmmo < m_rgAmmo_Slot0 + MAX_AMMO_SLOTS; m_rgAmmo++)
{
set_pdata_int(id, m_rgAmmo, 0)
}
// ExecuteHamB(Ham_Player_UpdateClientData, id) // crash ?
dllfunc(DLLFunc_UpdateClientData, id)
message_begin(MSG_ONE_UNRELIABLE, gmsgCurWeapon, _, id)
write_byte(0)
write_byte(0)
write_byte(0)
message_end()
}
__________________