I would add a new column to the owned_adoptables table in phpMyAdmin and call it something like "timestrained," with the default set to 0. Then each time that pet is trained add +1 to that column...then just include an if/else statement to exclude any pets that have been trained 5 times. So...something like...
Add this under the list of defined variables for training:
PHP Code:
$trained = $favpet->timestrained;
$total = $trained + 1;
And then at the end of each training type (before the break;):
PHP Code:
$mysidia->db->update("owned_adoptables", array("timestrained" => $total), "aid='{$profile->getFavpetID()}'");
Before the
if($favpet->currentlevel = 3) add this;
PHP Code:
if($favpet->timestrained = 5){
$document->add(new Comment("This pet has maxed out its allowed training sessions! It can no longer be trained.", FALSE));
}
else{...}
With the {...} containing all of the training stuff.
Let me know if that makes sense/works out!