PDA

View Full Version : Trade/Money Glitch


SilverDragonTears
12-05-2011, 03:17 PM
When my users trade pets and don't put a pet to trade in, it takes all their money after the trade is completed. Was this fixed in the newest release?

SilverDragonTears
12-09-2011, 02:46 PM
This is a really huge problem... Anyone have a quick fix? I've been staring at it for a few hours but really have no clue what I'm looking for.

SilverDragonTears
12-09-2011, 07:50 PM
Could it be this part?

$query = "SELECT * FROM ".$GLOBALS['prefix']."users WHERE username = '$tradefrom'";
$result = runquery($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$othercash=@mysql_result($result,$i,"money");

$i++;
}

$moneyleft = $othercash - $tradecost;

$moneyleft = $moneyleft - $cashoffered;

if($moneyleft >= 0){

$article_content = $article_content."<img src='templates/icons/yes.gif' border=0> ".$tradefrom."'s Cash Amount OK<br>";


}

It's driving me mad! MAD I SAY!!!

Hall of Famer
12-13-2011, 12:48 PM
umm I will look into this code tomorrow, it looks like a weird issue. The script by default should not allow any transaction to go through if a user does not submit his/her pet to trade. It is so weird...

SilverDragonTears
12-13-2011, 04:05 PM
I would certainly appreciate it :) My members are freaking out asking me to fix it, but I keep telling them I don't even know where to start. HOF to the rescue :)

Hall of Famer
12-13-2011, 10:15 PM
Well can you give a try using the new trade.php script from Mys v1.2.4? I did modify the trade.php script in Mys v1.2.3, and the version you are using is apparently from v1.2.2, in which the script was not optimized yet. If by any chance the problem still occurs, lemme know quickly and I will have it fixed in no time.

SilverDragonTears
12-13-2011, 10:40 PM
I already did that and it still didn't work :/

SilverDragonTears
12-14-2011, 02:56 PM
Any luck good sir?

Hall of Famer
12-14-2011, 04:50 PM
I found a mistake in the trade.php code and fixed it. The trade.php is reuploaded, please give a try on your site and see if this fixes the glitch. It is weird though, a trade offer is NOT supposed to be processed unless the user has input both the adoptable given and wanted.

SilverDragonTears
12-14-2011, 05:19 PM
Still doesn't work. I tested like this:

Test Account entered adopt they wanted.
No money entered, no adopt to trade in return for.

Test Account 2 accepted trade.

Test Account one lost all money.

Some people just want to give an adopt without offering money or a trade in return. So when they do that it takes all their money.


I also tested it by offering an adopt for money and it took all my money still.

Hall of Famer
12-14-2011, 05:47 PM
Well lets try this script file then.

Note: A trade script is not a gift script, users should not attempt to trade a pet for money...

SilverDragonTears
12-14-2011, 05:50 PM
You mean attempt to trade a pet without money/and or adopt?

SilverDragonTears
12-14-2011, 05:55 PM
Parse error: syntax error, unexpected '}' in /home/robynswo/public_html/trade.php on line 88

Hall of Famer
12-14-2011, 06:00 PM
Oh my goodness... Add a semicolon ; to the end of line 87, this is one of the most stupid mistakes a PHP coder can make, lol...

SilverDragonTears
12-14-2011, 06:08 PM
LMAO! You did it twice but I fixed the other. Ok now it says:

The adoptable's id is not numeric, please go back to the last page and resubmit your trade off.

So they HAVE to put in an adopt to trade for? They can't just offer an amount of money for an adopt?

Plus I thought to get around that I could remove

else{
$flag++;
$error = "The adoptable's id is not numeric, please go back to the last page and resubmit your trade off.";
}

But it still made the users money disappear.

Hall of Famer
12-14-2011, 06:11 PM
Well the concept of trade is that they have to give a pet of their own and receive another pet from their partner, this is why it is called a trade script and not a gift script.

SilverDragonTears
12-14-2011, 06:13 PM
Well they're paying for the adopt they want though... so it isn't a gift.

SilverDragonTears
12-14-2011, 06:25 PM
It's fine though. I just posted this for my members.

So here's the deal.

For now...

If you want to trade a user for an adopt for silvadollars, and they only want money and no adopt, you will have to catch an egg in the den to send as a "dummy" adopt. This means that they can simply abandon the egg once the trade is completed. You can not send a trade without selecting an adopt to trade the user for.

I hope this makes sense. Please ask any questions you may have. But in general, trading for money is now working.

So it should be fine :) Thanks HoF :pleased:

Hall of Famer
12-14-2011, 06:55 PM
I see, glad you come out with a good solution. XD