Simple Machine Codes

Forum Coding => SMF For Free Codes => Topic started by: Agent Moose on May 30, 2007, 12:05:34 pm



Title: Money Code
Post by: Agent Moose on May 30, 2007, 12:05:34 pm
Finnally, a code that eveyone wants.  The Money Code!!!  It took me forever to finish, but I got it done.  It isn't the the place I want it, but it works for now.  It showes up under the AIM and MSN icons...

Code:
<script>
function smc_money_code(name,sign,amount){
//Created by Agent Moose at smcodes.smfforfree3.com
c = document.getElementsByTagName("div");
for(v=0;v<c.length;v++){
if(c[v].className=="smalltext" && c[v].innerHTML.match(/Posts: (\d+)/)){
var total = amount * RegExp.$1;
c[v].innerHTML+="<br />" + name+": " + sign + total;
};};}
smc_money_code("MONEY NAME","SIGN","AMOUNT PER POST")
</script>

This is simple
MONEY NAME is the name of the money...(eg: Money)
SIGN is the sign of the money(eg: $)
AMOUNT PER POST is how much you get per post(eg: 5[The number you put will be multiplied the posts.])

EDIT:  I forgot to tell you people something.  If you want to decrease someones money, decrese there post count by going to there profile.


Title: Re: Money Code
Post by: deathwilldie on May 30, 2007, 08:07:58 pm
This is a great code.  Is it the only one that SMF has?


Title: Re: Money Code
Post by: Agent Moose on June 01, 2007, 02:00:39 pm
Well, it is the only one that SMF for Free Has.


Title: Re: Money Code
Post by: deathwilldie on June 01, 2007, 02:11:58 pm
Im sure that alot of people will use this then.


Title: Re: Money Code
Post by: LaundryLady on June 15, 2007, 04:58:32 am
I am using it and my members love it.  They are always making suggestions as to what they think they can buy with it, heh heh.  Someday I will tell them it's not real money. 


Title: Re: Money Code
Post by: Agent Moose on June 15, 2007, 11:30:07 am
lol, you might wanna do that soon...lol


Title: Re: Money Code
Post by: deathwilldie on June 17, 2007, 02:50:29 pm
You need to somehow make it have a donate thing.


Title: Re: Money Code
Post by: NOOB MUFFIN on June 27, 2007, 03:02:15 pm
where is the headers section?


Title: Re: Money Code
Post by: Celebrus on June 29, 2007, 11:27:47 am
Your Forums|Admin|Manage Styles|Edit Headers/Footers.
Hey could you have it show up somewhere near the the place where it shows the amount of time logged in. It would be nice if the member didn't have to go see his posts to find out how much 'money' he has.


Title: Re: Money Code
Post by: Agent Moose on June 29, 2007, 02:17:06 pm
I have tried to do that.  But I only got it to show when your veiwing the topic.  Which wouldn't be much help...I will work more on it.


Title: Re: Money Code
Post by: Celebrus on July 19, 2007, 06:01:05 am
I got it to show up in the user's area correctly when viewing a post. Otherwise, it shows null as the money so I got it off. To use it, you need this cookie library. So ensure you have this in your headers:
Code:
<script src="http://vikhyatk.googlepages.com/vikhyatscookielibrary.js">//Vikhyat's cookie library</script>

And this is the code:
Code:
<script>
function smc_money_code(name,sign,amount){
//Created by Agent Moose at smcodes.smfforfree3.com
//Edited by Vikhyat at smcodes.smfforfree3.com
$(function() {
c = $("div")
for (v=0;v<c.length;v++)
if((c[v].className=="smalltext")&&(c[v].innerHTML.match(/Posts: (\d+)/))){
total = amount*RegExp.$1
setcookie("money"+name+amount+sign,total);
c[v].innerHTML+="<br />"+name+": "+sign+total+""
}
var moneyobtainedfromcookie=getcookie("money"+name+amount+sign);
if(moneyobtainedfromcookie) {
texttoshowinusersarea=name+": "+sign+moneyobtainedfromcookie;
$("#upshrinkHeader td table tr td.windowbg2").append(texttoshowinusersarea);
};});}
smc_money_code("MONEY NAME","SIGN","AMOUNT PER POST")
</script>

