Not using used random values - 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: Not using used random values (
/showthread.php?tid=620690)
Not using used random values -
NeXoR - 01.11.2016
Alright, here is something I was wondering about
Let's say I am making an act, which every player is spawned in a random position out of X positions, and I don't want two players to spawn in the same location, how can I prevent this ?
Re: Not using used random values -
Nero_3D - 01.11.2016
You could (if positions are stored in an array)
- mark the already taken locations and reroll (not recommended)
- only randomize location which haven't been taken (remove already taken locations from the array)
- shuffle the complete array beforehand
Re: Not using used random values -
Marricio - 01.11.2016
Use y_iterate, init the values, use Iter_Random and remove them from the list once someone has spawned there.
Or, just use a variable to store used spots.
Re: Not using used random values -
NeXoR - 01.11.2016
Quote:
Originally Posted by Marricio
Use y_iterate, init the values, use Iter_Random and remove them from the list once someone has spawned there.
Or, just use a variable to store used spots.
|
I have already thought about what you have suggested, I made the thread to see if there are any other options, anyways, thanks both