// I know, I have terrible loooong coding, but it works anyway ;D
Demo:
http://pokepets.comlu.com/index.php (levelup).
1) We gone edit the database, go to adopts_settings, insert 3 new rows:
Code:
Name: clickevent
Value: Yes
Name: eventneeded
Value: What you want, example: 100
Name: eventprize
Value: The type of adoptable users get when they clicked X adopables, example: Pikachu
Now change also your _users table!
Add a new field;
Code:
eventclicks (varchar 5) default: 0
2) Now we gone edit our levelup.php
Search for this:
PHP Code:
// Show a thank you message along with the adoptable's information to the user...
$image = getcurrentimage($id); // Get the current image of the adoptable...
$article_title = $lang_gave."{$owned_adoptable['name']} one ".$lang_unit;
$article_content = "<img src='{$image}'><br>{$lang_gave}{$owned_adoptable['name']} one {$lang_unit}.<br>".$lang_levelup_encourage;
} // Adoptable is not frozen, end isfrozen else check
And add this under;
PHP Code:
$query = "SELECT * FROM ".$prefix."settings WHERE name='clickevent'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$clickevent=@mysql_result($result,$i,"value");
$query2 = "SELECT * FROM ".$prefix."users WHERE username='{$loggedinname}'";
$result2 = mysql_query($query2);
$num2 = mysql_numrows($result2);
$eventclicks=@mysql_result($result2,$i,"eventclicks");
$query3 = "SELECT * FROM ".$prefix."settings WHERE name='eventneeded'";
$result3 = mysql_query($query3);
$num3 = mysql_numrows($result3);
$eventneeded=@mysql_result($result3,$i,"value");
$query4 = "SELECT * FROM ".$prefix."settings WHERE name='eventprize'";
$result4 = mysql_query($query4);
$num4 = mysql_numrows($result4);
$eventprize=@mysql_result($result4,$i,"value");
$newevent = $eventclicks + 1;
$eventstillneeded = $eventneeded - $newevent;
if($clickevent == "yes" and $newevent < $eventneeded){
runquery("UPDATE {$GLOBALS['prefix']}users SET `eventclicks` = '{$newevent}' WHERE `username` = '{$loggedinname}'");
$event = "There is a click event! You have clicked {$newevent} adoptables, you need to click {$eventstillneeded} adoptables more to
receive a {$eventprize}.";
}
elseif($newevent == $eventneeded){
runquery("UPDATE {$GLOBALS['prefix']}users SET `eventclicks` = '{$newevent}' WHERE `username` = '{$loggedinname}'");
runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('', '{$eventprize}', 'Congratz','$loggedinname','0','0', '$code', '','$alts','fortrade','no', 'None','0')");
$event = "There is a click event! You have clicked {$newevent} adoptables, that's enaugh to receive a {$eventprize}. It's automatic
added to your account.'";
}
elseif($newevent > $eventneeded){
runquery("UPDATE {$GLOBALS['prefix']}users SET `eventclicks` = '{$newevent}' WHERE `username` = '{$loggedinname}'");
$event = "You already received a click promo, you can't get another one.";
}
else{
$event = "";
}
3) Now change your levelup content, find
PHP Code:
$article_content = $article_content . "<div align='center'><br /><br><br>You have earned {$reward} ".grabanysetting('cost')." for leveling up this adoptable. <br />You now have {$newamount} ".grabanysetting('cost')."</div>";
And change it to;
PHP Code:
$article_content = $article_content . "<div align='center'><br />{$event}<br><br>You have earned {$reward} ".grabanysetting('cost')." for leveling up this adoptable. <br />You now have {$newamount} ".grabanysetting('cost')."</div>";
Now it should work :D
FIX THAT GUESTS CAN'T GET IT WILL COME ;)