Szerző Téma: Object betöltési hiba.  (Megtekintve 448 alkalommal)

Nem elérhető SnooP

  • 1798
  • SnooP
    • Profil megtekintése
Object betöltési hiba.
« Dátum: 2013. Március 19. - 20:35:22 »
0 Show voters
Helló írtam egy olyan kis stock-ot amivel tudok menteni és betölteni streamer-el elmentett objecteket. A mentés tökéletesen mûködik a fájlba be is írja az object pozicíóját ám a betöltéssel már gondok vannak, nem tudom hol lehet a hiba sajnos  :hmmm:
A mentés:
 

stock Objectment()
{
new idx = 1, File:file;
new string[1300];
while(idx < S_MAX_OBJECTS)
{
    format(string, sizeof(string), \"%d|%f|%f|%f|%f|%f|%f|%d\\r\\n\",
        Object[idx][oID],
Object[idx][oPos][0],
Object[idx][oPos][1],
Object[idx][oPos][2],
Object[idx][oPos][3],
Object[idx][oPos][4],
Object[idx][oPos][5],
Object[idx][oCreated]
);
    if(idx == 1)
    {
        file = fopen(\"objectek.cfg\", io_write);
    }
    else
    {
       file = fopen(\"objectek.cfg\", io_append);
    }
fwrite(file, string);
fclose(file);
idx++;
}
print(\"Az objectek sikeresen mentve\");
}

 
Betöltés
 

stock Objectbetolt()
{
new oinfo[8][48];
new string[512];
new File:file = fopen(\"objectek.cfg\", io_read);
if(file)
{
    new idx = 1;
while(idx < S_MAX_OBJECTS)
{
    fread(file, string);
    split(string, oinfo, \'|\');
    Object[idx][oID] = strval(oinfo[0]);
    Object[idx][oPos][0] = floatstr(oinfo[1]);
    Object[idx][oPos][1] = floatstr(oinfo[2]);
    Object[idx][oPos][2] = floatstr(oinfo[3]);
    Object[idx][oPos][3] = floatstr(oinfo[4]);
    Object[idx][oPos][4] = floatstr(oinfo[5]);
    Object[idx][oPos][5] = floatstr(oinfo[6]);
    Object[idx][oCreated] = strval(oinfo[7]);
            if(Object[idx][oCreated])
   {
     Object[idx][oCreated] = CreateDynamicObject(Object[idx][oID],Object[idx][oPos][0], Object[idx][oPos][1], Object[idx][oPos][2], Object[idx][oPos][3], Object[idx][oPos][4],Object[idx][oPos][5]);
   }
   idx++;
     }
}
print(\"Az objectek sikeresen betöltve\");
return 1;
}

 
A változók megvannak stb, nincs egy hiba se az fs-ben. Nagyon szépen köszönöm elõre is.  :)

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal