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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2010, 10:50 PM
Magnie's Avatar
Magnie Magnie is offline
Pythonic
 
Join Date: Dec 2009
Location: Polaris, the Planet
Posts: 34
Gender: Male
Credits: 5,635
Magnie
Send a message via ICQ to Magnie
Default Mod: Currency

Well, you know everyone is wanting a currency mod ( Including me )? Well, I've figured out how to make one, so I decided to show everyone how to have one. Do note, all this will do, is give you a currency and allow you to increase it by clicking/leveling adoptables. You will have to make all the extensions for it yourself. :P But I guess I will be willing to help you make one if you ask ( nicely xD ). :D

Step 1: Make the currency table.
Open up your MySql then find "Query" ( I have no idea how you access your MySql DB or what it looks like, so you'll need to find stuff yourself ) It should allow you to run a MySql Query, the query I want you to run is this:

ALTER TABLE users
ADD money INT(11) NULL DEFAULT '0'

Change 'users' to whatever you "prefix" is plus 'users'. Mine is adopt_users. Just an example. :P Then change 'money' to whatever currency you want, then run it. :)

Step 2: Make it so you get money for clicking on adopts.
There is a file called 'levelup.php'. Open that up then go to line 98, it should be a "}". Then after that, copy and paste then edit to your desires ( You can add some enters to keep everything clean :P ):

PHP Code:
$query "SELECT * FROM ".$prefix."users WHERE username = '".$loggedinname."'";

$result mysql_query($query);

$num mysql_numrows($result);



//Loop out code

$i=0;

while (
$i 1) {



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



$i++;


Now change the money variable to whatever you want, but change the second 'money' to the same as the one in the in Step 1 where you named the currency. :D Okay, now go to line 162 it should say:

PHP Code:
    $newclicks $totalclicks 1// Add 1 click to the current click total of this adoptable... 
Now after that add:

PHP Code:
    $newmoney $money 10
Then go to line 168 and it should say:

PHP Code:
    mysql_query($query); 
Then after that add:

PHP Code:
    $query "UPDATE ".$prefix."users SET money='".$newmoney."' WHERE username = '".$loggedinname."'";

    
mysql_query($query); 
Then that should be it for 'levelup.php'

Step 3: Fixing other files...
There may be some files that need fixing, like the 'register.php' file. We will need to fix it so other people can register. :D Go to line 182, it should say:

PHP Code:
    mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email','3','1', '$date', '0','','','','','')"); 
and replace it with:

PHP Code:
    mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email','3','1', '$date', '0','','','','','','0')"); 
There may be some other files that need fixing, but I have no idea, or I don't remember. So if you notice any problems, please tell me and I'll figure it out. O.O

A simple 3 Step tutorial thingy on how to make a currency mod. :D

Please note, it is not my fault if you mess up your website. I messed mine up and had to remake it. So make sure you have some sort of Backup or something. :D Or, just try it on another website. ;)
Reply With Quote
  #2  
Old 03-05-2010, 11:35 AM
redheadturkey redheadturkey is offline
Senior Member
 
Join Date: Jan 2010
Posts: 136
Gender: Female
Credits: 11,666
redheadturkey is on a distinguished road
Default RE: Currency Mod

wow that's really fantastic!!

thank you for posting all that, I am sure it's going to be a tremendous help to people --- thanks!! Gonna try it out in a bit here and give it a test run, and yes, I always make sure to back up everything, haha!
Reply With Quote
  #3  
Old 03-05-2010, 07:42 PM
Magnie's Avatar
Magnie Magnie is offline
Pythonic
 
Join Date: Dec 2009
Location: Polaris, the Planet
Posts: 34
Gender: Male
Credits: 5,635
Magnie
Send a message via ICQ to Magnie
Default RE: Currency Mod

Thanks! Yeah, I noticed people wondering it too and I did also, so I tried to find out myself. :P Yeah, I tend not to back things up... so... I loose stuff sometimes, but not too often cause I remember, or find out what's wrong. :)
Reply With Quote
  #4  
Old 03-09-2010, 12:38 AM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 18,120
Seapyramid
Default RE: Currency Mod

I am not good at explaining mods but I tried to make this one fool-prrof. :) So far noone has had a problem. :)

Sea
Reply With Quote
  #5  
Old 03-09-2010, 07:32 AM
SieghartZeke SieghartZeke is offline
Member
 
Join Date: Oct 2009
Posts: 149
Credits: 12,512
SieghartZeke
Default RE: Currency Mod

