[debug] Run time error 4: "Array index out of bounds" [debug] Accessing element at negative index -1 [debug] AMX backtrace: [debug] #0 0001a720 in INI_Close (INI:file=-1) at pawno\include\YSI\y_ini.inc:746 [debug] #1 000a6698 in ?? (... <2 arguments>) at gamemodes\sabp.pwn:6431 [debug] #2 0000ff80 in public SSCANF_OnPlayerDisconnect (playerid=1, reason=1) at pawno\include\YSI\y_hooks/impl.inc:661 [debug] #3 000035a0 in public Streamer_OnPlayerDisconnect (playerid=1, reason=1) at pawno\include\sscanf2.inc:229 [debug] #4 00002dd0 in public Itter_OnPlayerDisconnect (playerid=1, reason=1) at pawno\include\streamer.inc:325 [debug] #5 00002668 in public OnPlayerDisconnect (playerid=1, reason=1) at pawno\include\YSI\y_iterate.inc:909
[04:31:39] [join] fucme has joined the server (1:6.6.6)
[04:31:39] *** IRC_OnUserSay (Bot ID 1): User Mexican (ServerBot2@sabp.mexicans.are.taking.over) sent message to #sabp.echo: 02[1] 03*** fucme has joined the server.
[04:31:48] [chat] [fucme]: ttw
[04:31:49] [chat] [fucme]: we
[04:31:49] *** IRC_OnUserSay (Bot ID 1): User Mexican (ServerBot2@sabp.mexicans.are.taking.over) sent message to #sabp.echo: (Mexican) fucme[1]: we
[04:31:49] [chat] [fucme]: twe
[04:31:50] Player: fucme(1) has quit. His File DOES exist: sa-bp/Accounts/fucme.ini
[04:31:50] [debug] Run time error 4: "Array index out of bounds"
[04:31:50] [debug] Accessing element at negative index -1
[04:31:50] [debug] AMX backtrace:
[04:31:50] [debug] #0 0001a720 in INI_Close (INI:file=-1) at C:\Users\student\Desktop\Project\SABP Beta 0.3\SABP Beta 0.3\pawno\include\YSI\y_ini.inc:746
[04:31:50] [debug] #1 000a6698 in ?? (... <2 arguments>) at C:\Users\student\Desktop\Project\SABP Beta 0.3\SABP Beta 0.3\gamemodes\sabp.pwn:6431
[04:31:50] [debug] #2 0000ff80 in public SSCANF_OnPlayerDisconnect (playerid=1, reason=1) at C:\Users\student\Desktop\Project\SABP Beta 0.3\SABP Beta 0.3\pawno\include\YSI\y_hooks/impl.inc:661
[04:31:50] [debug] #3 000035a0 in public Streamer_OnPlayerDisconnect (playerid=1, reason=1) at C:\Users\student\Desktop\Project\SABP Beta 0.3\SABP Beta 0.3\pawno\include\sscanf2.inc:229
[04:31:50] [debug] #4 00002dd0 in public Itter_OnPlayerDisconnect (playerid=1, reason=1) at C:\Users\student\Desktop\Project\SABP Beta 0.3\SABP Beta 0.3\pawno\include\streamer.inc:325
[04:31:50] [debug] #5 00002668 in public OnPlayerDisconnect (playerid=1, reason=1) at C:\Users\student\Desktop\Project\SABP Beta 0.3\SABP Beta 0.3\pawno\include\YSI\y_iterate.inc:909
[04:31:50] [part] fucme has left the server (1:1)
[04:31:51] *** IRC_OnUserSay (Bot ID 1): User Mexican (ServerBot2@sabp.mexicans.are.taking.over) sent message to #sabp.echo: 02[1] 03*** fucme has left the server. (Leaving)
public OnPlayerDisconnect(playerid, reason)
{
new string[128];
if(fexist(userpath(playerid)))
{
format(string, sizeof(string), "Player: %s(%i) has quit. His File DOES exist: %s", Name(playerid), playerid, userpath(playerid));
print(string);
}
else if(!fexist(userpath(playerid)))
{
format(string, sizeof(string), "Player: %s(%i) has quit. His File DOES NOT exist", Name(playerid), playerid);
print(string);
}
for(new i=0; i < 6; i++)
{
GetPlayerWeaponData(playerid, i, Info[playerid][WeaponSlot][i], Info[playerid][WeaponSlot_Ammo][i]);
}
new pstring[16];
format(pstring, sizeof(pstring),"%s",GetPlayerIp(playerid, pstring, sizeof(pstring)));
new INI:File = INI_Open(userpath(playerid));
INI_WriteInt(File,"Admin",Info[playerid][aLevel]);
INI_WriteInt(File,"VIP",Info[playerid][vLevel]);
INI_WriteInt(File,"CitySpawn",Info[playerid][CitySpawn]);
INI_WriteInt(File,"SpawnInHouse",Info[playerid][SpawnInHouse]);
INI_WriteInt(File,"Seconds",Info[playerid][Seconds]);
INI_WriteInt(File,"Minutes",Info[playerid][Minutes]);
INI_WriteInt(File,"Hours",Info[playerid][Hours]);
INI_WriteInt(File,"Money",GetPlayerCash(playerid));
INI_WriteInt(File,"BankCash",Info[playerid][BankCash]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Seeds",Info[playerid][Seeds]);
INI_WriteInt(File,"Grams",Info[playerid][Grams]);
INI_WriteInt(File,"Kills",Info[playerid][Kills]);
INI_WriteInt(File,"Deaths",Info[playerid][Deaths]);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Team",Info[playerid][Team]);
INI_WriteString(File,"IP",pstring);
INI_WriteInt(File,"TruckMCompleted",Info[playerid][TruckMCompleted]);
INI_WriteInt(File,"LastVehicle",Info[playerid][LastVehicle]);
INI_WriteInt(File,"Wanted_Level",GetPlayerWantedLevel(playerid));
INI_WriteInt(File,"WeaponSlot1",Info[playerid][WeaponSlot][0]);
INI_WriteInt(File,"WeaponSlot1_Ammo",Info[playerid][WeaponSlot_Ammo][0]);
INI_WriteInt(File,"WeaponSlot2",Info[playerid][WeaponSlot][1]);
INI_WriteInt(File,"WeaponSlot2_Ammo",Info[playerid][WeaponSlot_Ammo][1]);
INI_WriteInt(File,"WeaponSlot3",Info[playerid][WeaponSlot][2]);
INI_WriteInt(File,"WeaponSlot3_Ammo",Info[playerid][WeaponSlot_Ammo][2]);
INI_WriteInt(File,"WeaponSlot4",Info[playerid][WeaponSlot][3]);
INI_WriteInt(File,"WeaponSlot4_Ammo",Info[playerid][WeaponSlot_Ammo][3]);
INI_WriteInt(File,"WeaponSlot5",Info[playerid][WeaponSlot][4]);
INI_WriteInt(File,"WeaponSlot5_Ammo",Info[playerid][WeaponSlot_Ammo][4]);
INI_WriteInt(File,"WeaponSlot6",Info[playerid][WeaponSlot][5]);
INI_WriteInt(File,"WeaponSlot6_Ammo",Info[playerid][WeaponSlot_Ammo][5]);
INI_Close(File);
stock LeaveGroup(playerid, reason)
{
new groupid = group[playerid][gid], orderid = group[playerid][order], string[100], pname[24];
group[playerid][gid] = -1;
group[playerid][order] = -1;
GroupCheck(groupid, orderid);
GetPlayerName(playerid, pname, 24);
if(reason == 0)
{
format(string, sizeof(string), "%s(%d) has left your group!", pname, playerid);
SendClientMessage(playerid, 0xFF9900AA, "You have left your group");
}
if(reason == 1)
{
format(string, sizeof(string), "%s(%d) has left your group (Kicked by the leader)", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "You have been kicked from your group!");
}
if(reason == 2) format(string, sizeof(string), "%s(%d) has left your group (Disconnected)!", pname, playerid);
SendMessageToAllGroupMembers(groupid, string);
return 1;
}
Nah, LeaveGroup has nothing to do with it.
I never used Y_Ini , but I do have some gamemodes which use Y_ini. I noticed you don't have SetTag when registering? Try to put that. And since we don't know how to fix it, try to make your saving and loading codes "smaller" for testing. For registering just write all things except weapon slots and IP. For loading and saving do the same. Smaller the code, bigger the chance we can find your problem. |
public OnPlayerDisconnect()
{
INI_SetTag(File,"Player Data");
I removed SetTag because people said i couldnt have a space (Player Info) so i changed the tag to Player_Info and then the accounts stopped loading so i just removed SetTag altogether.
|
But in your previous thread I saw
pawn Код:
|
Oh well, fu*k me!
I am trying to help you but... Try to check if here is something that could help you https://sampforum.blast.hk/showthread.php?tid=541630 |
lol Fixed.
![]() in OnPlayerDissconnect Callback I had forgotten that put INI_Close() and by leaving players INI Open files didn't close. Tnx all... |
googamalugafoo[1] has joined the server - 1 255.255.255.25
//this is after i used /saveplayer
[03:54:06] [debug] Run time error 4: "Array index out of bounds"
[03:54:06] [debug] Accessing element at negative index -1
[03:54:06] [debug] AMX backtrace:
[03:54:06] [debug] #0 0001a720 in INI_Close (INI:file=-1) at pawno\include\YSI\y_ini.inc:746
[03:54:06] [debug] #1 00151338 in SavePlayer (playerid=1) at gamemodes\sabp.pwn:18991
[03:54:06] [debug] #2 000fac0c in public cmd_saveplayer (playerid=1, params[]=@012e8f88 "1") at SABP Beta 0.3\SABP Beta 0.3\gamemodes\sabp.pwn:12917
[03:54:06] [debug] #3 native CallLocalFunction () from samp03svr
[03:54:06] [debug] #4 00000b20 in public OnPlayerCommandText (playerid=1, cmdtext[]=@012e8f50 "/saveplayer 1") at pawno\include\zcmd.inc:108
CMD:saveplayer(playerid, params[])
{
if(!IsAdmin(playerid, 1)) return ErrorMsg(playerid);
new target;
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected");
if(sscanf(params, "u", target)) return Usage(playerid, "/saveplayer [Player]");
new string[148];
format(string,sizeof(string), "** STATS: An admin has manually saved your stats. %s",Name(target));
SendClientMessage(target,COLOR_GREEN,string);
SavePlayer(target);
return 1;
}
stock SavePlayer(playerid)
{
new pstring[16];
format(pstring, sizeof(pstring),"%s",GetPlayerIp(playerid, pstring, sizeof(pstring)));
new INI:File = INI_Open(userpath(playerid));
INI_WriteInt(File,"Admin",Info[playerid][aLevel]);
INI_WriteInt(File,"VIP",Info[playerid][vLevel]);
INI_WriteInt(File,"CitySpawn",Info[playerid][CitySpawn]);
INI_WriteInt(File,"SpawnInHouse",Info[playerid][SpawnInHouse]);
INI_WriteInt(File,"Seconds",Info[playerid][Seconds]);
INI_WriteInt(File,"Minutes",Info[playerid][Minutes]);
INI_WriteInt(File,"Hours",Info[playerid][Hours]);
INI_WriteInt(File,"Money",GetPlayerCash(playerid));
INI_WriteInt(File,"BankCash",Info[playerid][BankCash]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Seeds",Info[playerid][Seeds]);
INI_WriteInt(File,"Grams",Info[playerid][Grams]);
INI_WriteInt(File,"Kills",Info[playerid][Kills]);
INI_WriteInt(File,"Deaths",Info[playerid][Deaths]);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Team",Info[playerid][Team]);
INI_WriteString(File,"IP",pstring);
INI_WriteInt(File,"TruckMCompleted",Info[playerid][TruckMCompleted]);
INI_WriteInt(File,"LastVehicle",Info[playerid][LastVehicle]);
INI_WriteInt(File,"Wanted_Level",GetPlayerWantedLevel(playerid));
for(new i=0; i < 6; i++)
{
GetPlayerWeaponData(playerid, i, Info[playerid][WeaponSlot][i], Info[playerid][WeaponSlot_Ammo][i]);
}
INI_WriteInt(File,"WeaponSlot1",Info[playerid][WeaponSlot][0]);
INI_WriteInt(File,"WeaponSlot1_Ammo",Info[playerid][WeaponSlot_Ammo][0]);
INI_WriteInt(File,"WeaponSlot2",Info[playerid][WeaponSlot][1]);
INI_WriteInt(File,"WeaponSlot2_Ammo",Info[playerid][WeaponSlot_Ammo][1]);
INI_WriteInt(File,"WeaponSlot3",Info[playerid][WeaponSlot][2]);
INI_WriteInt(File,"WeaponSlot3_Ammo",Info[playerid][WeaponSlot_Ammo][2]);
INI_WriteInt(File,"WeaponSlot4",Info[playerid][WeaponSlot][3]);
INI_WriteInt(File,"WeaponSlot4_Ammo",Info[playerid][WeaponSlot_Ammo][3]);
INI_WriteInt(File,"WeaponSlot5",Info[playerid][WeaponSlot][4]);
INI_WriteInt(File,"WeaponSlot5_Ammo",Info[playerid][WeaponSlot_Ammo][4]);
INI_WriteInt(File,"WeaponSlot6",Info[playerid][WeaponSlot][5]);
INI_WriteInt(File,"WeaponSlot6_Ammo",Info[playerid][WeaponSlot_Ammo][5]);
INI_Close(File);
}