Jump to content
MakeWebGames

Recommended Posts

Posted

Currency Mod

havent posted in a while here you go

this mod will replace the current money_formatter in the global functions file along with 2 sql edits and a few php edits this will allow your members to have diffrent currencys these are USD, GBP, YEN, EURO PLUS they have the current conversion rate so if you had usd and changed to yen you money wouldent be 100 it would be 9800. :D

all you do is go throgh your scripts and money format any HTML values of money e.g.

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

would be

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

REMOVE THE $

that 500 will become the currency you have plus the conversion rate too :D

DO NOT ALTER ANY FILES UNLESS YOU HAVE BACKED THEM UP YOU COULD ALSO BACK UP YOUR DB BUT NOT NESASARY AS THERE IS VERY LITTLE SQL IN THIS MOD

Run SQLs

ALTER TABLE `users` ADD `cur` VARCHAR( 5 ) NOT NULL

UPDATE `users` SET `cur`='USD'

OPEN prefrences.php

FIND

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

add after

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

FIND

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

ADD AFTER

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

FIND

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Add before

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

OPEN global-functions.php

FIND

function money_formatter($muny,$symb='$')

{

return $symb.number_format($muny);

}

replace with

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

when adding this function to your game moneyformat every single price in your game eg if you have shops, jail break etc... just find

the html text and wrap moneyformatter(); around it

use

'. and .'

or

". and."

depending on what the echo/print is using

 

DO NOT DO IT ON THE MYSQL_QUERY FUNCTIONS or with IF/ELSE ONLY DO THIS TO HTML TEXT!! this si so if you have 1 usd and you wanted to

spend it and your currency was yen it would take away 98 usd from your bank/hand!!

 

 

 

please note DONT DO THIS if you are a beginer at php it can possably f**k up yur game if done wrongly

 

 

too add currencys add the shorted version eg USD and the symbol $ so it would be like this 'USD'=>'$', then add the conversion rate

PLEASE note i have done the currencys throgh xe.com (12.JUNE.2009) compared to the USD

also dont forget to add <option value='currency shortned values eg USD'>'currency name'</option> to the change currancy file

 

if you want me to install this onto your site i charge $1.00 USD per page i edit i also chage $1.00USD to add new currancys

enjoy,

Dayo

ps sorry about the spelling most of this was done on my ipod so forgive me :D

  • Thanks 1
Guest Sniko`
Posted

Re: [mccodes][V2]changable currency mod

i must agree +1

Posted

Re: [mccodes][V2]changable currency mod

i did only use one function ... also about security all this does is turn a string into another string so 100 looks like

$100

Posted

Re: [mccodes][V2]changable currency mod

 

i did only use one function ... also about security all this does is turn a string into another string so 100 looks like

$100

Was on about the preferences bit :/

Posted

Re: [mccodes][V2]changable currency mod

im making an admin CP for this so you dont have to manualy add diffrent currencys and change there conversion plus im gona do it so if you travel from one country to the other it will automaticly change it so if you were in england it would be GBP then if you went to china it would be YEN

good idea or not cos im not gona do it if no 1 would use

Posted

Re: [mccodes][V2]changable currency mod

Nice Dayo. Coming up with some good modifications,cant wait to see the Admin Control Panel and seeing how it works. +1 :-D

Posted

Re: [mccodes][V2]changable currency mod

yea that looks good i would do that but CBA :P

off topic

no offence but y havent you got a better template? if i were to register i would take 1 look and close the window it looks so unatractive

Posted

Re: [mccodes][V2]changable currency mod

 

yea that looks good i would do that but CBA :P

 

off topic

no offence but y havent you got a better template? if i were to register i would take 1 look and close the window it looks so unatractive

Not my game, just the game I'm the "Chief Website Developer" of..

  • 4 weeks later...
Posted

Re: [mccodes][V2]changable currency mod

Hey, I Know It's Not A Big Problem... But Next Time Dayo Could You Capitalize The First Letter... I.e >>> your currency has been changed. Better Looking Like This : Your currency has been changed.

 

 

But Great Mod, +2

Posted

Re: [mccodes][V2]changable currency mod

 

Hey, I Know It's Not A Big Problem... But Next Time Dayo Could You Capitalize The First Letter... I.e >>> your currency has been changed. Better Looking Like This : Your currency has been changed.

 

 

But Great Mod, +2

Doe's that really matter? No. You can edit it your self.

Posted

Re: [mccodes][V2]changable currency mod

Or And Another Thing,

 

When Someone Views A User That Has Their Currency Changed It Doesn't Show Their New Currency....

 

Could Someone Do That For Me Please... I Would Do It But I Don't Know How To Yet...

Posted

Re: [mccodes][V2]changable currency mod

 

Or And Another Thing,

 

When Someone Views A User That Has Their Currency Changed It Doesn't Show Their New Currency....

 

Could Someone Do That For Me Please... I Would Do It But I Don't Know How To Yet...

eh? i didn't understand what you said. lol

Posted

Re: [mccodes][V2]changable currency mod

Ok, I Changed My Currency On My Game Im Making, And It Only Changes It On Your Index.php Page, So When Someone Views My Profile It Doesn't Show That My Currency Is GBP, It Just Shows A $...

 

And Another Thing I Found Out Just Now, Is This, I'll Show A Pic

Preview.gif

 

When I Changed My Currency To GBP It Put The Pound Sign In Front Of Everything...

Posted

Re: [mccodes][V2]changable currency mod

:| anyone just thought to throw in an array with a simple if statement to change the currency to where you travel ie

$array=array(1 => '$', 2 => '?');

and then simply matching the number for each array to the city id......... and then replacing in the money_formatter function the $ for the variable.... just an idea shoot down my logic if there is a problem with it

Posted

Re: [mccodes][V2]changable currency mod

there is it changes by location :D

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

also @SMOKEY_TEK y have you money formated every number on the index page?

Posted

Re: [mccodes][V2]changable currency mod

Been looking and testing both ideas to be honest this will work for the value of the money but does not change the cost of an item.... so if i fly to location 3 with $100 i would end up with ?9,800

but a $5000 item would still cost ?5,000 makeing users unbeliavably rich so in simple terms it would be easiest to create a completely new php file and using some if statments and haunted dawg's idea of:

function buffer($output) {

return str_replace('$','?', $output);

}

ob_start('buffer');

and

function buffer($output) {

$money=($ir['money']*98.111111);

return str_replace('whatever you use as money','$money', $output);

}

ob_start('buffer');

and

function buffer($output) {

$itemprice=($your_item_price*98.111)

return str_replace('whatever your item price is','$itemprice', $output);

}

and that should be all remember this is just for illustrative purposes only would be more than glad if any one wants to actually finish it lol its 4 am for me and i really cant be bothered :mrgreen:

ob_start('buffer');

Posted

Re: [mccodes][V2]changable currency mod

What my script does is before all the html and stuff is produced, it will change $ to ? as people wan't to change $ to ? and they won't need to do it through the entire script :/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...