SA-MP Forums Archive
Saving problem. - 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: Saving problem. (/showthread.php?tid=103171)



Saving problem. - Justsmile - 18.10.2009

my Server don't save my stuff.ini anymore.

I use LoadStuff and SaveStuff

pawn Код:
public SaveStuff()
{
    if(TOGGLE_DEBUG_MODE)
    {
        print(" //DEBUG: CALL SaveStuff()");
    }
   
    new coordsstring[256];
    format(coordsstring, sizeof(coordsstring), "$%d,$%d,$%d,%d,$%d, LcnMats: %d, LcnBombs: %d, LcnMoney: $%d, YakMats: %d, YakBombs: %d, YakMoney: $%d, HitMats: %d, HitBombs: %d, HitMoney: $%d, StMats: %d, StBombs: %d, StMoney: $%d, RAMats: %d, RABombs: %d, RAMoney: $%d, NPC Bus price: $%d",
    Jackpot,Tax,TaxValue,Security,V_A_T,
    lMats,lBombs,lMoney,
    yMats,yBombs,yMoney,
    hMats,hBombs,hMoney,
    stMats,stBombs,stMoney,
    raMats,raBombs,raMoney,
    busprice);
    new File: file2 = fopen("stuff.ini", io_write);
    fwrite(file2, coordsstring);
    fclose(file2);
    return 1;
}
public LoadStuff()
{
    if(TOGGLE_DEBUG_MODE)
    {
        print(" //DEBUG: CALL LoadStuff()");
    }

    new arrCoords[21][64];
    new strFromFile2[256];
    new File: file = fopen("stuff.ini", io_read);
    if (file)
    {
        fread(file, strFromFile2);
        split(strFromFile2, arrCoords, ',');
        Jackpot = strval(arrCoords[0]);
        Tax = strval(arrCoords[1]);
        TaxValue = strval(arrCoords[2]);
        Security = strval(arrCoords[3]);
        V_A_T = strval(arrCoords[4]);
        lMats = strval(arrCoords[5]);
        lBombs = strval(arrCoords[6]);
        lMoney = strval(arrCoords[7]);
        yMats = strval(arrCoords[8]);
        yBombs = strval(arrCoords[9]);
        yMoney = strval(arrCoords[10]);
        hMats = strval(arrCoords[11]);
        hBombs = strval(arrCoords[12]);
        hMoney = strval(arrCoords[13]);
        stMats = strval(arrCoords[14]);
        stBombs = strval(arrCoords[15]);
        stMoney = strval(arrCoords[16]);
        raMats = strval(arrCoords[17]);
        raBombs = strval(arrCoords[18]);
        raMoney = strval(arrCoords[19]);
        busprice = strval(arrCoords[20]);
        fclose(file);
        if(Security == 0 || Security == 1)
        {
        }
        else
        {
          GameModeExit();
        }
    }
    else
    {
      GameModeExit();
    }
    return 1;
}
I think there is a problem, with loading the stuff.ini.


Re: Saving problem. - Limex - 18.10.2009

One thing.. "print(" //DEBUG: CALL LoadStuff()");"

Are you sure you can comment half of a function and it will still compile?


Re: Saving problem. - Correlli - 18.10.2009

Quote:
Originally Posted by www.trueroleplay.com
One thing.. "print(" //DEBUG: CALL LoadStuff()");"

Are you sure you can comment half of a function and it will still compile?
It won't comment anything, it's under " ".


Re: Saving problem. - Justsmile - 19.10.2009

Anyone knows the problem.?



Re: Saving problem. - Jakku - 19.10.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by www.trueroleplay.com
One thing.. "print(" //DEBUG: CALL LoadStuff()");"

Are you sure you can comment half of a function and it will still compile?
It won't comment anything, it's under " ".
It does.


Re: Saving problem. - Westie - 19.10.2009

Quote:
Originally Posted by Jakku
Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by www.trueroleplay.com
One thing.. "print(" //DEBUG: CALL LoadStuff()");"

Are you sure you can comment half of a function and it will still compile?
It won't comment anything, it's under " ".
It does.
Don is correct, nothing will be commented.


Re: Saving problem. - Justsmile - 19.10.2009

Does anybody know, if it is correct?


Re: Saving problem. - Correlli - 19.10.2009

Quote:
Originally Posted by Jakku
Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by www.trueroleplay.com
One thing.. "print(" //DEBUG: CALL LoadStuff()");"

Are you sure you can comment half of a function and it will still compile?
It won't comment anything, it's under " ".
It does.
No, it doesn't. I believe you're confused because you see everything green after the // in PAWN-tag in the first post. It's just the PAWN-tag mod for SMF forum.


Re: Saving problem. - TheNooB - 19.10.2009

Quote:
Originally Posted by #.'
my Server don't save my stuff.ini anymore.

I use LoadStuff and SaveStuff

