I made some modifications to the ConnorMCLeod (ham_strip_weapon) code, but the code is not functioning properly. Any ideas?
Code:
stock const m_rgpPlayerItems_CBasePlayer[6] = { 367, 368, ... }
new const SLOTID[] = {
-1, // CSW_NONE
2, // CSW_P228
-1, // CSW_GLOCK
1, // CSW_SCOUT
4, // CSW_HEGRENADE
1, // CSW_XM1014
5, // CSW_C4
1, // CSW_MAC10
1, // CSW_AUG
4, // CSW_SMOKEGRENADE
2, // CSW_ELITE
2, // CSW_FIVESEVEN
1, // CSW_UMP45
1, // CSW_SG550
1, // CSW_GALIL / CSW_GALI
1, // CSW_FAMAS
2, // CSW_USP
2, // CSW_GLOCK18
1, // CSW_AWP
1, // CSW_MP5NAVY
1, // CSW_M249
1, // CSW_M3
1, // CSW_M4A1
1, // CSW_TMP
1, // CSW_G3SG1
4, // CSW_FLASHBANG
2, // CSW_DEAGLE
1, // CSW_SG552
1, // CSW_AK47
3, // CSW_KNIFE
1 // CSW_P90
}
strip_items_by_slot(const id, const slot)
{
new weapon, current_weapon, weapon_id
current_weapon = cs_get_user_weapon_entity(id)
while ((weapon = get_pdata_cbase(id, m_rgpPlayerItems_CBasePlayer[slot])) > 0)
{
if (current_weapon == weapon)
ExecuteHamB(Ham_Weapon_RetireWeapon, weapon)
if (ExecuteHamB(Ham_RemovePlayerItem, id, weapon))
{
user_has_weapon(id, weapon_id, 0)
ExecuteHamB(Ham_Item_Kill, weapon)
}
}
return 1;
}
drop_items_by_slot(const id, const slot)
{
new weapon, weapon_id, weapon_name[32]
while ((weapon = get_pdata_cbase(id, m_rgpPlayerItems_CBasePlayer[slot])) > 0)
{
weapon_id = cs_get_weapon_id(weapon)
get_weaponname(weapon_id, weapon_name, charsmax(weapon_name))
engclient_cmd(id, "drop", weapon_name)
user_has_weapon(id, weapon_id, 0)
}
return 1;
}