SA-MP Forums Archive
floatround problem [FIXED] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: floatround problem [FIXED] (/showthread.php?tid=570202)



floatround problem - Excel™ - 06.04.2015

Is there anyway i can just round off to a higer value always. I tried other methods in roundoff param. But none worked. I want that if i floatround (1.1) it returns it as (2.0) !


Re: floatround problem - Abagail - 06.04.2015

Try
pawn Код:
stock Roundup(Float: val) {
      return floatround(val, floatround_round);
}
Untested.


Re: floatround problem - Excel™ - 06.04.2015

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Try
pawn Код:
stock Roundup(Float: val) {
      return floatround(val, floatround_round);
}
Untested.
That wont even work! Its just a new definition of the function without the param (method)!
And i solved it :P

pawn Код:
new result = 0;
new items = 50;
new Float:value = items / 15.0;
            if((floatround((items / 15))) >= value)
            {
                result = floatround((items / 15));
            }
            else
            {
                result = floatround((items / 15)) +  1;
            }



Re: floatround problem [FIXED] - Threshold - 06.04.2015

https://sampwiki.blast.hk/wiki/Floatround
https://sampwiki.blast.hk/wiki/Floatround_method

pawn Код:
floatround(items/15, floatround_ceil);
Nice..


Re: floatround problem [FIXED] - Excel™ - 06.04.2015

Quote:
Originally Posted by Threshold
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/Floatround
https://sampwiki.blast.hk/wiki/Floatround_method

pawn Код:
floatround(items/15, floatround_ceil);
Nice..
I had that before but it didn't worked, idk why!

Here i made a debug:
pawn Код:
main()
{
    printf("%d", floatround(38/15, floatround_ceil));
}
Result:
pawn Код:
2