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 01-18-2017, 12:02 PM
Chaos77777 Chaos77777 is offline
Member
 
Join Date: Jan 2017
Posts: 43
Gender: Male
Credits: 3,725
Chaos77777 is on a distinguished road
Default Allow owner to get rewarded

Hey guys, first time posting here. I'm not a programmer and I've taken no classes, but so far I've been able to figure out how to set things up the way I like. But I'm at a loss on this one. Seems like it would be so simple, but I just can't quite nail it down lol. All I want is for the owner to also receive a reward when a user clicks on their adopts. I found the script in levelup.php, but I can't make it work. Maybe someone else can see what I'm doing wrong.

PHP Code:
            $own $mysidia->db->select("users", array("username"), "username = '{$this->adopt->owner}'");
            
$mysidia->own->changecash(1000000);
// I set it up above where the user gets paid. I set up a high number just so I could definitely notice the change

            
$reward $mysidia->user->clickreward($this->settings->reward);
            
$mysidia->user->changecash($reward);
            
$this->setField("adopt"$this->adopt);
            
$this->setField("reward", new Integer($reward)); 
And I get
Fatal error: Call to a member function changecash() on a non-object in /home/arconlin/public_html/levelup.php on line 56

Thanks guys. Hopefully someone can show me what I'm messing up
Reply With Quote
  #2  
Old 01-18-2017, 12:39 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: 332,295
Hall of Famer is on a distinguished road
Default

Well this is NewComer center, it is for newbies to make a thread to introduce themselves and to socialize with other users. You should post it in a different subforum called 'Questions & Support', for general questions like this one. I will move your thread there this time, but in future its necessary that you keep what I said above in mind.

For your question, $mysidia->own is not a valid property name, it will have a null value. Calling method changecash() on a null value will give you an error message. You should change it to $mysidia->user, and the error will go away.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #3  
Old 01-18-2017, 01:08 PM
Chaos77777 Chaos77777 is offline
Member
 
Join Date: Jan 2017
Posts: 43
Gender: Male
Credits: 3,725
Chaos77777 is on a distinguished road
Default

Sorry about that bud. I'll remember that for any future posts. The problem I have with your suggestion about adding in "user" in place of "own" is that it just gives the user (The person doing the clicking) the money specified, not the owner.

Last edited by Chaos77777; 01-18-2017 at 01:11 PM.
Reply With Quote
  #4  
Old 01-18-2017, 01:38 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,363
IntoRain is on a distinguished road
Default

You can't put $mysidia-> in front of $own because $own was a variable created by you in that file.

But you can try this: $this->adopt->getOwner(Model::MODEL)->changecash(...);
Or
$owner = new Member($this->adopt->getOwner());
$owner->changecash(...);
__________________


asp.net stole my soul.
Reply With Quote
  #5  
Old 01-18-2017, 01:41 PM
Chaos77777 Chaos77777 is offline
Member
 
Join Date: Jan 2017
Posts: 43
Gender: Male
Credits: 3,725
Chaos77777 is on a distinguished road
Default

Thanks a bunch! The second one worked perfectly!
Reply With Quote
  #6  
Old 01-18-2017, 01:44 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,363
IntoRain is on a distinguished road
Default

Great! :D I couldn't remember the right syntax anymore for the first one
__________________


asp.net stole my soul.
Reply With Quote
  #7  
Old 01-18-2017, 02:24 PM
Chaos77777 Chaos77777 is offline
Member
 
Join Date: Jan 2017
Posts: 43
Gender: Male
Credits: 3,725
Chaos77777 is on a distinguished road
Default

Lol, well I thought I could figure it out for myself. I guess not :(
I'm wanting it to reward the owner 1 percent of the cost of the adopt.
I tried a bunch of different variations of
$owner->changecash($mysidia->adopt->cost);


But it keeps saying it's a non numeric value.

I tried using
$owner->changecash($mysidia->adopt->cost * .01);
It doesn't give me any errors, but it doesn't actually increase the money.

$owner->changecash(1);
This one above works just fine, but I set up a rarity system. (I got lucky making it work) and want people who own rarer adopts get a better reward. Any clue?

I looked around in pound and poundview to see how it works in there, since that also uses a percentage system, but I'm not having any luck using any of those

Last edited by Chaos77777; 01-18-2017 at 02:47 PM.
Reply With Quote
  #8  
Old 01-18-2017, 02:49 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,363
IntoRain is on a distinguished road
Default

Try with $this->adopt instead of $mysidia->adopt
__________________


asp.net stole my soul.
Reply With Quote
  #9  
Old 01-18-2017, 02:50 PM
Chaos77777 Chaos77777 is offline
Member
 
Join Date: Jan 2017
Posts: 43
Gender: Male
Credits: 3,725
Chaos77777 is on a distinguished road
Default

Fatal error: Cannot access protected property OwnedAdoptable::$cost in /home/arconlin/public_html/levelup.php on line 56

I looked in class_ownedadoptables and there's nothing resembling a cost in there
Reply With Quote
  #10  
Old 01-18-2017, 02:58 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,363
IntoRain is on a distinguished road
Default

Try $this->adopt->getCost();

$cost is a protected attribute in class Adoptable, OwnedAdoptable inherits it from Adoptable, so you have to use the getX() functions to access it
__________________


asp.net stole my soul.
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 10:40 AM.

Currently Active Users: 2937 (0 members and 2937 guests)
Threads: 4,080, Posts: 32,024, 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 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636