Need help with y_ini
#1

Hello, I have some problems with y_ini even if I allready read the tutorial made by ******. I have also checked a few example on the forum but I can't get anything to load when using the parsefile function.


This is under OnGameModeInit and the printf is just there to tell me the MaxMember count to check if anything loads. It should be 30 as a default but it showms me 0.
Код:
new str[40];
    for(new idx = 0; idx < sizeof(Factions); idx++)
    {
        format(str, sizeof(str), FPATH, idx);
        INI_ParseFile(str, "loadfactiondata_%s", .bExtra = true, .extra = idx );
        printf("The membercount is %d", Factions[idx][fMaxMembers]); 
    }
For some reason it won't load


This is the actual function.
Код:
forward loadfactiondata(idx, name[], value[]);



public loadfactiondata(idx, name[], value[])
{
     INI_String("Factionname", Factions[idx][fName],30);
     INI_Int("MaxMembers", Factions[idx][fMaxMembers]);
	 
	 return 1;
}
Reply
#2

change these
pawn Код:
INI_ParseFile(str, "loadfaction_%s", .bExtra = true, .extra = idx );

forward loadfaction_data(idx, name[], value[]);

public loadfaction_data(idx, name[], value[])
or u can try
pawn Код:
for(new idx = 0; idx < sizeof(Factions); idx++)
    {
      if(fexist(FPATH(idx)))
      {
        INI_ParseFile(str, "loadfactiondata_%s", .bExtra = true, .extra = idx );
        printf("The membercount is %d", Factions[idx][fMaxMembers]);
      }
    }
Reply
#3

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
change these
pawn Код:
INI_ParseFile(str, "loadfaction_%s", .bExtra = true, .extra = idx );

forward loadfaction_data(idx, name[], value[]);

public loadfaction_data(idx, name[], value[])
or u can try
pawn Код:
for(new idx = 0; idx < sizeof(Factions); idx++)
    {
      if(fexist(FPATH(idx)))
      {
        INI_ParseFile(str, "loadfactiondata_%s", .bExtra = true, .extra = idx );
        printf("The membercount is %d", Factions[idx][fMaxMembers]);
      }
    }
The first one doesn't change anything of the result and the second one returns these errors:
Код:
(310) : error 001: expected token: "-string end-", but found "-identifier-"
(310) : warning 215: expression has no effect
(310) : error 001: expected token: ";", but found ")"
(310) : error 029: invalid expression, assumed zero
(310) : fatal error 107: too many error messages on one line
The error line is the fexist one.
Reply
#4

Bumping.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)