Absolute and Round - 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: Absolute and Round (
/showthread.php?tid=361686)
Absolute and Round -
BlackAtom - 21.07.2012
Hi! There are these functions in Pawno?
Make absolute a variable, like abs(x) or something like this? (for example, -6 makes 6)
Round a variable, like round(x) or something else? (for example, 1.4 makes 1, 1.6 makes 2, and go on...)
If I need an Include, can you give me the file, please



?
Re: Absolute and Round -
ViniBorn - 21.07.2012
floatabs
floatround
Re: Absolute and Round -
[KHK]Khalid - 21.07.2012
Use this stock for absolute
pawn Код:
stock abs(digit)
{
return ((digit < 0) ? (digit * -1) : (digit));
}
and for round
https://sampwiki.blast.hk/wiki/Floatround
Re: Absolute and Round -
Larceny - 21.07.2012
floatround
Floatround method
pawn Код:
stock Absolute(value)
{
if(value < 0) {
value = value * -1;
}
return value;
}
I didn't see the posts above
Re: Absolute and Round -
BlackAtom - 21.07.2012
Thank you

!