Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Limit Number of Owned Pets Specific Level (http://www.mysidiaadoptables.com/forum/showthread.php?t=4950)

Abronsyth 12-22-2015 05:45 PM

Limit Number of Owned Pets Specific Level
 
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

PHP Code:

$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.


All times are GMT -5. The time now is 03:08 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.