Let me give you a little advice to check if all the codes you are using are compatible with each other. Get a test forum and put in all the codes you are using in the order you are using them. And have some posts there to check if they all work fine together.
You might also want to mention in your TOS that there are actually 2 cookies your site is using. Oh, and by the way, this is a preview: vikhyatstestforum3.smfforfree3.com (http://vikhyatstestforum3.smfforfree3.com).


Title: Re: Money Code
Post by: LaundryLady on July 19, 2007, 09:45:49 am
Quote
Let me give you a little advice to check if all the codes you are using are compatible with each other. Get a test forum and put in all the codes you are using in the order you are using them. And have some posts there to check if they all work fine together
.


This is a good thing to do.  It will keep you from destroying your main forum while you see if a particular code will work for you.


Title: Re: Money Code
Post by: Agent Moose on July 19, 2007, 10:13:20 am
One thing to do, don't test codes on your main forum, made that mistake about a day or two ago.


Title: Re: Money Code
Post by: Frost on July 21, 2007, 02:23:41 am
One thing to do, don't test codes on your main forum, made that mistake about a day or two ago.

Ah luckily mine was a success. I makin a test forum now  :D


Title: Re: Money Code
Post by: Agent Moose on July 22, 2007, 07:16:48 pm
Be smart and make a test forum before making new codes.


Title: Re: Money Code
Post by: Celebrus on August 12, 2007, 06:13:13 am
EDIT:  I fot got to tell you people something.  If you want to decrease someones money, decrese there post count by going to there profile.

Suggestion: You can use an array to have a list of people from whom to deduct money and by how much and then if there is a match, deduct that amount from the money while calculating. You wouldn't have to deduct their post count then.


Title: Re: Money Code
Post by: LaundryLady on January 21, 2008, 11:22:42 am
Is anyone having a problem using this with Sibyls draggable smilies?  Does it need to be upgraded to the new js?


Title: Re: Money Code
Post by: Celebrus on January 22, 2008, 02:52:25 am
It's happening to my draggable nav box thingy too. No idea what has to be done.


Title: Re: Money Code
Post by: Magestickown on January 27, 2008, 09:40:13 pm
My god. I cant see my money. When I put etheir code in. I really need help


Title: Re: Money Code
Post by: Celebrus on January 28, 2008, 03:02:15 am
It appears under your post count in posts.


Title: Re: Money Code
Post by: Myrtle on February 05, 2008, 06:15:19 am
Thank I really want this code but I'll ask my members first :)


Title: Re: Money Code
Post by: Agent Moose Jr. on February 05, 2008, 02:17:31 pm
you should try the money code v2


Title: Re: Money Code
Post by: sergeim on July 18, 2008, 05:20:47 am
i need help what codes workes? and where do you put them?


Title: Re: Money Code
Post by: Agent Moose on July 18, 2008, 09:08:24 am
This code should work, place it in your footers.

One thing though, if you don't have this in your headers, go ahead and add it to the very top:
Code:
<script src="/jquery.js"></script>


Title: Re: Money Code
Post by: legend 1234 on July 19, 2008, 06:24:45 am
Is anyone having a problem using this with Sibyls draggable smilies?  Does it need to be upgraded to the new js?

woow i didnt even no we had mods :S


Title: Re: Money Code
Post by: sergeim on July 19, 2008, 08:41:17 pm
<script src="/jquery.js"></script> i add it to the top now what? what do i add next?


Title: Re: Money Code
Post by: legend 1234 on July 20, 2008, 05:54:32 am
now you add the code into the footers

and it should work