PDA

View Full Version : Limit Number of Owned Pets Specific Level


Abronsyth
12-22-2015, 05:45 PM
Hello all!

I was wondering if anyone knows how to go about making it so I can limit the number of adopts a user has at each level?

So that way I could make it so each user is only allowed, say, 25 level 0 pets at a time, and cannot have more until theirs grow (and if they try to adopt too many they get an error page saying simply; "Sorry, you already have [25] level 0 pets. Let yours grow before you get more!").

Thanks,
Abron/Pero

Distortion
12-22-2015, 05:51 PM
$number = 3; /* You want users to have no more than THIS ($number) many pets with...*/
$level = 5; /* ...a level less than or equal to THIS ($level) number! */
$petsAtLevel = $mysidia->db->select("owned_adoptables", array(), "owner = '{$mysidia->user->username}' AND currentlevel <= $level")->rowCount();
if ($petsAtLevel > $number){ /* If the number of pets at this level is greater than number... */
$document->setTitle("Too Many Nibi");
$document->add(new Comment("You have too many nibi that are still forming. Come back when one has already formed.", FALSE));
}
else { /* Else show existing things... */
........

I've only tested this for the adoptview file, but I do not know about explore, shop, and promo adopts.