27.09.2013, 20:15
im trying to make a business system, but for some reason, the business doesnt load, it doesnt save like its supposed to. In the .ini, it registers properly, but ONLY THE FIRST BIZ CREATED, every other business you create shows the ID in the business folder, but the files are blank. Every address also comes up as 78 and price 1, but that is not the variable set.
under ongamemodeinit
Note: updatebiz does work as it is supposed to.
and finally, the command
And a screen of what I see:

Side note: I'll rep you if you help me, even if it dont fix the problem, and the reason for the difference in title and textdraw is because i changed the name and didnt update the SCM yet.
pawn Код:
enum bInfo
{
bType,
bName[58],
bOwner[MAX_PLAYER_NAME],
bCreated,
bLocked,
bWorld,
bOwned,
bPrice,
bTill,
bAddress,
Float:bExtX,
Float:bExtY,
Float:bExtZ,
Float:bExtA,
Float:bIntX,
Float:bIntY,
Float:bIntZ,
Float:bIntA,
};
pawn Код:
new str[40];
for(new bizid = 1; bizid < sizeof(BizInfo); bizid++)
{
new bstr[100];
format(str, sizeof(str), BPATH, bizid);
format(bstr, sizeof(bstr), "%s\nAddress:%d\nPrice:%d", BizInfo[bizid][bName], BizInfo[bizid][bAddress], BizInfo[bizid][bPrice]);
INI_ParseFile(str, "loadbiz_%d", .bExtra = true, .extra = bizid );
Create3DTextLabel(bstr, COLBLUE, BizInfo[bizid][bExtX], BizInfo[bizid][bExtY], BizInfo[bizid][bExtZ], 5, 0, true);
}
SetTimer("updatebiz", 500, true);
SetTimer("savebiz", 600000, true);
pawn Код:
public OnGameModeExit()
{
new str[40];
for(new bizid = 1; bizid < sizeof(BizInfo); bizid++)
{
format(str, sizeof(str), BPATH, bizid);
SaveBusiness(bizid);
return 1;
}
printf("All businesses saved!");
return 1;
}
forward savebiz();
public savebiz()
{
new str[40];
for(new bizid = 1; bizid < sizeof(BizInfo); bizid++)
{
format(str, sizeof(str), BPATH, bizid);
SaveBusiness(bizid);
return 1;
}
printf("All businesses saved!");
return 1;
}
pawn Код:
forward loadbiz_data(bizid, name[], value[]);
public loadbiz_data(bizid, name[], value[])
{
INI_Int("Type", BizInfo[bizid][bType]);
INI_ParseFile("Name", BizInfo[bizid][bName]);
INI_ParseFile("Owner", BizInfo[bizid][bOwner]);
INI_Int("Created", BizInfo[bizid][bCreated]);
INI_Int("Locked", BizInfo[bizid][bLocked]);
INI_Int("World", BizInfo[bizid][bWorld]);
INI_Int("Owned", BizInfo[bizid][bOwned]);
INI_Int("Price", BizInfo[bizid][bPrice]);
INI_Int("Till", BizInfo[bizid][bTill]);
INI_Int("Address", BizInfo[bizid][bAddress]);
INI_Float("Ext: X", BizInfo[bizid][bExtX]);
INI_Float("Ext: Y", BizInfo[bizid][bExtY]);
INI_Float("Ext: Z", BizInfo[bizid][bExtZ]);
INI_Float("Ext: A", BizInfo[bizid][bExtA]);
INI_Float("Int: X", BizInfo[bizid][bIntX]);
INI_Float("Int: Y", BizInfo[bizid][bIntY]);
INI_Float("Int: Z", BizInfo[bizid][bIntZ]);
INI_Float("Int: A", BizInfo[bizid][bIntA]);
return 1;
}
pawn Код:
stock SaveBusiness(bizid)
{
new file1[40];
format(file1, sizeof(file1), BPATH, bizid);
new INI:File = INI_Open(file1);
INI_WriteInt(File, "Type", BizInfo[bizid][bType]);
INI_WriteString(File, "Name", BizInfo[bizid][bName]);
INI_WriteString(File, "Owner", BizInfo[bizid][bOwner]);
INI_WriteInt(File, "Created", BizInfo[bizid][bCreated]);
INI_WriteInt(File, "Locked", BizInfo[bizid][bLocked]);
INI_WriteInt(File, "World", BizInfo[bizid][bWorld]);
INI_WriteInt(File, "Owned", BizInfo[bizid][bOwned]);
INI_WriteInt(File, "Price", BizInfo[bizid][bPrice]);
INI_WriteInt(File, "Till", BizInfo[bizid][bTill]);
INI_WriteInt(File, "Address", BizInfo[bizid][bAddress]);
INI_WriteFloat(File, "Ext: X", BizInfo[bizid][bExtX]);
INI_WriteFloat(File, "Ext: Y", BizInfo[bizid][bExtY]);
INI_WriteFloat(File, "Ext: Z", BizInfo[bizid][bExtZ]);
INI_WriteFloat(File, "Ext: A", BizInfo[bizid][bExtA]);
INI_WriteFloat(File, "Int: X", BizInfo[bizid][bIntX]);
INI_WriteFloat(File, "Int: Y", BizInfo[bizid][bIntY]);
INI_WriteFloat(File, "Int: Z", BizInfo[bizid][bIntZ]);
INI_WriteFloat(File, "Int: A", BizInfo[bizid][bIntA]);
INI_Close(File);
return 1;
}
pawn Код:
CMD:createbiz(playerid, params[])
{
new bizid;
for(new h = 1;h < sizeof(BizInfo);h++)
{
bizid = h;
break;
}
new Float:X, Float:Y, Float:Z;
GetPlayerPos(pid, X, Y, Z);
new string[255];
format(string, sizeof(string), "None");
BizInfo[bizid][bType] = 1;
strmid(BizInfo[bizid][bName], string, 0, strlen(string), 255);
strmid(BizInfo[bizid][bOwner], string, 0, strlen(string), 255);
BizInfo[bizid][bCreated] = 1;
BizInfo[bizid][bLocked] = 0;
BizInfo[bizid][bWorld] = 0;
BizInfo[bizid][bOwned] = 0;
BizInfo[bizid][bPrice] = 0;
BizInfo[bizid][bTill] = 0;
BizInfo[bizid][bAddress] = bizid;
BizInfo[bizid][bExtX] = X;
BizInfo[bizid][bExtY] = Y;
BizInfo[bizid][bExtZ] = Z;
BizInfo[bizid][bExtA] = 0;
BizInfo[bizid][bIntX] = 0;
BizInfo[bizid][bIntY] = 0;
BizInfo[bizid][bIntZ] = 0;
BizInfo[bizid][bIntA] = 0;
new file1[40];
format(file1, sizeof(file1), BPATH, bizid);
new INI:File = INI_Open(file1);
INI_SetTag(File, "Business Info");
INI_WriteInt(File, "Type", BizInfo[bizid][bType]);
INI_WriteString(File, "Name", BizInfo[bizid][bName]);
INI_WriteString(File, "Owner", BizInfo[bizid][bOwner]);
INI_WriteInt(File, "Locked", BizInfo[bizid][bLocked]);
INI_WriteInt(File, "World", BizInfo[bizid][bWorld]);
INI_WriteInt(File, "Owned", BizInfo[bizid][bOwned]);
INI_WriteInt(File, "Price", BizInfo[bizid][bPrice]);
INI_WriteInt(File, "Till", BizInfo[bizid][bTill]);
INI_WriteInt(File, "Address", BizInfo[bizid][bAddress]);
INI_WriteFloat(File, "Ext: X", BizInfo[bizid][bExtX]);
INI_WriteFloat(File, "Ext: Y", BizInfo[bizid][bExtY]);
INI_WriteFloat(File, "Ext: Z", BizInfo[bizid][bExtZ]);
INI_WriteFloat(File, "Ext: A", BizInfo[bizid][bExtA]);
INI_WriteFloat(File, "Int: X", BizInfo[bizid][bIntX]);
INI_WriteFloat(File, "Int: Y", BizInfo[bizid][bIntY]);
INI_WriteFloat(File, "Int: Z", BizInfo[bizid][bIntZ]);
INI_WriteFloat(File, "Int: A", BizInfo[bizid][bIntA]);
INI_Close(File);
SCM(pid, COLGREEN, "Server: {F0F0F0}Biz created.");
return 1;
}

Side note: I'll rep you if you help me, even if it dont fix the problem, and the reason for the difference in title and textdraw is because i changed the name and didnt update the SCM yet.