What you need is a global var (array[33]) where you can store players custom speed, and if array[id] is different from 0 when CurWeapon is fired, set maxspeed to array[id].
Better would be to also filter CurWeapon to execute code only at weapon change.