#define MAX_OWNABLE_VEHICLES 5
#define USERS_PATH "/EVO/users/%s.ini"
enum pInfo {
bool:pAllowed,
pTotalVehs,
pVSlot[MAX_OWNABLE_VEHICLES-1]
}
stock UserPath(playerid) {
new path[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(path, sizeof(path), USERS_PATH, name);
return name;
}
public LoadUser_data(playerid,name[],value[])
{
printf("Read %s: %s", name, value);
INI_Bool("allowed", PlayerInfo[playerid][pAllowed]);
INI_Int("totalvehs", PlayerInfo[playerid][pTotalVehs]);
for(new i = 0; i < MAX_OWNABLE_VEHICLES; i++) {
new vslot[10];
format(vslot, sizeof(vslot), "slot%d", i);
INI_Int(vslot, PlayerInfo[playerid][pVSlot][i]);
}
return 1;
}
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
}
else
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteBool(File, "allowed", PlayerInfo[playerid][pAllowed]);
INI_WriteInt(File, "totalvehs", PlayerInfo[playerid][pTotalVehs]);
for(new i = 0; i < MAX_OWNABLE_VEHICLES; i++) {
new vslot[10];
format(vslot, sizeof(vslot), "slot%d", i);
INI_WriteInt(File, vslot, PlayerInfo[playerid][pVSlot][i]);
}
INI_Close(File);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteBool(File, "allowed", PlayerInfo[playerid][pAllowed]);
INI_WriteInt(File, "totalvehs", PlayerInfo[playerid][pTotalVehs]);
for(new i = 0; i < MAX_OWNABLE_VEHICLES; i++) {
new vslot[10];
format(vslot, sizeof(vslot), "slot%d", i);
INI_WriteInt(File, vslot, PlayerInfo[playerid][pVSlot][i]);
}
INI_Close(File);
return 1;
}
stock UserPath(playerid) {
new path[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(path, sizeof(path), USERS_PATH, name);
return path;
}
[23:20:18] [debug] Run time error 4: "Array index out of bounds" [23:20:18] [debug] AMX backtrace: [23:20:18] [debug] #0 0005165c in public SSCANF_OnPlayerDisconnect (0, 1) from EVO.amx [23:20:18] [debug] #1 00046f38 in public _y_utils_OnPlayerDisconnect (0, 1) from EVO.amx [23:20:18] [debug] #2 000078b0 in public OnPlayerDisconnect (0, 1) from EVO.amx
Yeah, You're right. I loaded Crashdetect and I got this:
Код:
[23:20:18] [debug] Run time error 4: "Array index out of bounds" [23:20:18] [debug] AMX backtrace: [23:20:18] [debug] #0 0005165c in public SSCANF_OnPlayerDisconnect (0, 1) from EVO.amx [23:20:18] [debug] #1 00046f38 in public _y_utils_OnPlayerDisconnect (0, 1) from EVO.amx [23:20:18] [debug] #2 000078b0 in public OnPlayerDisconnect (0, 1) from EVO.amx EDIT: I got the same thing in OnPlayerConnect as well. |
-d3
enum pInfo {
bool:pAllowed,
pTotalVehs,
pVSlot[MAX_OWNABLE_VEHICLES-1]
}
enum pInfo {
bool:pAllowed,
pTotalVehs,
pVSlot[MAX_OWNABLE_VEHICLES] //The problem was here.
}
[23:35:55] [debug] Run time error 4: "Array index out of bounds" [23:35:55] [debug] AMX backtrace: [23:35:55] [debug] #0 0005d6e8 in public SSCANF_OnPlayerConnect (playerid=0) at D:\SAMP\filterscripts\EVO.pwn:811 [23:35:55] [debug] #1 00050d50 in public _y_utils_OnPlayerConnect (playerid=0) at D:\SAMP\pawno\include\sscanf2.inc:205 [23:35:55] [debug] #2 00008ce0 in public OnPlayerConnect (playerid=0) at D:\SAMP\pawno\include\YSI\..\YSI_Storage\..\YSI_Core\y_utils.inc:236
for(new i = 0; i < MAX_OWNABLE_VEHICLES; i++) {
new vslot[10];
format(vslot, sizeof(vslot), "slot%d", i);
INI_WriteInt(File, vslot, PlayerInfo[playerid][pVSlot][i]); // line 811
}
Код:
[23:35:55] [debug] Run time error 4: "Array index out of bounds" [23:35:55] [debug] AMX backtrace: [23:35:55] [debug] #0 0005d6e8 in public SSCANF_OnPlayerConnect (playerid=0) at D:\SAMP\filterscripts\EVO.pwn:811 [23:35:55] [debug] #1 00050d50 in public _y_utils_OnPlayerConnect (playerid=0) at D:\SAMP\pawno\include\sscanf2.inc:205 [23:35:55] [debug] #2 00008ce0 in public OnPlayerConnect (playerid=0) at D:\SAMP\pawno\include\YSI\..\YSI_Storage\..\YSI_Core\y_utils.inc:236 PHP код:
|