08.04.2014, 19:57
I am using Y INI, all goes smooth till i use loops...
I gave in the following codes example of loops with weapons ammo, when i in the server it saves the weapon ID and ammo properly but when i relog, then the problems start.
NOTE: I use format for saving data.
So save values with loop:
That's how i loading when player connects using INI_ParseFile:
Results:
That's empty data but when i in server it writes it properly, when i relog it sets my health to 0 and kills me - i tried it without loops and it didn't kill me so the problem is the loops.
I gave in the following codes example of loops with weapons ammo, when i in the server it saves the weapon ID and ammo properly but when i relog, then the problems start.
NOTE: I use format for saving data.
So save values with loop:
Код:
for(new s = 0; s < 12; s++)
{
SaveValidAmmo(playerid);
format(var, 32, "wSlot%d", s);
INI_WriteInt(File, var, PlayerInfo[playerid][pGuns][s]);
format(var, 32, "wSlot%dAmmo", s);
INI_WriteInt(File, var, PlayerInfo[playerid][pAGuns][s]);
}
Код:
for(new s = 0; s < 12; s++)
{
INI_Int("wSlot%d", PlayerInfo[playerid][pGuns][s]);
INI_Int("wSlot%dAmmo", PlayerInfo[playerid][pAGuns][s]);
}
That's empty data but when i in server it writes it properly, when i relog it sets my health to 0 and kills me - i tried it without loops and it didn't kill me so the problem is the loops.


