SA-MP Forums Archive
Random(); - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random(); (/showthread.php?tid=102290)



Random(); - Marc_307 - 14.10.2009

Hey folks,
I'm using a varible to get an random gravity.
pawn Код:
new Float:RandomGravity=random(24)/2000+0.002;
SetGravity(RandomGravity);
Now the problem is that I always get a the same gravity (0.002).
That means the random function has always the value 0.
What's wrong?


Re: Random(); - yom - 14.10.2009

Always divide by a float.


Re: Random(); - Marc_307 - 15.10.2009

Quote:
Originally Posted by 0rb
Always divide by a float.
pawn Код:
new Float:RandomGravity=random(24)/2000.000+0.002;
SetGravity(RandomGravity);
Thank you, it works.