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)
+--- Thread: random (
/showthread.php?tid=615588)
random -
MerryDeer - 24.08.2016
Hi,
I need random number from 0 to 9 i use that
random(10) but i don't want numbers 1,8,7 how to drop them?
Re: random -
jlalt - 24.08.2016
you can simple use while loop here is a example below
PHP код:
new myvalue = random(10);
while(myvalue == 1 || myvalue == 8 || myvalue == 7)
{
myvalue = random(10);
}
you can read more about while on this page
https://sampwiki.blast.hk/wiki/While#while
Re: random -
AbyssMorgan - 24.08.2016
PHP код:
new array[] = {0,2,3,4,5,6,9};
new myvalue = array[random(sizeof(array))]