SA-MP Forums Archive
dividing numbers - 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: dividing numbers (/showthread.php?tid=662737)



dividing numbers - Kevinas100 - 09.01.2019

hi , I want to do something like let's say if(4%2 == 0)
but samp doesn't have the function of % dividing, is there another available option?


Re: dividing numbers - Chyakka - 09.01.2019

% is used for modulo and / is used for division.

Using
Code:
if(4%2 == 0) //do whatever
Is completely valid in PAWN.


Re: dividing numbers - Kevinas100 - 10.01.2019

Quote:
Originally Posted by Chyakka
View Post
% is used for modulo and / is used for division.

Using
Code:
if(4%2 == 0) //do whatever
Is completely valid in PAWN.
I forgot it's called modulo, but what about floats?


Re: dividing numbers - Kaliber - 10.01.2019

For dividing, use https://sampwiki.blast.hk/wiki/Floatdiv

Modulo Operation on Floats makes no sense, cause you have no remainder