pawn Код:
public SaveStuff()
{
    if(TOGGLE_DEBUG_MODE)
    {
        print(" //DEBUG: CALL SaveStuff()");
    }
   
    new coordsstring[256];
    format(coordsstring, sizeof(coordsstring), "$%d,$%d,$%d,%d,$%d, LcnMats: %d, LcnBombs: %d, LcnMoney: $%d, YakMats: %d, YakBombs: %d, YakMoney: $%d, HitMats: %d, HitBombs: %d, HitMoney: $%d, StMats: %d, StBombs: %d, StMoney: $%d, RAMats: %d, RABombs: %d, RAMoney: $%d, NPC Bus price: $%d",
    Jackpot,Tax,TaxValue,Security,V_A_T,
    lMats,lBombs,lMoney,
    yMats,yBombs,yMoney,
    hMats,hBombs,hMoney,
    stMats,stBombs,stMoney,
    raMats,raBombs,raMoney,
    busprice);
    new File: file2 = fopen("stuff.ini", io_write);
    fwrite(file2, coordsstring);
    fclose(file2);
    return 1;
}
public LoadStuff()
{
    if(TOGGLE_DEBUG_MODE)
    {
        print(" //DEBUG: CALL LoadStuff()");
    }

    new arrCoords[21][64];
    new strFromFile2[256];
    new File: file = fopen("stuff.ini", io_read);
    if (file)
    {
        fread(file, strFromFile2);
        split(strFromFile2, arrCoords, ',');
        Jackpot = strval(arrCoords[0]);
        Tax = strval(arrCoords[1]);
        TaxValue = strval(arrCoords[2]);
        Security = strval(arrCoords[3]);
        V_A_T = strval(arrCoords[4]);
        lMats = strval(arrCoords[5]);
        lBombs = strval(arrCoords[6]);
        lMoney = strval(arrCoords[7]);
        yMats = strval(arrCoords[8]);
        yBombs = strval(arrCoords[9]);
        yMoney = strval(arrCoords[10]);
        hMats = strval(arrCoords[11]);
        hBombs = strval(arrCoords[12]);
        hMoney = strval(arrCoords[13]);
        stMats = strval(arrCoords[14]);
        stBombs = strval(arrCoords[15]);
        stMoney = strval(arrCoords[16]);
        raMats = strval(arrCoords[17]);
        raBombs = strval(arrCoords[18]);
        raMoney = strval(arrCoords[19]);
        busprice = strval(arrCoords[20]);
        fclose(file);
        if(Security == 0 || Security == 1)
        {
        }
        else
        {
          GameModeExit();
        }
    }
    else
    {
      GameModeExit();
    }
    return 1;
}
I think there is a problem, with loading the stuff.ini.
In my opinion ...

pawn Код:
public SaveStuff()
{
    if(TOGGLE_DEBUG_MODE)
    {
        print("DEBUG: CALL SaveStuff()");
    }
   
    new coordsstring[256];
    format(coordsstring, sizeof(coordsstring), "$%d,$%d,$%d,%d,$%d, LcnMats: %d, LcnBombs: %d, LcnMoney: $%d, YakMats: %d, YakBombs: %d, YakMoney: $%d, HitMats: %d, HitBombs: %d, HitMoney: $%d, StMats: %d, StBombs: %d, StMoney: $%d, RAMats: %d, RABombs: %d, RAMoney: $%d, NPC Bus price: $%d",
    Jackpot,Tax,TaxValue,Security,V_A_T,
    lMats,lBombs,lMoney,
    yMats,yBombs,yMoney,
    hMats,hBombs,hMoney,
    stMats,stBombs,stMoney,
    raMats,raBombs,raMoney,
    busprice);
    new File: file2 = fopen("stuff.ini", io_write);
    fwrite(file2, coordsstring);
    fclose(file2);
    return 1;
}
public LoadStuff()
{
    if(TOGGLE_DEBUG_MODE)
    {
        print("DEBUG: CALL LoadStuff()");
    }

    new arrCoords[21][64];
    new strFromFile2[256];
    new File: file = fopen("stuff.ini", io_read);
    if (file)
    {
        fread(file, strFromFile2);
        split(strFromFile2, arrCoords, ',');
        Jackpot = strval(arrCoords[0]);
        Tax = strval(arrCoords[1]);
        TaxValue = strval(arrCoords[2]);
        Security = strval(arrCoords[3]);
        V_A_T = strval(arrCoords[4]);
        lMats = strval(arrCoords[5]);
        lBombs = strval(arrCoords[6]);
        lMoney = strval(arrCoords[7]);
        yMats = strval(arrCoords[8]);
        yBombs = strval(arrCoords[9]);
        yMoney = strval(arrCoords[10]);
        hMats = strval(arrCoords[11]);
        hBombs = strval(arrCoords[12]);
        hMoney = strval(arrCoords[13]);
        stMats = strval(arrCoords[14]);
        stBombs = strval(arrCoords[15]);
        stMoney = strval(arrCoords[16]);
        raMats = strval(arrCoords[17]);
        raBombs = strval(arrCoords[18]);
        raMoney = strval(arrCoords[19]);
        busprice = strval(arrCoords[20]);
        fclose(file);
        if(Security == 0 || Security == 1)
        {
        }
        else
        {
          GameModeExit();
        }
    }
    else
    {
      GameModeExit();
    }
    return 1;
}



Re: Saving problem. - FUNExtreme - 19.10.2009

Are the debug lines printed?