PDA

View Full Version : Show who recently leveled up a given adoptable


kisazeky
04-04-2009, 05:44 PM
What!? OMG ANOTHER MOD!!?

This one is kind of tricky so pay attention!!

---

If you have installed my profile mod

Wherever in the code there is:

$article_content = $article_content."$voter ";


change it to:


$article_content = $article_content."<a href='profile.php?owner=$voter'>$voter</a> ";


This will link their name to their profile.

----

Step 1:

Run this query (this is the only easy part)


ALTER vote_voters ADD (voteid INT NOT NULL AUTO_INCREMENT PRIMARY KEY)


Step 2:


Open levelup.php and look for something like this code. It may vary if you have changed the "already leveled up" message.


if($checkdate == $todaydate){
//We've gone this far, this means that we found a match because a date was returned
//Cannot vote because we already voted today...
$article_title = "You already voted for me today!";
$article_date = date('Y-m-d');
$article_content = "You already voted for this adoptable today. Please come back in 24 hours to level up this adoptable again.";


Below it, put:


$article_content=$article_content."<p>Recently leveled up by:</p>";

$query = "SELECT * FROM vote_voters WHERE adoptableid = '".$id."' AND date = '".$todaydate."' ORDER BY voteid DESC LIMIT 20";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < $num) {

$voter=@mysql_result($result,$i,"username");

$article_content = $article_content."$voter ";

$i++;
}



Step 3:

This is if you have not installed my currency mod

Find something like this bit of code (it will not be exact if you changed the level up message):


mysql_query("UPDATE owned_adoptables SET currentlevel='".$levelup."' WHERE uid='".$id."'");
mysql_query("UPDATE owned_adoptables SET imageurl='".$img."' WHERE uid='".$id."'");
$flag = 1;
$currentlevel = $levelup;
}


}

if($flag == 1){
$imageurl = $img;
}

$article_content = "You just gave ".$name." 1 LevelUP point!<br><br><img src='".$imageurl."' border='0'><br>
<b>".$name."'s Current Level: ".$currentlevel."</b><br><br>Be sure and come back tomorrow to rank ".$name." up again!";


Below it...insert this code:


$article_content=$article_content."<p>Recently leveled up by:</p>";

$query = "SELECT * FROM vote_voters WHERE adoptableid = '".$id."' AND date = '".$todaydate."' ORDER BY voteid DESC LIMIT 20";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < $num) {

$voter=@mysql_result($result,$i,"username");

$article_content = $article_content."$voter ";

$i++;
}



If you have installed my currency mod then...

Find something similar to this code. The article content may vary if you changed the message.


mysql_query("UPDATE `users` SET `money`='".$newbalance."' WHERE `username`='".$luser."'");

$article_content=$article_content. "
<p>You have earned 10 currency name for leveling up this pet.
<br>You now have a total of ".$newbalance." currency name.";


Erase the "; at the end of your message for earning currency. Then below it, paste this:


<p>Recently leveled up by:</p>";

$query = "SELECT * FROM vote_voters WHERE adoptableid = '".$id."' AND date = '".$todaydate."' ORDER BY voteid DESC LIMIT 20";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < $num) {

$voter=@mysql_result($result,$i,"username");

$article_content = $article_content."$voter ";

$i++;
}


Step 4:

Find

mysql_query("INSERT INTO vote_voters VALUES ('$todaydate', '','$ip','$id')");


Change it to

mysql_query("INSERT INTO vote_voters VALUES ('$todaydate', '','$ip','$id', '')");


Then find

mysql_query("INSERT INTO vote_voters VALUES ('$todaydate', '$username','','$id')");

again

and change it to

mysql_query("INSERT INTO vote_voters VALUES ('$todaydate', '$username','','$id', '')");

Ashje
04-04-2009, 05:50 PM
Looks cool =)

kisazeky
04-04-2009, 05:51 PM
Do you think it's confusing Ashje?

Ashje
04-04-2009, 05:56 PM
Not really. If you read it carefully then it's fine. I have to go to a concert soon but I'll install it later. =)