[y_ini] Stats are saving, but not loading? - 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)
+--- Thread: [y_ini] Stats are saving, but not loading? (
/showthread.php?tid=417975)
[y_ini] Stats are saving, but not loading? -
[FSaF]Jarno - 23.02.2013
Hi. Lately i have been interested in finally doing it and moving to y_ini. The problem is, that the script saves the stats correctly, and when i open the file it has the things in it. When i try to load the stats (With parsefile), however, they are not loading. My script for it is the following:
Saving:
PHP код:
new tick = GetTickCount();
new INI:iniFile = INI_Open(file);
//
// y_ini supports tags, that is:
//
// [tag]
// key = value
//
INI_SetTag(iniFile, "basic");
// Write an integer value with the key "some_integer" under the current tag:
INI_WriteInt(iniFile, "AdminLevel", AdminLevel[playerid]);
INI_WriteInt(iniFile, "Language", pLanguage[playerid]);
INI_WriteInt(iniFile, "Money", GetPlayerMoney(playerid));
INI_WriteInt(iniFile, "Autorepair", pAutoRepair[playerid]);
INI_WriteInt(iniFile, "Score", GetPlayerScore(playerid));
// Now close the current file:
INI_Close(iniFile);
printf("Statsien tallennus Y_INIllд: %d millisekuntia.",GetTickCount()-tick);
return 1;
(The tick thingy is just a benchmark)
Loading:
PHP код:
INI_ParseFile(file, "perse_%s", .bExtra = true, .extra = playerid); (the file variable IS defined correctly, i have checked it 5 times.)
PHP код:
public perse_basic(playerid, name[], value[])
{
new tick = GetTickCount();
new money, score;
INI_Int("AdminLevel", AdminLevel[playerid]);
INI_Int("Language", pLanguage[playerid]);
INI_Int("Money", money);
INI_Int("Autorepair", pAutoRepair[playerid]);
INI_Int("Score", score);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,money);
SetPlayerScore(playerid,score);
printf("Statsien lataus Y_INIllд: %d millisekuntia.",GetTickCount()-tick);
return 1;
}
What am i doing wrong?
EDIT: I would like to add, that the printf is never showing up in the console, so the callback isn't even being called?
Re: [y_ini] Stats are saving, but not loading? -
JaKe Elite - 23.02.2013
try changing
perse_%s
to
perse_basic