SA-MP Forums Archive
converting this to dini - 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: converting this to dini (/showthread.php?tid=245666)



converting this to dini - xir - 01.04.2011

hello, can anyone help me converting this to dini

pawn Код:
forward LoadClans();
public LoadClans()
{
    new arrCoords[4][64];
    new strFromFile2[256];
    new File: file = fopen("Clans/clans.cfg",io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(Clans))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(Clans[idx][cName], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            strmid(Clans[idx][clOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
            Clans[idx][Front] = strval(arrCoords[2]);
            Clans[idx][Back] = strval(arrCoords[3]);
            idx++;
        }
        fclose(file);
    }

    return 1;
}
forward SaveClans();
public SaveClans()
{
    new idx;
    new File: file2;
    while (idx < sizeof(Clans))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s|%s|%d|%d\n",
        Clans[idx][cName],
        Clans[idx][clOwner],
        Clans[idx][Front],
        Clans[idx][Back]);
        if(idx == 0)
        {
            file2 = fopen("Clans/clans.cfg",io_write);
        }
        else
        {
            file2 = fopen("Clans/clans.cfg",io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}
Thank you


AW: converting this to dini - Nero_3D - 01.04.2011

Dini is one of the slowest file systems created but kind of loved because of his easiness ^^"

If your code works stay with it!

And your code uses a sql like format which would make the thing with dini only harder