Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.1.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=20)
-   -   User Points & Ranks/Levels (http://www.mysidiaadoptables.com/forum/showthread.php?t=1947)

Sasoragon 02-23-2011 06:51 AM

User Points & Ranks/Levels
 
User points and Ranks~

This mod will give users another form of "points" to collect. The more points you have, the higher your User Rank will be. Points can be collected by leveling your own or other people's adoptables. :meow:

First, enter the MySQL Database. Under "_users", add another column at the bottom that looks like this:

Code:

Field:        Type:        Null:
points        int(20)      Yes

Now. Go to register.php :colonu:

Find the code that looks somewhat like this: (Mine will probably be a little different than yours)

PHP Code:

//All checks are done, actually create the user's account on the database

    
$date date('Y-m-d');

    
mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email','3','1', '$date', '0','','','','','','500','100','','','','','Unknown')");

    
//Now that we have created the user, let's log them in...

    
$status dologin($username$pass1); 

Well, at the end of the INSERT INTO mysql_query, add another ,'50' at the end of it. (On mine it would be behind the 'Unknown'.)

Once you've changed that, go to levelup.php. :happycbig:

Now find where it says:

PHP Code:

                  // Start Rewards
                  
                  // ************************************************  
                  
                  
                  //Get currency on level up
                  
                  
$query "SELECT * FROM `adopts_users` WHERE `username`='$loggedinname'";
                  
$result mysql_query($query);
                  
$num mysql_numrows($result);
                  
                  
$i 0;
                  while (
$i 1) {
                      
$dollar = @mysql_result($result$i"dollar");
                                            
// Change this number 10 to the number of currency you want users to earn on level up  
                      
$amount rand(5,15);
                      
$newbalance $dollar $amount;
                      
                      
$i++;
                  }
                  
                  
mysql_query("UPDATE `adopts_users` SET `dollar`='" $newbalance "' WHERE `username`='$loggedinname'");
                  
                  
                  
$article_content $article_content "<div align='center'><br />You have earned "$amount ." Dollars for leveling up this Adoptable. <br />You now have  " $newbalance " Dollars.</div>";
        

    } 

Replace all of that with this:

PHP Code:

                  // Start Rewards
                  
                  // ************************************************  
                  
                  
                  //Get currency on level up
                  
                  
$query "SELECT * FROM `adopts_users` WHERE `username`='$loggedinname'";
                  
$result mysql_query($query);
                  
$num mysql_numrows($result);
                  
                  
$i 0;
                  while (
$i 1) {
                      
$dollar = @mysql_result($result$i"dollar");
                      
$points = @mysql_result($result$i"points");
                                            
// Change this number 10 to the number of currency you want users to earn on level up  
                      
$amount rand(515);
                      
$pointamount rand(515);
                      
$newbalance $dollar $amount;
                      
$newpointbalance $points $pointamount;
                      
                      
$i++;
                  }
                  
                  
mysql_query("UPDATE `adopts_users` SET `dollar`='" $newbalance "' WHERE `username`='$loggedinname'");
                  
mysql_query("UPDATE `adopts_users` SET `points`='" $newpointbalance "' WHERE `username`='$loggedinname'");
                  
                  
                  
$article_content $article_content "<div align='center'><br />You have earned "$amount ." Dollars and ".$pointamount." Points for leveling up this Adoptable. <br />You now have  " $newbalance " Dollars and ".$newpointbalance." Points.</div>";
    

    

    } 

That way, people will earn points as well when leveling up an adoptable. :el:

(You can also make it so that users earn points by logging in, posting in the shoutbox, viewing pages, when sending PM's, etc. Maybe later I'll add to this profile saying how to add those stuff as well. :jay: )

After that, open up profile.php.

Find where is says this:

