You would probably just use a custom IF statement around the confirm button like:
<?php
if ($eCart1->TotalColumn("TotalPrice")) > 24 && ($_SESSION['ShippingState'] == "AK" || $_SESSION['ShippingState'] == "HI")) {
?>
You can't order more than 24 items shipped to Hawaii or Alaska
<?php } else { ?>
<input type="submit" .... //confirm button here
<?php
}
?>
(of course use your cart name and the correct session variable names based on the version of eCart you are using)