Thread: Mod: Currency
View Single Post
  #1  
Old 03-04-2010, 09:50 PM
Magnie's Avatar
Magnie Magnie is offline
Pythonic
 
Join Date: Dec 2009
Location: Polaris, the Planet
Posts: 34
Gender: Male
Credits: 4,945
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