Try RegConsoleCmd of a test command of each piece individually.
I have seen some games/mods that don't handle EquipPlayerWeapon correctly and crash most of the time. Then in some cases, RemovePlayerItem can also crash. I am not sure what is in RemoveAllWeapons(int client) but if that is what is causing the crash, you could try the m_hMyWeapons offs with something like this:
Code:
void RemoveAllWeapons(int client)
{
if ((!IsValidEntity(client)) || (client == 0)) return;
//Separated check or may cause errors if any above are passed
if (!IsPlayerAlive(client)) return;
int WeapList = FindSendPropInfo("CBasePlayer", "m_hMyWeapons");
if (WeapList != -1)
{
if (HasEntProp(client,Prop_Data,"m_hViewModel"))
{
int viewmdl = GetEntPropEnt(client,Prop_Data,"m_hViewModel");
if (viewmdl != -1)
{
SetEntProp(viewmdl,Prop_Send,"m_fEffects",32);
}
}
for (int j; j<104; j += 4)
{
int itmp = GetEntDataEnt2(client,WeapList + j);
if (itmp != -1)
{
if (IsValidEntity(itmp))
{
AcceptEntityInput(itmp,"kill");
}
}
}
}
return;
}
If it is the EquipPlayerWeapon that is crashing, then depending on the game, you could try a
ClientCommand("use %s",weaponclass);
If ClientCommand is blocked in the game, then you could try setting all the properties required to force equip an item through m_hActiveWeapon on client, m_hWeapon on m_hViewModel from client. Then check the m_fFlags, m_fEffects on each to match an equipped weapon.