if(fexist(GetPath(playerid)))
{
new string[80];
format(string,sizeof(string),"Sveiki sugrįћę %s, jūs automatiљkai buvote prijungtas",Name);
SendClientMessage(playerid,0xFFFF00FF,string);
INI_ParseFile(GetPath(playerid),"LoadStats_%s", .bExtra = true, .extra = playerid);
}
forward LoadStats_data(playerid, name[], value[]);
public LoadStats_data(playerid,name[],value[])
{
new temp[128];
INI_String("Password",temp,128); format(PlayerInfo[playerid][pPass],sizeof(temp),temp);
INI_Int("AdminLevel",PlayerInfo[playerid][AdminLevel]);
INI_Int("XP",PlayerInfo[playerid][XP]);
INI_Int("Money",PlayerInfo[playerid][Money]);
INI_Int("Kills",PlayerInfo[playerid][Kills]);
INI_Int("Deaths",PlayerInfo[playerid][Deaths]);
SetPlayerScore(playerid,PlayerInfo[playerid][XP]);
GivePlayerMoney(playerid,PlayerInfo[playerid][Money]);
printf("Done:pinigai %d",PlayerInfo[playerid][Money]);
return 1;
}
stock SaveStats(playerid)
{
new INI:file = INI_Open(GetPath(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteInt(file,"AdminLevel",PlayerInfo[playerid][AdminLevel]);
INI_WriteInt(file,"XP",PlayerInfo[playerid][XP]);
INI_WriteInt(file,"Money",PlayerInfo[playerid][Money]);
INI_WriteInt(file,"Kills",PlayerInfo[playerid][Kills]);
INI_WriteInt(file,"Deaths",PlayerInfo[playerid][Deaths]);
INI_Close(file);
return 1;
}
[10:18:03] [debug] Run time error 4: "Array index out of bounds"
[10:18:03] [debug] Accessing element at index 14 past array upper bound 12
[10:18:03] [debug] AMX backtrace:
[10:18:03] [debug] #0 000194fc in public cmd_test () from GangWars.amx
[10:18:03] [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe
[10:18:03] [debug] #2 00000530 in public OnPlayerCommandText () from GangWars.amx
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
INI_Int("Money",PlayerInfo[playerid][Money]); SetPVarInt(playerid, "Money",PlayerInfo[playerid][Money]);
The problem is when you load the file, try this:
Код:
INI_Int("Money",PlayerInfo[playerid][Money]); SetPVarInt(playerid, "Money",PlayerInfo[playerid][Money]); |