A much better method would be to alter the pev_weapons variable. Use the following stock to "remove" the weapons from the variable:
Code:
stock remove_weapon( id, wpnid ) {
new m_bitmask = pev( id, pev_weapons );
m_bitmask &= ~(1<<wpnid);
set_pev( id, pev_weapons, m_bitmask );
}
For what you want to do, however, since all you want is a knife for any class, I would alter the pev_weapons bitmask to only include DODW_AMERKNIFE (if british or american) or DODW_GERKNIFE / DODW_SPADE (if axis) and simply set the variable to that bitmask.
This way you won't have to worry about sending client commands and switching weapons and risking a "reach-around" - it prevents the client from pulling out the weapon in the first place.
For a very basic example:
Code:
stock allow_weapon( id, wpnid ) {
new m_bitmask &= (1<<wpnid);
set_pev( id, pev_weapons, m_bitmask );
}
Then allow_weapon( id, DODW_AMERKNIFE ) if the player is allies, etc.
__________________