There is the possibility of add Some words when you click the adopt....like:

"You have received 25 Gp to level up this character...now you have 5000 Gp?"
Reply With Quote
  #6  
Old 03-09-2010, 11:11 AM
Magnie's Avatar
Magnie Magnie is offline
Pythonic
 
Join Date: Dec 2009
Location: Polaris, the Planet
Posts: 34
Gender: Male
Credits: 5,635
Magnie
Send a message via ICQ to Magnie
Default RE: Currency Mod

Sea: What do you mean Fool-Proof?

Zeke:

Go to line 243 in 'levelup.php'. It should say ( Or look for it around line 243 ):

$article_content = "<img src='".$image."'><br>".$lang_gave."".$name." one ".$lang_unit.".<br>".$lang_levelup_encourage;

And after that add this line:

$article_content = $article_content."<br>You have received [Amount of currency Earned] [Currency Name] and now have ".$newmoney." [Currency Name]."

Change '[Amount of currency Earned]' and '[Currency Name]' to what it says. ;)

On Step 2 it tells you to put '$newmoney = $money + 10' set '$newmoney' and '$money' in the above code to whatever you put for Step 2.

Hope that Helps! :D
Reply With Quote
  #7  
Old 03-16-2010, 07:34 AM
SieghartZeke SieghartZeke is offline
Member
 
Join Date: Oct 2009
Posts: 149
Credits: 12,512
SieghartZeke
Default RE: Mod: Currency

Err...Dont work the currency in my site!!
I Get an error when i go to lvl up a pet!
What i have errated??
Reply With Quote
  #8  
Old 03-17-2010, 12:46 AM
Magnie's Avatar
Magnie Magnie is offline
Pythonic
 
Join Date: Dec 2009
Location: Polaris, the Planet
Posts: 34
Gender: Male
Credits: 5,635
Magnie
Send a message via ICQ to Magnie
Default RE: Mod: Currency

First thing you do when you have a problem. You post the error(s). ;)
Reply With Quote
  #9  
Old 03-23-2010, 09:44 AM
SieghartZeke SieghartZeke is offline
Member
 
Join Date: Oct 2009
Posts: 149
Credits: 12,512
SieghartZeke
Default RE: Mod: Currency

Oh-Oh...
Is not possible that you add for the cash code in my level up code???
Code:
<?php

// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// **********************************************************************

// Wake the sleeping giant

// **********************************************************************
// Basic Configuration Info
// **********************************************************************

include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");

$themeurl = grabanysetting("themeurl");

// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************

$links = getlinks();

// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************

$ads = getads("any");

// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************

$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);

// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************

$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");

// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************

$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];

// **********************************************************************
// End Prepwork - Output the page to the user
// **********************************************************************

$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9s]/", "", $id);
$id = secure($id);

if($id == "" or !is_numeric($id)){

// If the ID is blank or non-numeric, then it is invalid...

$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;

}
else{

// We have what appears to be a valid adoptable ID, so we pull the adoptable's information from the database...

$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);

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

$aid=@mysql_result($result,$i,"aid");
$type=@mysql_result($result,$i,"type"); 
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$currentlevel=@mysql_result($result,$i,"currentlevel"); 
$usealternates=@mysql_result($result,$i,"usealternates");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$owner=@mysql_result($result,$i,"owner");

$i++;
}

