Percentage problem
#2

Since you are dividing 10 by 100 you are getting a float instead of an integer.
So you will have to change
Quote:

new tax;

to
Quote:

new Float: tax;

For dividing floats you need to use the function:
Quote:

floatdiv(Float:dividend, Float:divisor)

So your code would look like this:
Quote:

tax = floatdiv(GovTax/100)*PlayerInfo[playerid][pSigncheck];
format(m, sizeof(m), "Tax: %f", tax);

You should use the function floatround to convert this float to an integer if you intend to use it that way. https://sampwiki.blast.hk/wiki/Floatround
Reply


Messages In This Thread
Percentage problem - by akib - 13.03.2019, 14:12
Re: Percentage problem - by justinnater - 13.03.2019, 15:47
Re: Percentage problem - by NaS - 13.03.2019, 16:56
Re: Percentage problem - by justinnater - 13.03.2019, 18:26

Forum Jump:


Users browsing this thread: 2 Guest(s)