Like speed, you can set a custom gravity too. 1.0 is normal. If you set an entity's gravity to 0.0, it will never fall.
But you don't need to make a custom function for this, SourceMod already had one.
PHP Code:
public OnWeaponSwitchPost(client, weapon)
{
new String:weapon[24]
GetClientWeapon(client,weapon,24)
if (StrEqual(weapon,"weapon_knife"))
{
SetClientSpeed(client,speed)
SetClientGravity(client,gravity)//<----set gravity here
}
else
{
SetClientSpeed(client,1.0)
SetClientGravity(client,1.0)//<----set to default too
}
}