if (gamestate.chosenweapon==wp_pistol && bestweapon>=wp_pistol2)
{
gamestate.chosenweapon=wp_pistol2;
InClearKeysDown();
}
else if (gamestate.chosenweapon==wp_pistol2)
{
gamestate.chosenweapon=wp_pistol1;
InClearKeysDown();
}
I haven't tried this, but it should work. Flamer46 posted a more complicated tutorial, but it is big and memory straining.