View Single Post
  #1  
Old 12-24-2010, 07:44 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 333,609
Hall of Famer is on a distinguished road
Default Trade System[Released]

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:

Code:
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:

PHP Code:
function grabanysetting($where){

include(
"config.php");

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

PHP Code:
function getcash(){


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

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

PHP Code:
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:

PHP Code:
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!
Attached Files
File Type: php trade.php (12.7 KB, 8 views)
File Type: php redeem.php (17.8 KB, 6 views)
File Type: php mytrades.php (4.3 KB, 6 views)
Reply With Quote