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
https://forums.phpfreaks.com/topic/237478-mmorpg-help/
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
https://forums.phpfreaks.com/topic/237478-mmorpg-help/#findComment-1220301
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
https://forums.phpfreaks.com/topic/237478-mmorpg-help/#findComment-1220304
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
https://forums.phpfreaks.com/topic/237478-mmorpg-help/#findComment-1220311
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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