PDA

View Full Version : Trade System[Released]


Hall of Famer
12-24-2010, 07:44 PM
Well before releasing RA version 1.10 to public, I'd like to post a thread about this Trade system used in RA v1.10. This thread is mainly for users who are already using a heavily modified version of RA v1.00 and therefore cannot upgrade to RA v1.10 properly. It is still possible to add a trade system to your site though, just follow the instructions below:

There are three new script files added, namely trade.php, redeem.php and mytrades.php. Trade.php is where a trade is initialized, while redeem.php allows users to see trade requests and accept them. mytrades.php is currently still under construction, and we will bring it to life someday. The three script files are attached in this thread, you can simply download them and place in your adoptables directory. However, there are three more steps to take in order for your trade system to work...

First of all, you will need to execute the following SQL commands in PHPmyadmin to add a new table and a few entries in your database:

CREATE TABLE adopts_trades (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, userrequestingtrade varchar(50), tradetype varchar(20), adoptableoffered INT, cashoffered INT, adoptabledesired INT, custommessage varchar(150), offerstatus varchar(30), tradeto varchar(40));

INSERT INTO adopts_settings (name, value) VALUES ('enabletrades', 'yes');
INSERT INTO adopts_settings (name, value) VALUES ('tradecost', '0');
INSERT INTO adopts_settings (name, value) VALUES ('tradeoffercost', '0');Second, find the following lines in inc/function.php:

function grabanysetting($where){

include("config.php");

$query = "SELECT * FROM ".$prefix."settings WHERE name = '".$where."'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
Add above:

function getcash(){

}The last step is, well, to enable trade for each new adoptables. In doadopt.php, find the following fine:

mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','notfortrade','no')");
Replace with:

mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no')");
If you have gender mod, your script will look like this:

mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','notfortrade','no','$gender')");
Again change the entry 'notfortrade' to 'fortrade', otherwise you will receive an error that the ID of adoptable does not exist when offering a trade.

So yeah, thats all you need for a trade system. Dont forget to download the three new files and place them in your adoptables root directory. Have fun everyone, and merry christmas!

Kaeliah
12-26-2010, 11:46 AM
Nice script, although it's pretty limited it seems.

Hall of Famer
12-26-2010, 01:02 PM
Well unfortunately, this is how trade system looks like on myadopts.com, and I do not plan to add anything new until next release. Sure cash trade can be done atm, and maybe an option for users to enable/disable trades on each individual pet. Anna also suggested adoptable search engine to support trades, which I find it quite interesting too. For RA version 1.10, however, the trade system will remain exactly the same as MA's

Kaeliah
12-26-2010, 02:18 PM
Hm. Well... I've written a completely different, much more flexible trading script(Not the one I used for Asryndia), but seeing as I'm not really part of the team I haven't decided if I should release any more scripts...

Hall of Famer
01-02-2011, 04:32 AM
Oh interesting, I can ask Brandon if you want to be a part of the dev staff team too(or you can wait till January 13th-16th, you know what I mean by this. ^^). BMR is rather slow replying to messages though, so it will take time.

Hall of Famer