SA-MP Forums Archive
Loading objects from a file - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Loading objects from a file (/showthread.php?tid=94135)



Loading objects from a file - Gappy - 28.08.2009

Can someone please try to explain to me how I can do this? and/or show me a little example?


Re: Loading objects from a file - Zeex - 28.08.2009

pawn Код:
LoadObjectsFromFile(const filename[])
{
    new
      File:file = fopen(filename, io_read);
    if (!file) return 0;
    new
      line[128],
      count,
      modelid,
      Float:X, Float:Y, Float:Z,
      Float:rX, Float:rY, Float:rZ;
    while (fread(file, line))
    {
      if (!sscanf(line, "iffffff", modelid, X, Y, Z, rX, rY, rZ))
      {
        CreateObject(modelid, X, Y, Z, rX, rY, rZ);
        count++;
      }
    }
    fclose(file);
    return count;
}



Re: Loading objects from a file - Gappy - 28.08.2009

Thanks