Hall of Famer's Gender Ratio Mod v1.2

Forum
Last Post
Threads / Messages
umm I see, can you upload admin.php, nadopt.php and doadopt.php as attachments so I can further evaluate your issue?
 
umm I really cannot detect any issues here... The only difference I see from your database is that the column 'genderratio' is Yes Null. Can you set this value to be 'no' and give a try again?
 
Well since you cannot create new adoptables, I am thinking about this way of debugging. Find this line in nadopt.php:

PHP:
            runquery("INSERT INTO {$prefix}adoptables VALUES ('',  '{$name}', '{$class}'  ,'{$description}','{$eggimage}','{$cba}','{$promocode}', '{$freqcond}',  '{$number}','{$datecond}','{$date}','{$adoptscond}','{$maxnumcond}','{$morethannum}','{$usergroupcond}','{$usergroups}','{$alternates}','{$altoutlevel}','{$altchance}',  '{$cost}', '{$genderratio}')");
Replace with:
PHP:
$query = "INSERT INTO {$prefix}adoptables VALUES ('',  '{$name}', '{$class}'  ,'{$description}','{$eggimage}','{$cba}','{$promocode}', '{$freqcond}',  '{$number}','{$datecond}','{$date}','{$adoptscond}','{$maxnumcond}','{$morethannum}','{$usergroupcond}','{$usergroups}','{$alternates}','{$altoutlevel}','{$altchance}',  '{$cost}', '{$genderratio}')";
mysql_query($query) or die(mysql_error());
See what error message you get after this... Also it would be nice if you can tell me what other Mods you are using at the same time.
 
I see, so you did install other Mods? Are you saying it is working fine for you now? Anyway in future releases we will try to use plugin system with Mods and create new tables instead of modifying existing tables by adding/editing columns. This way the addons will at least not interfere with default features such as user registration, adoptables creation/adoption. You may have seen this from my evolution Mod, which is designed to be compatible with every Mod available.
 
Well this is definitely doable. If you have Gender Ratio Mod already, find these lines below:

PHP:
$tempgender = rand(0, 99);
if($tempgender < $row['genderratio']) {
$gender = "f";
unset($tempgender);
}
else {
$gender = "m";
unset($tempgender);
}
runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('',  '{$row['type']}', '$name','$loggedinname','0','0', '$code',  '','$alts','fortrade','no', '$gender','0')");

Replace with:
PHP:
$tempgender = rand(0, 99);
if($tempgender < $row['genderratio']) {
$gender = "f";
unset($tempgender);
}
else {
$gender = "m";
unset($tempgender);
}
if($row['genderratio'] == 101) $gender = "Genderless";
runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('',  '{$row['type']}', '$name','$loggedinname','0','0', '$code',  '','$alts','fortrade','no', '$gender','0')");
 
I have an odd issue when I installed this mod now when i create a adopt and add alts it shows it as disabled all the time

All forms in the database for that are blank also I had to manually ad ENABLED to it and it seemed to work but whys it showing blanks and making it disable?
 
umm I dont think this script itself messes up with the alternate form generation code, unless you've copied/pasted the script in a wrong way that it overwrote the alternate image generation code. Can you show me what exactly is in your doadopt.php file? I guess this is the way to find a solution to your problem.
 
Im so sorry xD I cant believe i did the wrong one, ive been busy for a few days sgo

PHP:
<?php

include("inc/functions.php");

//***************//
//  START SCRIPT //
//***************//

$id = $_GET["id"];
$promocode = $_GET["promocode"];
$name = $_GET["name"];

if($isloggedin == "yes"){
	if($_SESSION["allow"] != 1){
	
		$article_title = $err_idnoexist;
		$article_content = $err_idnoexist_text;
	}
	elseif($_SESSION["allow"] == 1){
	
		// I guess the first thing to do is see if we have a valid adoptable ID submitted...
		if($id == "" or !is_numeric($id)){
			$article_title = $err_idnoexist;
			$article_content = $err_idnoexist_text;
		}
		else{
			// The adoptable ID appears to be valid, so we need to double check that it is valid by pulling up the adoptable in the DB

			$query = "SELECT * FROM {$prefix}adoptables WHERE id={$id}";
			$result = runquery($query);
			$row = mysql_fetch_array($result);

			if($id == $row['id']){
				// The ID submitted matches an existing adoptable type
				$canadopt = canadopt($row['id'], "adopting", $promocode, $row);

				// If we can adopt this creature, do the adoption
				if($canadopt == "yes") {
					if (changecash(-$row['cost'], $GLOBALS['loggedinname'], $GLOBALS['money'])==true) {				
						// BEGIN the actual adoption process

						// First we see if we have a custom name; if not, we use the default name
						if($name == ""){
							$name = $row['type'];
						}

						// Now we determine if we are using alternate images or not

						$alts = getaltstatus($id, 0, 0);

						// We need a unique code for the adoptable so we can show it to the user when we're done here...

						$code = rand(1, 20000);
						$tempgender = rand(0, 99);
if($tempgender < $row['genderratio']) {
$gender = "f";
unset($tempgender);
}
else {
$gender = "m";
unset($tempgender);
}
runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('',  '{$row['type']}', '$name','$loggedinname','0','0', '$code',  '','$alts','fortrade','no', '$gender','0')");

						// Adoption complete, show the user a confirmation screen...

						$result = runquery("SELECT * FROM {$prefix}owned_adoptables WHERE code='{$code}' and owner='{$loggedinname}'") ;
						$id=@mysql_result($result,0,"aid"); 

						$article_title = $name." adopted successfully";
						$article_content = "<img src='{$row['eggimage']}'><br>{$congrats1} {$name}.  You can now manage {$name} on the 
						<a href='myadopts.php'>My Adopts</a> page.<br><br><b><a href='myadopts.php?act=manage&id={$id}'>Click Here to Manage {$name}</a><br>
						<a href='myadopts.php?act=bbcode&id={$id}'>Click Here to get BBCodes / HTML Codes for {$name}</a></b><br><br>
						Be sure and <a href='levelup.php?id={$id}'>feed</a> {$name} with clicks so that they grow!";
						unset($_SESSION["allow"]);
						// END the actual adoption process
					}
					else {
						$article_title = "Not enough money.";
						$article_content = "You don't have enough {$GLOBALS['settings']['cost']} to buy this adoptable. Earn some money and then try again.";
					}
				}
				else {
					$article_title = $accden;
					$article_content = $adoptnoper;
				}
			} // End the if for if $id == $aid
			else {
				// Adoptable does not exist, show an error.

				$article_title = $err_idnoexist;
				$article_content = $err_idnoexist_text;
			} // End the else for if $id == $aid
		} // End the valid ID input else test statement (bulk of code goes above here)
	}
} // End the log in check IF
else {
	// Guests cannot adopt pets, so why bother...
	$article_title = $guesttitleerror;
	$article_content = $guesterror;
} // End the log in check ELSE 

//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title, $article_content, $date);

?>
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top