Jump to content

mmorpg help


tom527103

Recommended Posts

im currently making a mmorpg i have a bank php script and i want donator intrest to be higher then normal players intrest

$interest= $ir['bankmoney']/100*2 ;
$interests=money_formatter($interest);
$balance=money_formatter($ir['bankmoney']); 

 

^^^ i want that changed so if ($ir['donatordays'] > 0) donator days are higher then 0 then its 100*6 but normal intrest is 100*2

i can upload more of the bank code if needed but need help with this one as cant figure it out i am a noob and learning so if u have a snippet for it would

you be able to explain the code to make this work i do not expect to be spoonfed information but any help u could give would be great thanks

Link to comment
Share on other sites

what i mean is

 

$interest= $ir['bankmoney']/100*2 ;

 

^^ it still needs to have that part because that tells it the percent to give of the bank money its hard to explaine as my knowledge is limited on php

i want that part to be like

 

if ($ir['donatordays'] > 0) {

    $interest= $ir['bankmoney']/100*6

} else {

    $interest= $ir['bankmoney']/100*2

}

^^ but that doesnt work but i hope this gives u better understanding of what i mean

Link to comment
Share on other sites

tom please use code tags around your code.

 

mgoodman's code would of course require you to multiply his variable * $ir['bankmoney'], but it's cleaner than replicating the equation twice.  However with that said, your code works.  If you're not seeing what you expect it is probably because $ir['donatordays'] > 0 is not evaluating to true even though you expect it to be.  You need to determine why that is, using echo/print_r/ or var_dump of your variables.  Otherwise it could be something else further in your routines that save the computed balance. 

Link to comment
Share on other sites

sorry i forgot

 

i am very new to php how would i write a code to multiply his variable to bankmoney ?

 

would you be able to give me a snippet please and explain what each part of the code does if u could possibly ?

 

thanks 

Link to comment
Share on other sites

if ($ir['donatordays'] > 0) {
     $interest_rate = .06
} else {
     $interest_rate = .02
}
$interest= $ir['bankmoney'] * $interest_rate;

 

This willl not fix your problem because your existing code is already valid.  Like I said, you should add:

 

var_dump($ir);

 

Before your block and run the script and take a look at what is in the $ir array, making sure that the values are what you expect them to be.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.