#1
|
|||
|
|||
Abandon system
Hey, I'm bokkun and...
let's me skip the introduction for now and give what you came for. In dragon cave you can abandon your dragons and have someone else adopt it, instead of killing them, It looked me interesting to have such a system to save those poor virtual lifes ;) I am not a great php programmer however, I tried my best, and accept critic. The script is supposed to remove the kill ability, but it's possible to simply have both. first of all, we need a new table in the database to save our abandoned adoptables: Code:
CREATE TABLE IF NOT EXISTS `adopts_abandoned` ( `aid` int(11) NOT NULL auto_increment, `type` varchar(40) default NULL, `name` varchar(40) default NULL, `owner` varchar(40) default NULL, `currentlevel` int(11) default NULL, `totalclicks` int(11) default NULL, `code` int(11) default NULL, `imageurl` varchar(120) default NULL, `usealternates` varchar(10) default NULL, `tradestatus` varchar(15) default NULL, `isfrozen` varchar(10) default NULL, `date` varchar(30) default NULL, PRIMARY KEY (`aid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; now, put the creature in there, open myadopt.php and look for $act == "kill" scroll a bit down till you find PHP Code:
PHP Code:
this is where it gets removed, but we don't want that, replace with PHP Code:
and that's it... ow wait where can we find our creatures? and don't forget you have to be able to adopt them There are 2 attachments included, abandon.php(is like adopt.php but for the abandoned pets) and doadoptab.php(like doadopt.php to adopt our abandoned friend.) abandon.php uses $article_title = $ashowingtitle; $article_content = $ashowing; don't forget to put that in your lang.php, and neither should you forget to add the link another think in abandon.php is that it checks if the creature has been there for more than 2 weeks, if so it gets removed, forever! to change that look for $decay=time() - 14 * 24 * 60 * 60; and change 14 * 24 * 60 * 60 to fit your needs(14 is more or less how many days it are) to remove the auto-delete thing, you can remove the if($date < $decay){ //check if the creature is too the abandoned database //yes it is, time to remove it $removed="yes"; mysql_query("DELETE FROM ".$prefix."abandoned WHERE aid='$aid' and name='$name'"); } I forgot to say abandon uses an edited function script simply add this at the end of function.php, else you can't see the pet image PHP Code:
This script is not compatible with a gender mod if you use one a few additions will have to be made: find in abandon.php PHP Code:
$gender=@mysql_result($result,$i,"gender"); to show the gender: go a little down till you see $article_content = $article_content."<br><img src='".$eggimage."' border='0'><br> add between that and <form name='form1' method='get' action='doadoptab.php'> this: <b>Gender: </b>".$gender."<br> That shows the gender to people who will get there abandoned pet next (more importantly) go to adoptab.php find mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','$currentlevel','$totalcli cks', '$code', '','$usealternates','$tradestatus','$isfrozen')"); replace with mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','$currentlevel','$totalcli cks', '$code', '','$usealternates','$tradestatus','$isfrozen','$g ender')"); find a bit above $eggimage=getabandonedimage($aid); and add again $gender=@mysql_result($result,$i,"gender"); that should do it for that file. but we aren't done in the code above(in file myadopts.php) you'll see $date=time('U'); add $gender=@mysql_result($result,$i,"gender"); then find INSERT INTO ".$prefix."abandoned VALUES ('$aid', '$type', '$name','$owner', '$currentlevel', '$totalclicks', '$code', '', '$usealternates', '$tradestatus', '$isfrozen', '$date')"); replace with mysql_query("INSERT INTO ".$prefix."abandoned VALUES ('$aid', '$type', '$name','$owner', '$currentlevel', '$totalclicks', '$code', '', '$usealternates', '$tradestatus', '$isfrozen', '$date','$gender')"); well that looks good, but it won't work if you don't add in the table adopts_abandoned a new field gender (with the same options as the gender field from the owned_adoptables) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mys v1.3.3 Personality System | Hwona | Mys v1.3.x Mods | 15 | 12-18-2016 10:13 PM |
Trade System | Kyttias | Questions and Supports | 4 | 05-29-2016 01:29 AM |
Wait 4 hours to abandon? | SilverDragonTears | Questions and Supports | 2 | 10-30-2011 04:11 PM |
Trade System? | sensacion | Questions and Supports | 5 | 08-20-2010 12:36 PM |
Trade System? | SieghartZeke | Questions and Supports | 1 | 12-28-2009 08:06 AM |
What's New? |
What's Hot? |
What's Popular? |