Mathematical Problem
1 Attachment(s)
So I want to know what percentage of the level he is at, but the number displayed in the hud is always wrong
PHP Code:
and this is how i display it PHP Code:
in the case of this picture it has to be 23.08 % the porcentage displayed, but it is 100 :s |
Re: Mathematical Problem
Quote:
|
Re: Mathematical Problem
Code:
Restantes: %s (%d%%) |
Re: Mathematical Problem
Also, make sure that the values that you are dividing are floating-point values. I'm guessing that they are currently integers. So, if they are indeed integers, you'll need to use float() on them to make sure that you aren't doing integer division.
|
Re: Mathematical Problem
PHP Code:
|
Re: Mathematical Problem
The problem is that you are dividing an integer with an integer just like fysiks said and after that you multiply by 100.
Here's a simple example to show you why it doesn't work: Code:
As you can see, as long as the multiplication is done before division the result is what you expect. Here are the options you have. Code:
|
SOLVED Mathematical Problem
yes, that was the problem, thanks man
|
| All times are GMT -4. The time now is 04:32. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.