View Single Post
  #3  
Old 04-16-2015, 09:34 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,316
Kyttias is on a distinguished road
Default

Alright, inside adoptview.php, find this function:

PHP Code:
if($mysidia->input->post("submit")){ 
     
/* The current contents of this function... */ 

You'll be placing the current contents of this function inside an else statement.

PHP Code:
if($mysidia->input->post("submit")){
    
$number 5/* You want users to have no more than THIS ($number) many pets with...*/
    
$level 6/* ...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 Eggs!");
        
$document->add(new Comment("You've got too many eggs and should wait until you've hatched one."FALSE));
    }
    else { 
        
/* Else show the previously existing contents of input->post("submit") and let users adopt things... */            
    
}

Try this for me and see if it works as intended? Make sure the old contents of the function get pasted inside the else statement.

When a person goes to try to adopt a new pet now, the error will display instead.

However, the bottom of this file also contains the button that will send the form. You might consider wrapping it in an if statement and removing access to it entirely when the user has too many low level pets/eggs and replacing it with a memo instructing them to go level things up instead.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 04-16-2015 at 09:38 PM.
Reply With Quote