View Full Version : Could some one code this..?
Abronsyth
04-12-2012, 02:29 PM
So, on my site, I'd like to make it so that a user can only own one growing pet at a time. So, they adopt their first pet, then it must reach it's maximum level ('3' in most cases; 0, 1, 2, 3) before they can adopt another pet.
Would someone be able to code this for me? I can offer art, line art, shading of a line art, writing, or something as payment.
Well, Thanks
-Iris
SilverDragonTears
04-12-2012, 08:25 PM
I think you're looking for something like what I have. The user can only have 5 eggs at a time. But you have to add it to breeding.php, the pound (which with the new script I haven't tried yet) doadopt.php and I think that's it. It's something like this though
$stmt = $adopts->query("SELECT * FROM ".constant("PREFIX")."owned_adoptables WHERE owner='".$loggedinname."' AND currentlevel<='3' AND isfrozen='no'");
$data = $stmt->fetchAll();
$num = count($data);
if($num >= 5){
$canadopt = "no";
$article_title = "Too many eggs!"; $article_content = "You already have too many eggs to take care of! Come back once you have hatched an egg!";
}
else
Abronsyth
04-13-2012, 10:06 AM
Thank you so much! However, on which line should that go for each?
Thanks,
-Iris
SilverDragonTears
04-13-2012, 02:57 PM
This is the doadopt.php
<?php
include("functions/functions.php");
include("functions/functions_users.php");
include("functions/functions_adopts.php");
include("inc/lang.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$promocode = $_GET["promocode"];
$name = $_GET["name"];
$date = date("M j, Y");
// $date = "Oct 23, 2001";
if($isloggedin == "yes"){
$stmt = $adopts->query("SELECT * FROM ".constant("PREFIX")."owned_adoptables WHERE owner='".$loggedinname."' AND currentlevel<='3' AND isfrozen='no'");
$data = $stmt->fetchAll();
$num = count($data);
if($num >= 5){
$canadopt = "no";
$article_title = "Too many eggs!"; $article_content = "You already have too many eggs to take care of! Come back once you have hatched an egg!";
}
else
if($_SESSION["allow"] != 1){
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
Change the currentlevel to the level just below your adults and the 5 to 1
Abronsyth
04-13-2012, 07:25 PM
Huh, didn't seem to work properly. Now it keeps saying that the id was invalid, the id is 3, and it shows up in the url, but wasn't working. I reverted it to the original...hm...
SilverDragonTears
04-13-2012, 07:27 PM
Can you post the edited part?
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.