Float problem
#1

I'm trying to multiply the interest by the money they have in total in the bank but for some reason it's not working. It's printing 0.00 and I'm not sure the reason of why it's doing this. Any help would be greatly appreciated.

PHP код:
        new FloatInterestRate;
        
//Interest Rates
        
if(PlayerInfo[playerid][pVIP] == 0)
        {
            
InterestRate 0.01;
        }
        else if(
PlayerInfo[playerid][pVIP] == 1)
        {
            
InterestRate 0.015;
        }
        else if(
PlayerInfo[playerid][pVIP] == 2)
        {
            
InterestRate 0.02;
        }
        else if(
PlayerInfo[playerid][pVIP] == 3)
        {
            
InterestRate 0.03;
        }
        else
        {
            
InterestRate 0.01;
        }
        
printf("Interest1: %.3f"InterestRate); 
Reply
#2

Why are you doing else if?
You can use just 'if' statements here if I'm correct..
Reply
#3

It wouldn't matter because it should select through that list and assign a value, if it doesn't find it, then it should set it to 0.01. Any ideas?
Reply
#4

IF im not mistaken, you cant do Float: Interest it has to be Float:Interest, its the only thing im seing. and you are doing good using else if. In a larger code it can play a big role in performance.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)