Random Float? - 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 Float? (
/showthread.php?tid=75435)
Random Float? -
[nl]daplayer - 01.05.2009
Is there a function that creates a random float?
I searched the forum but can't find one
Re: Random Float? -
Bearfist - 01.05.2009
Try this one:
Code:
new Float:YourFunction[7][3] = //[7] number of random (@ my is 7) && [3] number of Values (0.0,0.0,0.0) @ mine 3
{
{-1130.9011,1076.9305,1353.4279}, //Put here your random whatever I added coords
{-1136.5948,1077.3739,1345.8052},
{-1083.2759,1045.3164,1343.3174},
{-1059.1899,1056.0432,1344.1494}},
{-1017.5864,1050.0138,1342.8647},
{-974.0999,1061.7153,1345.6708},
{-972.9766,1022.9188,1345.0541}
};
Bearfist
Re: Random Float? -
yom - 01.05.2009
try
pawn Code:
float(random(20000000)) / 1000
But why you need that?
Re: Random Float? -
[nl]daplayer - 01.05.2009
I got a open dm field, and i want the play to spawn random in the field, because the z is everywhere the same and there are no obstacles, and it's nicer to spawn completely random :P
The random float must be between (float)... and (float)..., so the spawn is completely random so nobody spawns in eachoter
P.S. Srry for my bad english, i am dutch
Re: Random Float? -
[nl]daplayer - 02.05.2009
Srry for double post, but i want to let you guys know il have found a solution for this.
I just use:
pawn Code:
new Float:x = 1.0 + random(10);
new Float:y = 2.0 + random(11);
new Float:z = 4.0;
It's just an example, so it's not useable :P