Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Addons/Mods Graveyard

Notices

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 03-25-2009, 02:33 PM
kisazeky kisazeky is offline
Member
 
Join Date: Mar 2009
Posts: 44
Credits: 22,693
kisazeky
Default Currency for leveling up / Adoptable shop (Fixed again)

[size=medium]Note with this update! Please, re-run the queries to add the shop adoptables, if you have already installed it. Thanks.[/size]

[size=large]Important!! A way to prevent people stealing shop adoptables![/size]

Open adopt.php and find something like this in the code (it won't be exactly like mine):

PHP Code:
if($newID != $aID){
$stop 1;
$article_title "Oops";
$article_date date('Y-m-d');
$article_content "This Digimon is not available for adoption.";

below it, insert this:

PHP Code:
if($memberlevel != free){
$stop 1;
$article_content "You cannot adopt this pet for free!.";


[size=large]Earning money on level up
[/size]
Step 1: Run this here MySQL query to add the money field in your users table:

PHP Code:
ALTER TABLE users
ADD money INT
(11NULL DEFAULT '0' 
Step 2: This is where the magic happens.

Download levelup.php and edit it to suit your site. Replace the number 10 with your desired amount of currency per level up.

Step 3: This is important if you still want people to be able to register. :P

Edit register2.php and find this line:
PHP Code:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free',)"); 
Replace it with:
PHP Code:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free','0')"); 
[size=large]Show the total amount of money to your users[/size]

Add this....

PHP Code:
if ($isloggedin == "yes"){
$query "SELECT * FROM `users` WHERE `username` = '".$luser."'";
$result mysql_query($query);
$num mysql_numrows($result);
$i=0;
    while (
$i 1) {
    
    
$money =@mysql_result($result,$i,"money");
    
$i++;
            }
$template replace(':WELCOMEORREGISTER:','',$template);
$template replace(':LOGINORACCT:''<p>Hi, '.$username.'
<p>Currency name: '
.$money.'
<p><a href="logout.php">Log out</a>' 
,$template); 
In between ...
PHP Code:
//$isloggedin = "no"; 
and...
PHP Code:
}
else{

//User is not logged in 
On all of your pages.

[size=large]
Shop to buy adoptables[/size]

Step 1:

Download shop.php, buy.php, and buyconfirm.php and upload them to your main folder.

Step 2:

Add adoptables for sale by running a query like this. Do not change the shop part unless you know what you're doing.
PHP Code:
INSERT INTO adoptables VALUES ('''name','level 0 image','shop','cost'
Then add the rank images, too. Put the image urls in place of the numbers. 1 will have its level 1 image, 2 the level 2 image, etc.

PHP Code:
INSERT INTO adoptable_rankimages VALUES ('name','1','2','3','4','5','6','7','8'
  #2  
Old 03-25-2009, 02:57 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 13,603
BMR777 is on a distinguished road
Default RE: [In Development] Currency for leveling up

Well, using your system of altering the users table will break the user registration system. :P

You would want to also find in register2.php:

PHP Code:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free')"); 
Replace With:

PHP Code:
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free','0')"); 
You need to add the extra column in there for the user's money. If the columns don't match, MySQL freaks out and new users are not registered correctly.

Also, I would change:

Code:
ALTER TABLE users
ADD money VARCHAR(11) NULL DEFAULT '0'
To:

Code:
ALTER TABLE users
ADD money INT
Use INT when only a number is expected. :)

Brandon
  #3  
Old 03-25-2009, 06:33 PM
Killgore Killgore is offline
Member
 
Join Date: Dec 2008
Posts: 82
Credits: 10,810
Killgore is an unknown quantity at this point
Default RE: [In Development] Currency for leveling up

So Brandon, would i be able to fuse this with my idea i was working on? If so, how?
  #4  
Old 03-25-2009, 06:37 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 13,603
BMR777 is on a distinguished road
Default RE: [In Development] Currency for leveling up

Quote:
Originally Posted by Killgore
So Brandon, would i be able to fuse this with my idea i was working on? If so, how?
I would suggest do the same, except add a second column to the database to account for pearls and emeralds.
  #5  
Old 03-25-2009, 06:40 PM
Killgore Killgore is offline
Member
 
Join Date: Dec 2008
Posts: 82
Credits: 10,810
Killgore is an unknown quantity at this point
Default RE: [In Development] Currency for leveling up

Okay. But there's still the dilemma that there's a chance of getting one out of five colors for each pearl or emerald. I'm guessing I'd need to create a field for each color pearl and emerald?
  #6  
Old 03-25-2009, 07:31 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 13,603
BMR777 is on a distinguished road
Default RE: [In Development] Currency for leveling up

PHP Code:
$color "";
$number rand(1,5); // Get random number between 1 and 5

if($number == 1){
$color "redpebbleimage.gif";
}
else if(
$number == 2){
$color "greenpebbleimage.gif";
}
else if(... and 
so on 
Just do that to assign a random pebble image and save in the db. :)
  #7  
Old 03-25-2009, 08:22 PM
rosepose rosepose is offline
Member
 
Join Date: Jan 2009
Posts: 127
Credits: 12,380
rosepose
Default RE: [In Development] Currency for leveling up

Does it work right now?
  #8  
Old 03-25-2009, 11:24 PM
kisazeky kisazeky is offline
Member
 
Join Date: Mar 2009
Posts: 44
Credits: 22,693
kisazeky
Default RE: [In Development] Currency for leveling up

Yes rosepose, getting currency for leveling up works. Just make sure to include Brandon's amendment or else people can't register anymore. :P

What's in progress still is the shop for buying adoptables with the money.
  #9  
Old 03-26-2009, 01:29 AM
Ashje Ashje is offline
Member
 
Join Date: Jan 2009
Posts: 179
Credits: 12,675
Ashje
Default RE: [In Development] Currency for leveling up

Could you edit the first post and add Brandon's extra part because I fail at this stuff...Thanks.
  #10  
Old 03-26-2009, 01:10 PM
rosepose rosepose is offline
Member
 
Join Date: Jan 2009
Posts: 127
Credits: 12,380
rosepose
Default RE: [In Development] Currency for leveling up

Thanks :) I'll try to add this to SE if the host decides to work ><
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
leveling idea Nemesis Suggestions and Feature Requests 2 01-08-2012 01:23 PM
Shop to buy an adoptable? SilverDragonTears Questions and Supports 8 08-16-2011 03:17 PM
Adoptable shop new version! [UPDATED!] mapleblade Mys v1.1.x Mods 57 08-15-2011 08:50 AM
How to create a a battle system ,shop and currency?? SieghartZeke Questions and Supports 9 11-02-2009 01:15 AM
Pets Not leveling up Seapyramid Questions and Supports 4 02-02-2009 06:03 PM


All times are GMT -5. The time now is 02:01 AM.

Currently Active Users: 730 (0 members and 730 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 - 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