Create an enum that holds Float values for the spawn coordinates, and a boolean that is set to true when the spawn becomes occupied and false when it's not. Then declare a two-dimensional array with that enum, the first dimension being 9 and the second dimension being the enum.
As for making them spawn points, I'd suggest creating a function with a loop that finds the first available spawn coords from the array, skipping spawn points that have their boolean set to true. Once the first available spawn coordinates are found, set the boolean for those spawn coords to true. Teleport that player to those coordinates. Then call that function under OnPlayerSpawn. You could also try using SetSpawnInfo, which looks a little smoother, but the method above would have to work differently. Don't forget to set the boolean to false at some point (once the player dies, for example).
Here's an example of how you could approach this:
pawn Код:
enum E_SPAWN_DATA
{
Float:e_spawnX,
Float:e_spawnY,
Float:e_spawnZ,
bool:e_isOccupied
// note that these values are constants; you can't set default values in enums!
}
new gSpawnCoords[9][E_SPAWN_DATA];
stock SetPlayerSpawn(playerid)
{
// Loop through array
for (new i = 0; i < sizeof(gSpawnCoords); i++) {
// check if gSpawnCoords[i][e_isOccupied] is true
// if true continue
// if false, teleport player to spawn coords of index i, set isOccupied to true, and return/break
}
}
public OnGameModeInit()
{
// Set default values of isOccupied to false and your spawn coord data here
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerSpawn(playerid);
return 1;
}