[HELP] question about coords.
#10

This could be done with the file functions & sscanf:
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;
}
The file would have to look like this:
pawn Код:
1235.756 789.123 785.12
1337.999 5543.65 15.992
Just do LoadSpawns() in OnGameModeInit and the spawns will go nicely into the Spawns array.
To spawn a player:
pawn Код:
SetPlayerPos(playerid, Spawns[0][0], Spawns[0][1], Spawns[0][2]);
Reply


Messages In This Thread
[HELP] question about coords. - by arnutisz - 18.08.2009, 18:18
Re: [HELP] question about coords. - by dice7 - 18.08.2009, 18:22
Re: [HELP] question about coords. - by arnutisz - 18.08.2009, 19:28
Re: [HELP] question about coords. - by dice7 - 18.08.2009, 19:40
Re: [HELP] question about coords. - by arnutisz - 18.08.2009, 20:25
Re: [HELP] question about coords. - by CAR - 18.08.2009, 20:32
Re: [HELP] question about coords. - by dice7 - 18.08.2009, 20:57
Re: [HELP] question about coords. - by CAR - 19.08.2009, 07:03
Re: [HELP] question about coords. - by dice7 - 19.08.2009, 07:19
Re: [HELP] question about coords. - by bogeymanEST - 19.08.2009, 09:20

Forum Jump:


Users browsing this thread: 5 Guest(s)