PHP Code:

    $i=0;
    while (
$i 1) {

    
$usersname=@mysql_result($result,$i,"username");
    
$usersgroup=@mysql_result($result,$i,"usergroup");
    
$website=@mysql_result($result,$i,"website");
    
$aim=@mysql_result($result,$i,"aim");
    
$yahoo=@mysql_result($result,$i,"yahoo");
    
$msn=@mysql_result($result,$i,"msn");
    
$membersince=@mysql_result($result,$i,"membersince"); 

Add this to the bottom of it:

PHP Code:

        $points=@mysql_result($result,$i,"points"); 

Now scroll down and find where it says this:

PHP Code:

    $article_title $userdisp."'s Profile:";
    
$article_content "<b><u>".$lang_basic_info."".$usersname.":</u></b><br><br>
    <img src='templates/icons/web.gif'> "
.$website."<br>
    <img src='templates/icons/aim.gif'> "
.$aim."<br>
    <img src='templates/icons/msn.gif'> "
.$msn."<br>
    <img src='templates/icons/yahoo.gif'> "
.$yahoo."<br>
    <img src='templates/icons/title.gif'> <a href='messages.php?act=newpm&user="
.$usersname."'>Send ".$usersname." a Private Message</a><br>
    <br><b><u>"
.$usersname."'s Stats:</b></u><br><br>
    <b>Member Since:</b> "
.$membersince."<br>
    <b>Number Of Pets Owned:</b> "
.$numpets."<br>
    <b><u>"
.$usersname."'s Pets:</u></b><br><br>"

Directly above that, paste this:

PHP Code:


        
// Begin defining the user's Rank..

        
$rankval 0;
        
$rank = -1;

        while (
$rankval $points) {

        
$rankval $rankval 50;
       
// Change the + 50 to however many points you want the user to have before going up a rank.

        
$rank++;

        } 

Now go underneath .$usersname.'s Stats (it's still under profile.php) and paste this in:

PHP Code:

        <b>Amount of Points:</b".$points."<br>
        <
b>".$usersname."'s Rank:</b> ".$rank."<br><br> 


Aaand... That's about it! This was my first Mod, so sorry about it not being a big one. Hopefully once I get better at PHP, my Mods will also get bigger and better. :ti:

fadillzzz 02-23-2011 07:33 AM

I don't know why I haven't thought of this yet.
This is awesome!

Hall of Famer 02-23-2011 09:23 AM

This looks really nice Sasoragon, glad to see you are making quality PHP scripts now. ^^ Keep this up and you may receive Premium Membership soon.

Sasoragon 02-23-2011 04:47 PM

D'aww, thanks Fadill, Hoffie. :smile:

This idea randomly popped into my head when I was (supposed to be) studying yesterday. I thought it would make a cool feature, so I decided to test out coding it. :colonu:

PTGigi 02-23-2011 08:35 PM

Oh hey MM2+ has something like this already :meow: Lol same field name too X3

The Codfin Keeper 02-24-2011 05:43 AM

Quote:

Originally Posted by Sasoragon (Post 14909)
D'aww, thanks Fadill, Hoffie. :smile:

This idea randomly popped into my head when I was (supposed to be) studying yesterday. I thought it would make a cool feature, so I decided to test out coding it. :colonu:

EDIT: Gah, my post was posted twice. Since I can't find the delete button, could a mod please delete this post? :P

Just hit Edit, then Delete. :3

Nice mod, I'll use it, if I can find a possible use for it on my site. xD

/shot

Sensacionsk8 02-24-2011 06:53 PM

how to have the point obtained is for the owner of adoptable

Sasoragon 02-27-2011 06:54 PM

Gigi - GREAT MINDS THINK ALIKE? :angrygrin:

And yus, thanks TCK. I managed to delete it. :jay:

Sensa - I don't quite understand what you mean. The points are obtained by clicking adoptables. :3

DragonTamerChris 02-27-2011 07:02 PM

Quote:

Originally Posted by Sensacionsk8 (Post 14942)
how to have the point obtained is for the owner of adoptable

I wouldn't like that. Then some people would make their adoptable give someone 1 point and then another adoptable they might make it 7 points. Plus that's a bit too much customization for your adopts to me.

Sensacionsk8 02-28-2011 08:19 AM

Quote:

Originally Posted by DragonTamerChris (Post 15050)
I wouldn't like that. Then some people would make their adoptable give someone 1 point and then another adoptable they might make it 7 points. Plus that's a bit too much customization for your adopts to me.

with a simple program you get all possible experience, that's why I liked that the clicker earn points, but in the end and solve it ^ ^


All times are GMT -5. The time now is 12:43 PM.

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