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)
-   -   I love questions =) (http://www.mysidiaadoptables.com/forum/showthread.php?t=2351)

SilverDragonTears 08-28-2011 12:13 AM

I love questions =)
 
I wanted to disallow leveling up adults (increasing their clicks)

so I found this:

Code:

       
        // Now we see if the adoptable is frozen by its owner.  If it is, we do not level...

        if($isfrozen == "yes"){

        $article_title = $lang_isfrozen_title;
        $article_content = $lang_isfrozen_explain;

        }

And after it added this:

Code:

        // Now we see if the adoptable is an adult.  If it is, we do not level...

        if($currentlevel == "5"){

        $article_content = "Adults can not be leveled up!";

        }

It works but how do I disallow getting coins for clicking it?

Hall of Famer 08-28-2011 12:18 AM

Well find these lines in your levelup.php:

PHP Code:

    if($isfrozen == "no"){   
    
changecash(grabanysetting('rewardmoney'), $GLOBALS['username'], $GLOBALS['money']);
    
$article_content $article_content "<div align='center'><br />You have earned "grabanysetting('rewardmoney') ." "grabanysetting('cost') ." for leveling up this adoptable. <br />You now have {$GLOBALS['money']} ".grabanysetting('cost')."</div>";
    } 

Replace with:(assuming the maximum level on your site is 5, as inferred from your script)
PHP Code:

    if($isfrozen == "no" and $currentlevel <5){   
    
changecash(grabanysetting('rewardmoney'), $GLOBALS['username'], $GLOBALS['money']);
    
$article_content $article_content "<div  align='center'><br />You have earned ".  grabanysetting('rewardmoney') ." "grabanysetting('cost') ." for  leveling up this adoptable. <br />You now have {$GLOBALS['money']}  ".grabanysetting('cost')."</div>";
    } 

Give a try on your site and see if it works.

Hall of Famer

SilverDragonTears 08-28-2011 12:22 AM

wonderful!!! *more cookies for you* need some milk?

Hall of Famer 08-28-2011 12:24 AM

Well this is up to you. XD

Did you try the code on Silvadopts? Lemme know if you have more questions regarding customizing your site.

SilverDragonTears 08-28-2011 12:29 AM

Yep, it worked perfect! That's why I gave you cookies!! I do have another question but maybe more complicated. I want to show a link that will list all the children an adopt has had. How difficult would this be?

Hall of Famer 08-28-2011 12:34 AM

Oh I see, I am glad it works for ya.

Well its not really complicated, are you using Arianna's family tree script? As I've said before, that one is not compatible with Mys v1.2.x, but perhaps you've got it to work. If so, you will find the two columns 'father' and 'mother' in prefix.ownedadoptables table. What you should do is to make a PHP table that retrieves data from all rows of child adoptables whose father(if the gender is male) or mother(if the gender is female) is very parent adoptable you have selected.

If you do not use Arianna's family tree script, then create two columns 'father' and 'mother' in table prefix.owned_adoptables and repeat the same procedure as mentioned above.

SilverDragonTears 08-28-2011 12:38 AM

Yes I'm using her script and it's working wonderfully(after tweaking some things) however, my coding is still not advanced so... err.. can you show me? I learn better seeing it. It's hard to follow how to do it all myself.

Hall of Famer 08-28-2011 01:11 AM

Alright I will show you. But since I am not that familiar with Arianna's family tree script, what I provide below should NOT be directly copy/pasted to your site. It merely serves as a reference, especially since I do not know exactly what your database owned_adoptables looks like and what mysql command you uses to retrieve data.

First of all, you need to retrieve the gender of your parent adoptable. The parentid should be available to you already, and I strongly advise you to name it $parentid to avoid confusion. Write the codes below:

PHP Code:

$result runquery("SELECT * FROM {$prefix}owned_adoptables WHERE aid = '{$parentid}'") ;
$row mysql_fetch_array($result);
$gender $row['gender']; 

Next, you will need to select from database prefix.owned_adoptables for all child adoptables with the very parent. This may vary depends on if the parent adoptable is male or female, as shown below:

PHP Code:

if($gender == "f"){
    
$query "SELECT * FROM {$prefix}owned_adoptables,  
                            
{$prefix}adoptables  WHERE {$prefix}owned_adoptables.mother = '{$parentid}
                                                 AND 
{$prefix}adoptables.type = {$prefix}owned_adoptables.type 
                                                 ORDER BY 
{$prefix}owned_adoptables.aid";
    
$result runquery($query);
}
else{
    
$query "SELECT * FROM {$prefix}owned_adoptables,  
                            
{$prefix}adoptables  WHERE {$prefix}owned_adoptables.father = '{$parentid}
                                                 AND 
{$prefix}adoptables.type = {$prefix}owned_adoptables.type 
                                                 ORDER BY 
{$prefix}owned_adoptables.aid";
    
$result runquery($query);


Nicely done, you should write a table to display child adoptables info, a good example is provided below, you may modify it to suit your need:

PHP Code:

    $article_content "<table border='1'>
    <tr>
    <th>Image</th><th>Species</th><th>Name</th><th>Level</th><th>TotalClicks</th><th>Owner</th><th>Gender</th>
    </tr>"
;
    while(
$row mysql_fetch_array($result)){
       if(
$row['usealternates'] =='yes')
            { 
                
$image $row['alternateimage']; 
            }
       else
            { 
                
$image $row['primaryimage']; 
            }
       if(
$row['currentlevel'] == 0)
            { 
                
$image $row['eggimage']; 
            }
       if(
$image=='')
            { 
                
$image $row['primaryimage']; 
            }
      
$article_content .= "<tr>
                          <td><center><img src='
{$image}'></center></td>
                          <td><center>
{$row['type']}</center></td>
                          <td><center>
{$row['name']}</center></td>
                          <td><center>
{$row['level']}</center></td>
                          <td><center>
{$row['totalclicks']}</center></td>
                          <td><center>
{$row['owner']}</center></td>
                          <td><center><img src='picuploads/
{$row['gender']}.png'></center></td>
                                  </tr>"
;
    }
    
$article_content .= "</table>"

This may look complicated, but it is the only way I can think of with Arianna's family tree script. Give a try on your site and see if you can set up a page like that.

SilverDragonTears 08-28-2011 01:14 AM

ok the only part that confuses me is
Quote:

The parentid should be available to you already, and I strongly advise you to name it $parentid to avoid confusion.

Hall of Famer 08-28-2011 01:17 AM

That I figured. Would you mind showing your script file so I can tell you which one is supposed to be $parentid?


All times are GMT -5. The time now is 02:35 PM.

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