27.03.2016, 21:35
There's a lot of unnecessary things you are doing.
Here's how I would do it (loading part):
get_values_in_file.ini
Output
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;
}
pawn Код:
var[0] = 10
var[1] = 20
var[2] = 50
pawn Код:
var[0] = 10
var[0] = 20
var[0] = 50