PDA

View Full Version : Limit Adopted Eggs


fadillzzz
01-29-2011, 10:30 PM
This mod will limit how many eggs the users can have before they can adopt more adoptables.

Open your doadopt.php
find this code

if($aid == "" or !is_numeric($aid)){

$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;

}
Add below

$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='".$loggedinname."' AND currentlevel='0'";
$result = mysql_query($query);
$num = mysql_num_rows($result);

if($num >= 5){
$canadopt = "no";
$article_title = "Too many eggs!";
$article_content = "You already have too many eggs!";
}
Change 5 to the number you want to limit of how many eggs the users can have.
Note: I'm not sure if setting the $canadopt to no is necessary to make it more secure, but I put it there anyways just in case if things happen.

Do the same thing with doadoptab.php so that they can't cheat by abandoning the adoptables and adopt more from the adopt.php then readopt the abandoned from the abandon.php

If you encounter any problem with this mod, post it here.

Kaeliah
01-30-2011, 11:40 AM
Looks very nice. :smile: It's nice to see such a wide range of mods. I think this mod will be particularly useful to prevent people from hogging. :wutno:

Hall of Famer
01-30-2011, 01:18 PM
Nice mod, sounds like a very nice fix for many users. For those who have egg levels above lv.0, simply change the part currentlevel='0' to anything you want, such as currentlevel<'3'.

DragonTamerChris
01-30-2011, 02:43 PM
I requested this mod about a week ago. :veeee:

I like it. :pleased: As Kae said, it's good to prevent people from hogging adopts.

RoconzaArt
01-30-2011, 03:41 PM
I'm debating adding this do to one problem good old Hydra. I'm worried people will hydra there animals or create a bunch of dummy accounts to get around it.

PTGigi
01-30-2011, 03:48 PM
Well it depends how hard it is to get past the egg stage I assume O.o

Lolz I'd add it but I just realized my site has no egg stages XD Or it could be used to say above this level (lvl 5=15 clicks sounds good) Hm....*ponders*

RoconzaArt
01-30-2011, 04:03 PM
On the site I would use it on it takes 15 clicks to get out of the egg stages since all babies hatch at lvl 5 or in some rare cases lvl 4.

DragonTamerChris
01-30-2011, 04:30 PM
I'm debating adding this do to one problem good old Hydra. I'm worried people will hydra there animals or create a bunch of dummy accounts to get around it.

Maybe a code that makes people have to also wait a certain amount of time before their adopt can become an egg/hatchling/adult?

Missy Master
01-31-2011, 08:25 AM
Maybe a code that makes people have to also wait a certain amount of time before their adopt can become an egg/hatchling/adult?

Good ideas... again, we really desperately need some way to control timing with the breeding portion of all this ...there is so much we could do with that!

I know there is a 'decay' thing for php, no idea how to get it to go in reverse or sideways hahah ...

Missy Master
01-31-2011, 08:35 AM
Currently searching here for a way to delay egg/baby insertions!



http://us2.php.net/manual/en/function.strtotime.php

fadillzzz
01-31-2011, 08:51 AM
Maybe a code that makes people have to also wait a certain amount of time before their adopt can become an egg/hatchling/adult?
I'm working on it...
Wish me luck!

Missy Master
01-31-2011, 08:57 AM
maybe?? checking that out too! :)



http://www.php.net/manual/en/function.sleep.php

fadillzzz
01-31-2011, 08:03 PM
maybe?? checking that out too! :)



http://www.php.net/manual/en/function.sleep.php

No, that won't do..
the sleep function will delay the execution of a PHP script which means the page will took more time to load making your site looks really slow

PokePets
02-10-2011, 10:34 AM
Question; where to place this in your doadopt when i use this mod =S?
http://mysidiaadoptables.com/forum/showthread.php?t=1783

RoconzaArt
02-11-2011, 04:59 PM
I'd like to know as well.

PokePets
02-13-2011, 02:41 AM
I've send him a PM...

fadillzzz
02-13-2011, 11:09 PM
I'd like to know as well.
I don't see why it's hard to install this mod if you have the 'Secure Random Adoption' mod installed. I've looked at Pokepets's .php file and I can easily find where to place the necessary code to install this mod.

All you have to do is just find this code in doadopt.php & doadoptab.php


if($aid == "" or !is_numeric($aid)){

$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;

}
Below that, add this code

$result = mysql_query("SELECT * FROM ".$prefix."owned_adoptables WHERE owner='".$loggedinname."' AND currentlevel='0'");
$num = mysql_num_rows($result);

if($num >= 5){
$canadopt = "no";
$article_title = "Too many eggs!";
$article_content = "You already have too many eggs!";
}


Send me a PM if you're still having some problems to install this mod. I'll be gladly to help you out. :happyc:

Slix
04-03-2011, 06:37 PM
Thanks for this mod! I added it to the breeding page as well.