How do I check if the remainder is zero? - 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: How do I check if the remainder is zero? (
/showthread.php?tid=604795)
How do I check if the remainder is zero? -
NeXoR - 10.04.2016
Yes it's just math but I don't know how to write it in Pawn, First time I use Remainder in my script
Let's say FireHealth is the HP of the ongoing fire
I want to gametext the player something when FireHealth is divided by 20 and remainder equals 0
(Fire HP starts with 100, it will gametext on 80 60 40 20)
if(FireHealth/20 == 0)
{
GameTextForPlayer etc etc
}
Is there a shorter version for FireHealth/20 == 0 ?
Re: How do I check if the remainder is zero? -
Vince - 10.04.2016
Simply use the modulo operator.
PHP код:
if(FireHealth % 20 == 0)
Re: How do I check if the remainder is zero? -
NeXoR - 10.04.2016
Quote:
Originally Posted by Vince
Simply use the modulo operator.
PHP код:
if(FireHealth % 20 == 0)
|
Exactly ! I forgot the percent sign
Thanks