if($aid == $id){

// The adoptable does exist, so now we need to see if we can vote...
// We need to get the date today and the user's IP address (if is guest we use this)

$date = date('Y-m-d');

$ip = $_SERVER['REMOTE_ADDR']; 
$ip = preg_replace("/[^a-zA-Z0-9@._-]/", "", $ip);
$ip = secure($ip);

$num = 0;

if($isloggedin == "yes"){

// If we are logged in, we check if a user with our username voted for this adoptable today...

$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and username = '$loggedinname' and date = '$date'";

}
else{

$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and ip = '$ip' and date = '$date'";


} // End the is logged in check else statement


// Check what the number for the query is...

$result = mysql_query($query);
$num = mysql_numrows($result);

	if($num == 0){

	// The number of results is still zero, so we did not vote on this adoptable yet today...
	
	// Now we see if the adoptable is frozen by its owner.  If it is, we do not level...

	if($isfrozen == "yes"){

	$article_title = $lang_isfrozen_title;
	$article_content = $lang_isfrozen_explain;

	}
	else{

	// Adoptable is NOT frozen, so I think we can actually proceed with the leveling up of this adoptable...

	$newclicks = $totalclicks + 1; // Add 1 click to the current click total of this adoptable...

	// Actually insert our click information into the database...

	$query = "UPDATE ".$prefix."owned_adoptables SET totalclicks='".$newclicks."' WHERE aid='".$id."'";
	mysql_query($query);

	// Now we need to update our vote_voters table with the user's vote...

	mysql_query("INSERT INTO ".$prefix."vote_voters VALUES ('$date', '$loggedinname', '$ip','$id')");

	// Now we need to see if we actually level this adoptable up...
	// See if another level actually exists...

	$nextlevelexists = getnextlevelexists($type, $currentlevel);

	if($nextlevelexists == "true"){

	// A higher level does exist, so we see if it is time to level up

	$nextlevel = $currentlevel + 1;

	$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
	$result = mysql_query($query);
	$num = mysql_numrows($result);

	//Loop out code
	$i=0;
	while ($i < 1) {
 
	$requiredclicks=@mysql_result($result,$i,"requiredclicks");  // The number of clicks required for the next level

	$i++;
	}	

	// Check if the number of clicks we have now is greater than or equal to the required clicks to level up...

	if($newclicks >= $requiredclicks and $requiredclicks != 0 and $requiredclicks != ""){

	// We need to level this adoptable up...

	$query = "UPDATE ".$prefix."owned_adoptables SET currentlevel='".$nextlevel."' WHERE aid='".$id."'";
	mysql_query($query);

	// Now we check if we are enabling alternate images...
	
	$parentid = converttypetoparentid($type); // Get the ID of the parent type adoptable
	$altstatus = getaltstatus($parentid, $id, $nextlevel); // Check if we are using alternate images or not...

	if($altstatus == "yes"){

	// We are enabling alternate images for this adoptable...

	$query = "UPDATE ".$prefix."owned_adoptables SET usealternates='yes' WHERE aid='".$id."'";
	mysql_query($query);


	}

	// Now we can see if the adoptable's owner gets a reward...
	// The reward function will take care of sending out any reward that exists...

	$rewardstatus = reward($id, $type, $nextlevel, $owner);

	

	} // End the if statement if we are leveling the adoptable up


	
	}

	// Show a thank you message along with the adoptable's information to the user...

	$image = getcurrentimage($id); // Get the current image of the adoptable...

	$article_title = $lang_gave."".$name." one ".$lang_unit;
	$article_content = "<img src='".$image."'><br>".$lang_gave."".$name." one ".$lang_unit.".<br>".$lang_levelup_encourage;
	

	} // Adoptable is not frozen, end isfrozen else check
	

	

	}
	else{

	// We already voted on this adoptable today, so show an error...

		if($isloggedin == "yes"){

		$article_title = $lang_alreadyleveled_title;
		$article_content = $lang_member_alreadyleveled;

		}
		else{

		$article_title = $lang_alreadyleveled_title;;
		$article_content = $lang_guest_alreadyleveled;


		}

	}


}
else{

// Adoptable is invalid, show an error...

$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;

}



} // End the ID is not blank and is numeric else check


// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file = $themeurl;

// Do the template changes and echo the ready template
$template = file_get_contents($file);

$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);

$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);

//Define our links
$template = replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...

$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);

//Get the ad content...
$template = replace(':ADS:',$ads,$template);

//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);


echo $template;

// **********************************************************************
// End Template Definition
// **********************************************************************



?>
Reply With Quote
  #10  
Old 04-02-2010, 12:07 AM
Magnie's Avatar
Magnie Magnie is offline
Pythonic
 
Join Date: Dec 2009
Location: Polaris, the Planet
Posts: 34
Gender: Male
Credits: 5,635
Magnie
Send a message via ICQ to Magnie
Default RE: Mod: Currency

I guess I could do it for you... I'll get it done asap. :)
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Currency Question ilrak Questions and Supports 1 03-09-2015 12:47 PM
Second Currency and Currency icon Rovick Suggestions and Feature Requests 14 11-11-2014 06:29 PM
New Release Currency trollis76 Suggestions and Feature Requests 19 05-27-2009 04:49 PM
Currency Mod Killgore Questions and Supports 1 04-10-2009 09:04 PM
New Release Currency trollis76 Questions and Supports 0 12-31-1969 07:00 PM


All times are GMT -5. The time now is 12:28 AM.

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