14.04.2013, 07:00
Here is my parse file
Here is my LoadStats:
Well the problem is, it loads "AdminLevel" alright,it loads "XP" aswell, but with money it's different,it just doesn't load it. The printf there prints 0. Although in the file it's not 0
My other problem:
When i use it in my command which uses that function "SaveStats" it outputs this weird warning:
Any feedback will be appreciated
pawn Код:
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);
}
pawn Код:
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;
}
My other problem:
pawn Код:
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;
}
pawn Код:
[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