Loading strings issue.
#6

There's a lot of unnecessary things you are doing.

Here's how I would do it (loading part):
pawn Код:
// ** INCLUDES

#include <a_samp>

// ** MAIN

main()
{
    print("Loaded \"get_values_in_file.amx\".");

    new File:file, line[128], length_whitespace, length_equal, var[3], count;
    file = fopen("get_values_in_file.ini", io_read);

    while(fread(file, line))
    {
        length_whitespace = strfind(line, "\r\n", false);

        if(length_whitespace != -1)
        {
            strdel(line, length_whitespace, (length_whitespace + 4));
        }

        length_equal = strfind(line, "=", false);

        if(length_equal != -1)
        {
            strdel(line, 0, (length_equal + 2));
        }

        var[count] = strval(line);

        printf("var[0] = %d", var[count]);

        count ++;
    }

    fclose(file);
}

// ** CALLBACKS

public OnGameModeInit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}
get_values_in_file.ini
pawn Код:
var[0] = 10
var[1] = 20
var[2] = 50
Output
pawn Код:
var[0] = 10
var[0] = 20
var[0] = 50
Reply


Messages In This Thread
Loading strings issue. - by Black Axe - 26.03.2016, 05:08
Re: Loading strings issue. - by Gammix - 26.03.2016, 05:43
Re: Loading strings issue. - by Black Axe - 26.03.2016, 05:48
Re: Loading strings issue. - by Black Axe - 26.03.2016, 15:39
Re: Loading strings issue. - by Black Axe - 27.03.2016, 20:34
Re: Loading strings issue. - by SickAttack - 27.03.2016, 21:35

Forum Jump:


Users browsing this thread: 1 Guest(s)