Abandon system
2 Attachment(s)
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` ( 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) |
RE: Abandon system
That sounds nice. I might make a few edits, but I'll probably be testing this. x3
|
RE: Abandon system
OMG Work in my site!!!
Thank you for this great Mod!!! And im waiting for the currency and the shop.... But a little thingy... I add the little code in my lang.php but i don't show text... can i add in the abandone.php page??? |
RE: Abandon system
You added it in $ashowing(title)?
an example of my test server: PHP Code:
of course you can always add the text to the page itself, lang.php is just to make changing texts easier(for when you make a language mod for example) |
RE: Abandon system
wow nice! ill test it as soon as i can :D i was waiting for this feature!!!!!! like the adoptable pound on pokeplushies! nice work!!!!
|
RE: Abandon system
Looks great. Imma try it out soon. XD
|
RE: Abandon system
I wanna to try out.
|
RE: Abandon system
Wait, so this isn't compatible with the gender mod?
|
RE: Abandon system
it is but you have to add the extra stuff at the end
Quote:
|
RE: Abandon system
Omg...You are from MYadopts!!!And you are so much great with coding!! *_*
|
RE: Abandon system
Quote:
|
RE: Abandon system
please re-upload the attachment
|
RE: Abandon system
done, re-uploaded the attachments, was there something wrong then?
|
RE: Abandon system
Quote:
|
RE: Abandon system
I just tried it, but it didn't worked...
I opened the abandon page, but the page doesn't show any adoptables... I checked the abandoned table and it doesn't have any records in it (the abandoned adoptables from the owned_adoptables table are deleted, not inserted into the abandoned table) how do I fix this? |
RE: Abandon system
Bump...
need more info on how to fix it... |
RE: Abandon system
Small question, for some reason when i added a gender field to my database it stops dumping abandoned adoptables? As soon as a remove the gender field from adopts_abandoned it starts working again.
|
RE: Abandon system
Fatal error: Call to undefined function: getabandonedimage() in /var/www/sites/yoyo.pl/o/t/otal/abandon.php on line 100 what's wrong?
ok, works ;D my mistake;D |
RE: Abandon system
sorry, I didn't check the forums quite a while
fadillzzz, I think you haven't changed the kill action in myadopts.php correctly Roconza, you should edit the codes when you add genders, at the end of the topic it says what to do when you add genders Szymon, that spares me some typing... |
RE: Abandon system
I'm pretty sure that I've change the code correctly but it's still doesn't work
|
RE: Abandon system
All the code is followed like it's posted here and I even went through it twice. All the code works fine until I add the gender field to the database.
|
RE: Abandon system
Thanks, i was scripting it myself and ran into a couple bugs that yours help me fix.
|
RE: Abandon system
I added this as per your instructions as well and I have the same problem, the abandon page does not show any adoptables.
|
RE: Abandon system
There is a code that when the Abandon system is empty of pet say:
There are no pets here! Try to come back tomorow! |
RE: Abandon system
Well, I tried to install it, and I couldn't get it to work.
Although, I got half of it to work, the other half just gives errors. Here are the steps I followed: - SQL Query > Added new database information as required by original post in this thread. - opened myadopts.php, replaced $aid information with longer information after the kill area in the script - overwriten remove query with 2 lines as per post. - added abandon information at the end of the functions.php script - added ashowingtitle and ashowing to language file. - uploaded by abandon.php file and doadobtab.php to the folder Tested it and only half of it worked. See, when you this is all installed, you go to kill your pet, and then you choose yes. Your pet is then sent to the abandon.php area. Which the abandoned pet does show up, but it only shows the picture of the pet and not any details about the pet. When you click on the pet in the abandon pet to adopt, it asks if you want to rename the pet, and to put in a name in the box field under the image... However, there is NO box field for name input. That is missing. When you go to click adopt me, it gives a congratulations screen, but all the links are wrong and it gives errors whenever you click on any link on the congratulations page for adopting and abandoned pet. For example: Quote:
Quote:
Quote:
So... what did I do wrong? Is there someone that actually got this script to work and if they did, could you please PM me or respond back this post with the steps that you took to get it to work. Thanks |
RE: Abandon system
ditto! :D :D
This could likely be modified to be used as a way to send pets to a "for sale" section! I'd love to hear from someone who has it working too, so we know how to use it as well? |
RE: Abandon system
Figured it out myself, and this is one really great mod!!
It's basically a problem of the rows, the way they are aligned, and making sure $gender comes before date: here's what I have now in my adopts for "kill" Code:
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID and then: Code:
// Actually run the execution I am using Arianna's breeding system and so I have a few extras at the end. The main thing is be sure that gender is indicated on everything BEFORE the date! Otherwise it's all out of whack! Just do this for everything, and be sure to add the gender field in the actual new table too ( I think I had to add it in ) - make sure it's in the right order too! This works for me now, and just go through anything pertaining to this output and insertion, make sure all your ducks are in the right row, lol. ****Oh, and please note I am using the word SALES as opposed to ABANDONED for my Table --- just use whatever you like I guess, but for you at first that will be Adopts_Abandoned! |
RE: Abandon system
To have it show more stuff before you finalize the adoption or sale, find this in abandon.php:
Code:
$article_content = $article_content."<br><img src='".$eggimage."' border='0'><br> replace with ( your own additional listings ) Code:
$article_content = $article_content."<br><img src='".$eggimage."' border='0'><br> |
RE: Abandon system
Quote:
(nothing was inserted to the abandoned table) |
RE: Abandon system
yes indeed, thanks, I fixed it
Sorry for being off all the time, I don't manage an adoptable site, so only when I remember about it I come to visit this site... @redheadturkey: It's true, if you had the gender mod earlier than this mod, $gender and $date are at the wrong place I added the gender mod later... @gensuperman: I'm sorry but I think it's something you saw over, I can't see the problem in my code... However you are right with the fact that only the image shows up, I removed the extra info on my adopt.php page and the abandon.php is a modified version of that. try to find out how to add it back again or I'll explain later... Sorry Also gensuperman, it's the text defined in lang.php, I saw over it add in your lang.php under wherever you put $ashowingtitle and $ashowing this $alanga1 = "You are adopting "; $alanga2 = ". <br>When you're ready to adopt this Adoptable, click on the <i>Adopt Me</i> button below."; go to abandon.php and look for $langa1 and $langa2 and change them into $alanga1 and $alanga2 for the rest, recheck the code and correct me if I made another mistake, I will try fix it... |
RE: Abandon system
Well yeah, it is not really hard to integrate this with gender system, the only issue is with the structure of own_adoptable table, which can be easily modified.
|
All times are GMT -5. The time now is 09:25 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.