19.08.2009, 09:20
This could be done with the file functions & sscanf:
The file would have to look like this:
Just do LoadSpawns() in OnGameModeInit and the spawns will go nicely into the Spawns array.
To spawn a player:
pawn Код:
//On top of the script
//20 spawns for example
new Float:Spawns[20][3];
//Somewhere below
stock LoadSpawns()
{
new read[15];
new File:fSpawns = fopen("filename.txt", io_read);
new Float:x, Float:y, Float:z;
new i = 0;
while(fread(fSpawns, read))
{
if(!sscanf(read, "fff", x, y, z))
{
Spawns[i][0] = x;
Spawns[i][1] = y;
Spawns[i][2] = z;
i++;
}
}
fclose(fSpawns);
return 1;
}
pawn Код:
1235.756 789.123 785.12
1337.999 5543.65 15.992
To spawn a player:
pawn Код:
SetPlayerPos(playerid, Spawns[0][0], Spawns[0][1], Spawns[0][2]);