Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2016, 12:33 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 151,492
Abronsyth is on a distinguished road
Default Converting Pound to Market?

Hello!

So I would like to turn the pound into more of a user-to-user market. So, a user chooses to send their pet to the market. The pet then appears in the market (a modified version of the pound), and then when another user buys that pet, the original owner who sent the pet to the market is awarded with the payment that the pet is sold for (as determined by the admin).

Now, I am pretty sure I can figure out how to use a pet's rarity to determine how much the value is (if $rarity = common {$marketvalue = 100}, essentially), and how to subtract that amount from the purchaser's account, but I'm not sure how to then see to it that it is added to the seller's account?

If anyone has ideas, that'd be amazing! If I figure it out before then, then I will be sure to share it with everyone as a mod :)

-Abronsyth

--------
Edit:
Check here for the latest chunk of code!
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 08-05-2016 at 08:18 AM.
Reply With Quote
  #2  
Old 08-04-2016, 12:37 PM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 24,556
NobodysHero is on a distinguished road
Default

Oooooo. This would be awesome! Yes, please!
Reply With Quote
  #3  
Old 08-05-2016, 08:16 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 151,492
Abronsyth is on a distinguished road
Default

OK, so far I have managed to get it to determine cost based on rarity, and subtract that amount when the user buys the pet. I can also make it add that rarity-based-amount as soon as the seller chooses to send the pet away. However, I am having issues with getting it to add that amount to the seller's account once someone else buys the pet. Here's my code so far;
pound.php adopt function
PHP Code:
            if($this->settings->cost->active == "yes"){
                
$adopt = new OwnedAdoptable($pound->aid);
                        if(
$adopt->getRarity() == "Common"){$sellvalue 50;}
                        elseif(
$adopt->getRarity() == "Uncommon"){$sellvalue 75;}
                        elseif(
$adopt->getRarity() == "Rare"){$sellvalue 100;}                
                
$cost $this->getCost($adopt);
                
$mysidia->user->changecash(-$sellvalue);
                
$seller $mysidia->db->select("pounds", array("lastowner"), "aid ='{$adopt->aid}'")->fetchObject();
                
$sellermoney $mysidia->db->select("users", array("money"), "username='{$seller}'")->fetchObject();
                
$profit $sellermoney $sellvalue;
                
$mysidia->db->update("users", array("money" => $profit), "username='{$seller}'");
                
$this->setField("cost", new Integer($cost));
            } 
If anyone notices some major flaws I'd really appreciate it if you could share :) I'm running into this error:
Catchable fatal error: Object of class stdClass could not be converted to string in /home/inekelmy/public_html/pound.php on line 85
This is line 85:
PHP Code:
$sellermoney $mysidia->db->select("users", array("money"), "username='{$seller}'")->fetchObject(); 
It's subtracting money from the buyer, and adding the pet to their account, but the seller is not getting money from it.
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 08-05-2016 at 11:31 AM.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:35 PM.

Currently Active Users: 2950 (0 members and 2950 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636