Y_INI Loading Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Y_INI Loading Help (
/showthread.php?tid=258107)
Y_INI Loading Help -
randomkid88 - 29.05.2011
I'm having trouble getting my Biz.ini to load properly. First, here is the code.
pawn Code:
//Called under OnGamemodeInit:
INI_ParseFile(BizFile, "ini_load_biz", .bPassTag = true);
// Loading Function:
forward ini_load_biz(bid, tag[], name[], value[]);
public ini_load_biz(bid, tag[], name[], value[])
{
new idx = strval(tag);
INI_String("Owner", BizInfo[idx][Owner], 24);
INI_String("Name", BizInfo[idx][bName], 32);
INI_Int("Price", BizInfo[idx][Price]);
INI_Int("Bank", BizInfo[idx][Bank]);
INI_Int("Locked", BizInfo[idx][Bank]);
INI_Int("Interior", BizInfo[idx][Interior]);
INI_Int("World", BizInfo[idx][World]);
INI_Float("IntX", BizInfo[idx][IntX]);
INI_Float("IntY", BizInfo[idx][IntY]);
INI_Float("IntZ", BizInfo[idx][IntZ]);
INI_Float("ExtX", BizInfo[idx][ExtX]);
INI_Float("ExtY", BizInfo[idx][ExtY]);
INI_Float("ExtZ", BizInfo[idx][ExtZ]);
printf("%i", BizInfo[idx][Price]);
return 1;
}
The print displays 13 lines of 0's, which is the wrong value and there is only 1 entry in the file.
I've tried different combinations of loops and strval(tag), etc and can't get any successful loads. Thanks in advance.
Re: Y_INI Loading Help -
(SF)Noobanatior - 29.05.2011
you are saving the file again you need to do something like
pawn Code:
stock LoadPlayer(playerid){
new name[MAX_PLAYER_NAME],file[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file),USER_BASE, name);
INI_ParseFile(file, "LoginAcc", false, true, playerid, true, false);
}
forward LoginAcc(playerid, name[ ], value[ ]);
public LoginAcc(playerid, name[ ], value[ ])
{
if(!strcmp(name, "Password", false)) SetPVarString(playerid, "Password", value);
if(!strcmp(name, "TimesLogged", false)) SetPVarInt(playerid, "TimesLogged", strval(value)+1);
if(!strcmp(name, "FailedLog", false)) SetPVarInt(playerid, "FailedLog", strval(value));
return 1;
}
Re: Y_INI Loading Help -
randomkid88 - 29.05.2011
No, INI_Int for example loads an integer, not saves. INI_WriteInt would write it.
Re: Y_INI Loading Help -
StilThere - 06.06.2011
Is it me or can an INI_ParseFile only be called once during a whole server session?