[Solved]Y_ini issue
#1

Okay I'm trying to create a file and store data on it, the file is created but there is no data, here's the code..
pawn Код:
#define PATH    "Somewhere/%s.ini"
    if(dialogid == 1)
    {
        if(response)
        {
            if(strlen(inputtext))
            {
                new File[100];
                format(File, sizeof(File), PATH, inputtext);
                if(!fexist(File))
                {
                    new INI:ACCOUNT = INI_Open(File);
                    INI_WriteInt(ACCOUNT, "Test", 1);
                {
            }
        }
        return 1;
    }
The file is created, But there is nothing inside it, So what's the problem ?
Reply
#2

You have to close the file.
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=273088

https://sampforum.blast.hk/showthread.php?tid=244223
Reply
#4

First of all, I just want to point out that one of your braces is facing the wrong way. (Opening brace instead of a closing brace)

pawn Код:
if(dialogid == 1)
    {
        if(response)
        {
            if(strlen(inputtext) > 0)
            {
                new File[100];
                format(File, sizeof(File), PATH, inputtext);
                if(!fexist(File))
                {
                    new INI:ACCOUNT = INI_Open(File);
                    INI_WriteInt(ACCOUNT, "Test", 1);
                    INI_Close(ACCOUNT);
                }
            }
        }
        return 1;
    }
This should be working...

EDIT: Somehow, two slippery buggers managed to post before I finished writing this up.
Reply
#5

Quote:
Originally Posted by Chrillzen
Посмотреть сообщение
You have to close the file.
Oh how can I forget that, Thanks.

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
First of all, I just want to point out that one of your braces is facing the wrong way. (Opening brace instead of a closing brace)

pawn Код:
if(dialogid == 1)
    {
        if(response)
        {
            if(strlen(inputtext) > 0)
            {
                new File[100];
                format(File, sizeof(File), PATH, inputtext);
                if(!fexist(File))
                {
                    new INI:ACCOUNT = INI_Open(File);
                    INI_WriteInt(ACCOUNT, "Test", 1);
                    INI_Close(ACCOUNT);
                }
            }
        }
        return 1;
    }
This should be working...

EDIT: Somehow, two slippery buggers managed to post before I finished writing this up.
Thanks anyway
Reply
#6

Deleted - Made another thread.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)