Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   One Type Limit (http://www.mysidiaadoptables.com/forum/showthread.php?t=1006)

Ashje 07-19-2009 07:22 AM

One Type Limit
 
Let's say that I'm making a Pokemon Adoptables site and I want the user to be able to choose one starter and one starter only and not to be allowed to adopt the others after they have adopted one. How would I go about doing that?

In more generic terms;

Let's say I have 12 adoptables on a page and I want the user to only be able to adopt one out of those 12. After that, if they try adopting another, they get an error. How would I do that?

Thanks,
Ashje.

Seapyramid 07-19-2009 09:17 AM

RE: One Type Limit
 
You need to edit the the canadopt function on your functions.php page. I edited it so that they can only have 5 at a time that are young & then they have to level some up before they can adopt more.

PHP Code:

$query "SELECT * FROM adopts_owned_adoptables WHERE currentlevel < '4' AND owner='$loggedinname' AND isfrozen='no' AND item='no'";
$result mysql_query($query);
$num mysql_numrows($result);

if(
$num >= 5){
$canadopt "no";} 

Gives you an idea of how I modified it.

Sea

Ashje 07-19-2009 04:25 PM

RE: One Type Limit
 
Ah, so I would have to say something like:
PHP Code:

$query "SELECT * FROM adopts_owned_adoptables WHERE kind = 'starter' AND owner='$loggedinname'";
$result mysql_query($query);
$num mysql_numrows($result);

if(
$num >= 1){
$canadopt "no";} 

Thanks XD

Ashje 07-22-2009 10:14 PM

RE: One Type Limit
 
*bump*
Because I still don't understand how to do this. If anyone has the time, could you please write a function called "canadoptstarter" with just the regular canadopt function but with this in there as well:
PHP Code:

$query "SELECT * FROM adopts_owned_adoptables WHERE kind = 'starter' AND owner='$loggedinname'";
$result mysql_query($query);
$num mysql_numrows($result);

if(
$num >= 1){
$canadopt "no";} 



All times are GMT -5. The time now is 05:08 AM.

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