By a copy and paste you'll be able to check for the pokemon type before applying hail and sandstorm damages.
Hail damages are Ice type.
Sandstorm damages are Ground type.
So, let's go !
In pokebattle_battle, locate this part of the code:
pbCommonAnimation("Rain",nil,nil)
# pbDisplay(_INTL("Rain continues to fall."))
end
Just after this, you have the case
when PBWeather::SANDSTORM
Select the whole code, so, until just before the When...