Spawning car system without repeating position
#1

Hello users, i am new to programming, I am creating a system derby .
The problem is that by using "random spawns " positions are repeated and users spawn above others.
How I can create a system of spawning cars without repeating positions?
Thank You.
(This is my first thread, sorry for my bad english, I'm using language translator)
Reply
#2

pawn Code:
new Float:Spawns[MAX_SPAWNS][4];
new bool:SpawnUsed[MAX_SPAWNS];


new randomspawn = random(MAX_SPAWNS);
while(SpawnUsed[randomspawn]==true))
{
    randomspawn++;
    if(randomspawn >= MAX_SPAWNS)randomspawn = 0;
}
SpawnUsed[randomspawn]=true;

//Im giving example for player, you do it for vehicles...
SetPlayerPos(playerid, Spawns[randomspawn][0],Spawns[randomspawn][1],Spawns[randomspawn][2]);
SetPlayerFacingAngle(playerid, Spawns[randomspawn][4]);
Reply
#3

Thank you very much , I will test them and then comment on the results.
Reply
#4

Hello , sorry for not responding sooner.
Regarding the code you gave me , I do not understand how it works , could explain ?, I 'm new to programming , sorry for the inconvenience
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)