View Single Post
  #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: 159,781
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