Quote:
Originally Posted by draugluin
okay, I fixed it
this is the code for useful gender-swap
PHP Code:
function items_alts1($item, $adopt){ // First lets check if alternative image exists for an adoptable at this level. $lev = $GLOBALS['adopts']->select("levels", array(), "adoptiename='{$adopt->type}' and thisislevel ='{$adopt->currentlevel}'")->fetchObject(); if($lev->alternateimage == ""){ // The alternate image does not exist, cannot convert adoptable into its alternate form $note = "It appears that your adoptable could not swap its gender...<br>"; } else{ // The alternate image exists, conversion between primary and alternate image is possible. switch($adopt->usealternates){ case "yes": $GLOBALS['adopts']->update("owned_adoptables", array("usealternates" => 'no', "gender" => 'm'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "{$adopt->name} is male."; break; default: $GLOBALS['adopts']->update("owned_adoptables", array("usealternates" => 'yes', "gender" => 'f'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = " {$adopt->name} is female"; } //Update item quantity... $delitem = $item->removeitem(1, $item->owner); } return $note; }
You only have to modify your text and have alternate images female.
I've the primary image for male and alternates for female.
much fun - I will have fun too - or better : my user
|
That actually gives me an idea (more work for the artist I find to do art for the site also XD)
basically male and female versions of my adoptables, and certain adoptables that have normal alt images I can just add a check in that code so that if used on certain characters it doesn't allow you to gender swap xD. (for characters that must be female, and/or characters that have alternate forms, like one of my adoptables will have an alt form of a chimera. )
Anyways, thanks for the code! I probably never would have been able to write that xD (well I probably would if I knew more PHP xD)
__________________
I have some small tutorials
Here that show things such as re-arranging the SIDEFEED and LINKSBAR, and redirecting people after login.