Random spawns - How to detect if a spawn is "Used"? - 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 spawns - How to detect if a spawn is "Used"? (
/showthread.php?tid=499421)
Random spawns - How to detect if a spawn is "Used"? -
rangerxxll - 08.03.2014
So I'm about to create a random spawn system, which will place players (a maximum of 30.) around a center piece. (Think of the hunger games.) I understand how to set their spawn to be random, but how do I make it so only one player can spawn in one place? So two people don't spawn on each other.
I'm sort of asking how to skip a spawn position if it's occupied. Where would I start?
Re: Random spawns - How to detect if a spawn is "Used"? -
SPA - 08.03.2014
I don't know what do you mean but maybe:
Код:
new Float:RandomPlayerSpawns[][] = {
{//ADD POISTION HERE},
{//ADD POISTION HERE}
};
OnPlayerSpawn:
Код:
new rand;
rand = random(sizeof(RandomPlayerSpawns));
SetPlayerPos(playerid, RandomPlayerSpawns[rand][0], RandomPlayerSpawns[rand][1], RandomPlayerSpawns[rand][2]);
Re: Random spawns - How to detect if a spawn is "Used"? -
rangerxxll - 08.03.2014
As I've stated, I understand how to make random spawns. But how do i make sure two players dont spawn at the same location?
Re: Random spawns - How to detect if a spawn is "Used"? -
SPA - 08.03.2014
Ammmm, I don't know if possible ,but maybe by adding check point in the spawn position .
Re: Random spawns - How to detect if a spawn is "Used"? -
Yashas - 08.03.2014
Efficient Multiple Spawning System
If you are doing random spawns and want to ensure that no player spawns near each other then use the link above.By random I mean a spawn from a set of fixed number of spawns.Not randomly creating one.