01.03.2014, 10:37
make a counter;
this will update the counter when a player has spawned in the race.
the first player to join the race, spawns at the first row of the array ( -1418.0464,-667.8558,1058.8853 ).
the counter updates, it becomes 1.
second player spawns at the coordinates of row 1.
although I prefer using random positions, even though players could spawn ontop of eachother, it'll happen rarely aslong as you've got enough rows in your array.
pawn Код:
new pCounter = 0; // ontop of your script.
// in the callback.
if( pCounter > sizeof( StartPositions[ ] ) ) return SendClientMessage( playerid, -1, "no more slots available" ); // checking if there's still a slot available in the array, if not, it won't spawn the player at the race because it could crash the server / spawn the player at coords 0,0,0( the farm ), or some memory failures could occur.
SetVehiclePos(GetPlayerVehicleID( playerid ),SpawnPos[pCounter][0],SpawnPos[pCounter][1],SpawnPos[pCounter][2]); // setting the player's vehicle to the right pos.
pCounter++; // updating the counter.
the first player to join the race, spawns at the first row of the array ( -1418.0464,-667.8558,1058.8853 ).
the counter updates, it becomes 1.
second player spawns at the coordinates of row 1.
although I prefer using random positions, even though players could spawn ontop of eachother, it'll happen rarely aslong as you've got enough rows in your array.