Quote:
Originally Posted by Nero_3D
You should have used && (and) not or, or you just invent it like that
pawn Код:
new Float: frac = floatfrac(Float) ; if(!(fract == 0.00 || fact == 0.25 || fract == 0.50 || fract == 0.75)) return SendClientMessage(playerid, -1, "Invalid amount"); // also I am not sure if that also works or is faster if(floatfrac(floatfrac(Float) / 0.25) == 0.0) return SendClientMessage(playerid, -1, "Invalid amount");
|
pawn Код:
new Float:frac = floatfract(usd);
printf("FRACT : %f", frac);
if(!(frac == 0.00 || frac == 0.25 || frac == 0.50 || frac == 0.75)) return SendClientMessage(playerid, -1, "Invalid amount");
It's not working, returns "Invalid amount", And it prints nothing but some sscanf warning
Quote:
Originally Posted by Emmet_
Oh, sorry. Try this then:
pawn Код:
stock floatmultiple(Float:number, Float:dest) { while (number >= dest) number -= dest;
return (!number); }
And then:
pawn Код:
if (floatmultiple(num, 0.25)) { // ... }
Because modulus operators don't work with floats, so that's the only way.
|
I think you still didn't get me, Or I don't understand that code very well
I want to give a float to a player, which will be "Any Number.00" Or "AnyNumber.25" and so on, I thought there is a way to get the numbers after the "." and try to compare them.. If there isn't any, Then I can use a loop through like 50/100 numbers and compare the numbers after the "."..