• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Loading .ini files
#1
Hello there!
I am working on House System and i am using ini to store data.
The problem is, that the data does not load.



Code:
#define PATH3 "/Houses/%s.ini"
#define MAX_HOUSES 308

public OnGameModeInit()
{
? ? ?for(new i = 0; i < MAX_HOUSES; i)
? ? ?{
? ? ? ? ? ? INI_ParseFile(House(i), "LoadHouses_%s", .bExtra = true, .extra = i);
? ? ?}
? ? return 1;
}

forward LoadHouses_data(houseid, name[], value[]);
public LoadHouses_data(houseid, name[], value[])
{
? ? if(fexist(House(houseid)))
? ? {? ??
? ? ? ?INI_String("HouseOwner",HI[houseid][hHouseOwner],24);
? ? ? ?INI_Int("HouseOwned",HI[houseid][hHouseOwned]);
? ? ? ?printf("House: %i / HouseOwned = %i",houseid,HI[houseid][hHouseOwned]);
}

stock House(Houseid)
{
new string[128],HouseName[24];
format(HouseName,sizeof(HouseName), "House_ID_%i",Houseid);
format(string,sizeof(string),PATH3,HouseName);
return string;
}

Each of 307 houses is printed, so it looks like file name is loading correctly, but not?HI[houseid][hHouseOwned].
Because in the file,?HI[houseid][hHouseOwned] = 666, but it prints 0 wich is not correct.

Code:
House: 0 / HouseOwned = 0
House: 1 / HouseOwned = 0

What am i doing bad?
  Reply


Messages In This Thread
Loading .ini files - by [bC].Thef - 2021-01-04, 02:15 PM
RE: Loading .ini files - by Pinch - 2021-01-05, 09:08 AM
RE: Loading .ini files - by [bC].Thef - 2021-01-12, 02:20 AM
RE: Loading .ini files - by Pinch - 2021-01-12, 02:50 AM

Forum Jump: