Help with randoming from a file
#1

I've got this:

pawn Код:
LoadRandomSpawnFromFile(const team[])
{
    new File:file, str[128];
    format(str, sizeof str, "CoDS/Maps/%s/%sspawns.ini", MapName, team);
    file = fopen(str, io_read);
    if (!file) return 0;
    new
      line[128],
      count = 0,
      Float:X, Float:Y, Float:Z, Float:A;

    while (fread(file, line))
    {
      if (!sscanf(line, "ffff", X, Y, Z, A))
      {
        format(str, sizeof str, "%f %f %f %f",X, Y, Z, A);
        count++;
      }
    }
    fclose(file);
    return count;
}
Which formats all the team spawn points in the file, how do I then random all those spawns and SetPlayerPos in one of the random spawns?
I know to do SetPlayerPos but how do I random the spawns after formatting them all?

Thanks.
Reply
#2

I'm completely stuck with this, anyone know how to do it?
Reply
#3

This is getting so frustrating.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)