[help] 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: [help] random (
/showthread.php?tid=85129)
[help] random -
Marc_307 - 05.07.2009
Hi, I want to make a random car color with all the 127 colors.
Have I to do new rc[]={0,1,3,...,and so on,...,127,126};, or is it possible to write it like rc[]={from 0 to 126};?
Re: [help] random -
Ignas1337 - 05.07.2009
can't you use random function? random(127) which would return a value from 0 to 126 you can use to set color as? ;]
Re: [help] random -
Andom - 05.07.2009
Код:
SetVehicleColor(vehicleid, random(126), random(126));
?
Re: [help] random -
Ignas1337 - 05.07.2009
that, won't select ALL random colors, there are 126 colors and 127 is 0, so if a random starts from 0 it hsould be 127 of size which would not make the car go black as this can't return 127. btw there are nice colors at 400+ 432 I think is verry dark green, looking sexy ;]
Re: [help] random -
Marc_307 - 05.07.2009
Thank you.
Quote:
can't you use random function?
|
Sorry, but I'm a beginner.
Re: [help] random -
Marc_307 - 05.07.2009
And what to do if I need numbers between e.g. 100 and 200?
Re: [help] random -
Ignas1337 - 05.07.2009
umm new rand = 100+random(101);
this would go for numbers 100 - 200. figuring how it works? ;]
Re: [help] random -
dice7 - 05.07.2009
I use this system, It's easier to remember
random(max-min+1)+min;