Yini Problem +REP
#1

Why Do I always see this in the logs?:

[22:05:55] [debug] Run time error 4: "Array index out of bounds"
[22:05:55] [debug] Accessing element at negative index -1
[22:05:55] [debug] AMX backtrace:
[22:05:55] [debug] #0 000185e4 in INI_Close (INI:file=-1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\YSI\y_ini.inc:746
[22:05:55] [debug] #1 00024874 in public UserSaver (playerid=0) at D:\SA-MP Things\SAMP 0.3.7 R2\gamemodes\LSGW.pwn:2143
[22:05:55] [debug] #2 00071fec in public OnPlPa_OnPlayerDisconnect (playerid=0, reason=1) at D:\SA-MP Things\SAMP 0.3.7 R2\gamemodes\LSGW.pwn:6708
[22:05:55] [debug] #3 native CallLocalFunction () from samp03svr
[22:05:55] [debug] #4 0001fa7c in ?? (... <2 arguments>) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\whenpause.inc:125
[22:05:55] [debug] #5 0000de3c in public SSCANF_OnPlayerDisconnect (playerid=0, reason=1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\YSI\y_hooks/impl.inc:661
[22:05:55] [debug] #6 000010ac in public Itter_OnPlayerDisconnect (playerid=0, reason=1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\sscanf2.inc:229
[22:05:55] [debug] #7 native CallLocalFunction () from samp03svr
[22:05:55] [debug] #8 000008f0 in public OnPlayerDisconnect (playerid=0, reason=1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\foreach.inc:643

Line 6708:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new pName2[24];
    new str[128];
    GetPlayerName(playerid, pName2, 24);
    KillTimer(UserTimer[playerid]);

    switch(reason)
        {
            case 0: format(str, 128, "%s (%d) Has Left The Server. (Timeout/Crashed)", pName2,playerid);
            case 1: format(str, 128, "%s (%d) Has Left The Server. (Leaving)", pName2,playerid);
            case 2:
            {
             format(str, 128, "%s (%d) Has Left The Server. (Kicked/Banned)", pName2,playerid);
             Info[playerid][TimesKicked] +=1;
            }
        }
    SendClientMessageToAll(0xAFAFAFAA, str);
    if(fexist(Path(playerid)))
    {
    UserSaver(playerid);
    } // 6708 Line
UserSaver:
pawn Код:
public UserSaver(playerid)
{
    if(fexist(Path(playerid)))
    {
        if(Info[playerid][Logged] == 1)
        {
            new INI:File = INI_Open(Path(playerid));
            INI_SetTag(File,"data");
            INI_WriteString(File,"Password",PlayerInfo[playerid][pPass]);
            INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
            INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
            INI_WriteInt(File,"Management",PlayerInfo[playerid][pMT]);
            INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
            INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
            INI_WriteInt(File,"Score",GetPlayerScore(playerid));
            INI_WriteInt(File,"Drugs",LPinfo[playerid][Drugs]);
            INI_WriteInt(File,"Adrenaline",LPinfo[playerid][Adre]);
            INI_WriteInt(File,"VIPLevel",Info[playerid][VIPLevel]);
            INI_WriteInt(File,"FavouriteSkin",Info[playerid][Favouriteskin]);
            INI_WriteInt(File,"FavouriteSong",Favouritesong[playerid]);
            INI_WriteInt(File,"BankMoney",BankMoney[playerid]);
            INI_WriteInt(File,"Daysalive",Daysalive[playerid]);
            INI_WriteInt(File,"Banned",Info[playerid][Banned]);
            INI_WriteInt(File,"Muted",Info[playerid][Muted]);
            INI_WriteInt(File,"MuteWarnings",Info[playerid][MuteWarnings]);
            INI_WriteInt(File,"MaxMuteWarnings",Info[playerid][MaxMuteWarnings]);
            INI_WriteInt(File,"Warnings",Info[playerid][Warnings]);
            INI_WriteInt(File,"TimesKicked",Info[playerid][TimesKicked]);
            INI_WriteInt(File,"StartingMusic",Info[playerid][StartingMusic]);
            INI_WriteInt(File,"Respect",Info[playerid][Respect]);
            INI_WriteInt(File,"AutoUseSkin",Autouseskin[playerid]);
            INI_WriteInt(File,"FightingSkill",fskillid[playerid]);
            INI_WriteInt(File,"TurfsCaptured",Turfscaptured[playerid]);
            INI_WriteInt(File,"TurfsLost",Turfslost[playerid]);
            INI_WriteInt(File,"AssistedTurfsCaptured",ATC[playerid]);
            INI_WriteInt(File,"Hours",PlayerInfo[playerid][pHours]);
            INI_WriteInt(File,"Minutes",PlayerInfo[playerid][pMins]);
            INI_WriteInt(File,"ObjectEditor",PlayerInfo[playerid][OEditor]);
            INI_WriteInt(File,"KillSounds",Info[playerid][KillSounds]);
            INI_Close(File);
            if(IsPlayerConnected(playerid))SendClientMessage(playerid, 0x00FFFFFF, "Your Stats Has Been {FFF700}Automatically{00FFFF} Saved.");
        }
    }
    return 1;
}

[22:06:04] [debug] Run time error 4: "Array index out of bounds"
[22:06:04] [debug] Accessing element at negative index -1
[22:06:04] [debug] AMX backtrace:
[22:06:04] [debug] #0 000185e4 in INI_Close (INI:file=-1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\YSI\y_ini.inc:746
[22:06:04] [debug] #1 000c63a4 in ?? (... <14 arguments>) at D:\SA-MP Things\SAMP 0.3.7 R2\gamemodes\LSGW.pwn:13474
[22:06:04] [debug] #2 00012fc8 in public OnPlayerEditAttachedObject (playerid=1, response=1, index=0, modelid=17079, boneid=1, Float:fOffsetX=0.77200, Float:fOffsetY=0.00000, Float:fOffsetZ=-0.00500, Float:fRotX=0.00000, Float:fRotY=0.00000, Float:fRotZ=0.00000, Float:fScaleX=1.00000, Float:fScaleY=1.00000, Float:fScaleZ=1.00100) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\YSI\y_hooks/impl.inc:2969
[22:06:55] [debug] Run time error 4: "Array index out of bounds"
[22:06:55] [debug] Accessing element at negative index -1

Line 13474:

pawn Код:
public OnPlayerEditAttachedObject( playerid, response, index, modelid, boneid,Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,Float:fRotX, Float:fRotY, Float:fRotZ,Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
    /*new debug_string[256+1];
    format(debug_string,256,"SetPlayerAttachedObject(playerid,%d,%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f)",
        index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);*/


    SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
    SendClientMessage(playerid, 0xFFFFFFFF, "You have finished editing attachments, it has been saved to your database.");

    new file[124];
    new name[24];
    new f1[15];
    GetPlayerName(playerid,name,24);
    format(file,sizeof(file),"PlayerObjects/%s.ini",name);
    new INI:data = INI_Open(file);
    INI_SetTag(data,"Attachments");
    format(f1,15,"O_Model_%d",index);
    INI_WriteInt(data,f1,modelid);
    format(f1,15,"O_Bone_%d",index);
    INI_WriteInt(data,f1,boneid);
    format(f1,15,"O_OffX_%d",index);
    INI_WriteFloat(data,f1,fOffsetX);
    format(f1,15,"O_OffY_%d",index);
    INI_WriteFloat(data,f1,fOffsetY);
    format(f1,15,"O_OffZ_%d",index);
    INI_WriteFloat(data,f1,fOffsetZ);
    format(f1,15,"O_RotX_%d",index);
    INI_WriteFloat(data,f1,fRotX);
    format(f1,15,"O_RotY_%d",index);
    INI_WriteFloat(data,f1,fRotY);
    format(f1,15,"O_RotZ_%d",index);
    INI_WriteFloat(data,f1,fRotZ);
    format(f1,15,"O_ScaleX_%d",index);
    INI_WriteFloat(data,f1,fScaleX);
    format(f1,15,"O_ScaleY_%d",index);
    INI_WriteFloat(data,f1,fScaleY);
    format(f1,15,"O_ScaleZ_%d",index);
    INI_WriteFloat(data,f1,fScaleZ);
    INI_Close(data);
    return 1; // Line 13474
}
[23:34:33] [debug] Run time error 4: "Array index out of bounds"
[23:34:33] [debug] Accessing element at negative index -1
[23:34:33] [debug] AMX backtrace:
[23:34:33] [debug] #0 000185e4 in INI_Close (INI:file=-1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\YSI\y_ini.inc:746
[23:34:33] [debug] #1 000a6b70 in ?? (... <5 arguments>) at D:\SA-MP Things\SAMP 0.3.7 R2\gamemodes\LSGW.pwn:11404
[23:34:33] [debug] #2 00011724 in public OnDialogResponse (playerid=0, dialogid=20002, response=1, listitem=-1, inputtext[]=@03129bfc "27121973") at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\YSI\y_hooks/impl.inc:2254

Line 11404:

pawn Код:
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                    PlayerAlreadyLoggedIn[playerid] = 1;
                    PlayerAlreadyRegisteredIn[playerid] = 1;
                    F_GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, LPinfo[playerid][Score]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome To The Server!\nYou have successfully logged in!\n\n"COL_WHITE"Please Make Sure That You Have Read All Our "COL_RED"/rules"COL_WHITE".","Ok","");
                    UserTimer[playerid] = SetTimerEx("UserSaver", 100000, true, "d", playerid);
                    PlayerDays[playerid] = SetTimerEx("DaysAlive", 1380000, true, "d", playerid);
                    Minscount[playerid] = SetTimerEx("Minscounter", 60000, true, "d", playerid);
                    GetPlayerName(playerid, logplayer, MAX_PLAYER_NAME);
                    format(pmsg, sizeof(pmsg), "[LOGIN] %s (%d) Has Logged In To His Account.", logplayer, playerid);
                    SendClientMessageToAll(0x00B8C2AA, pmsg);
                    new INI:File = INI_Open(UserPath2(playerid));
                    INI_WriteString(File,"IP", ip);
                    INI_Close(File); // Line 11404
please help me.
Reply
#2

anyone?
Reply
#3

I won't help you just because you think that we (I at least) need something like +REP to help you.
Reply
#4

Quote:
Originally Posted by GlobalShot
Посмотреть сообщение
I won't help you just because you think that we (I at least) need something like +REP to help you.
thats why it exist, you help people and get reputation for helping them. if you don't want it help him and tell him not to rep you..

and if reps isn't what you need to help him, what do you need.. ?


@topic
Most of these errors are explaining themselves, for example
Quote:

[22:05:55] [debug] Run time error 4: "Array index out of bounds"
[22:05:55] [debug] Accessing element at negative index -1
[22:05:55] [debug] AMX backtrace:
[22:05:55] [debug] #0 000185e4 in INI_Close (INI:file=-1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\YSI\y_ini.inc:746
[22:05:55] [debug] #1 00024874 in public UserSaver (playerid=0) at D:\SA-MP Things\SAMP 0.3.7 R2\gamemodes\LSGW.pwn:2143
[22:05:55] [debug] #2 00071fec in public OnPlPa_OnPlayerDisconnect (playerid=0, reason=1) at D:\SA-MP Things\SAMP 0.3.7 R2\gamemodes\LSGW.pwn:6708
[22:05:55] [debug] #3 native CallLocalFunction () from samp03svr
[22:05:55] [debug] #4 0001fa7c in ?? (... <2 arguments>) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\whenpause.inc:125
[22:05:55] [debug] #5 0000de3c in public SSCANF_OnPlayerDisconnect (playerid=0, reason=1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\YSI\y_hooks/impl.inc:661
[22:05:55] [debug] #6 000010ac in public Itter_OnPlayerDisconnect (playerid=0, reason=1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\sscanf2.inc:229
[22:05:55] [debug] #7 native CallLocalFunction () from samp03svr
[22:05:55] [debug] #8 000008f0 in public OnPlayerDisconnect (playerid=0, reason=1) at D:\SA-MP Things\SAMP 0.3.7 R2\pawno\include\foreach.inc:643

You're trying to "INI_Close" a file, which equals "-1" as it says "Accessing element at negative index -1"

this means you're putting an invalid address, read this
Quote:

This function starts the write process, it doesn't actually open a file, just sets up the buffer. On success it returns a handle to the ini with tag INI, on fail it returns INI_NO_FILE (INI:-1):

after opening a file, check it equals -1, if it does then don't continue and fix the address.
Reply
#5

Wont this make some players' stats unsaved?

EDIT: the weird thing is that this problem doesn't occur in Windows only Linux.
Reply
#6

Quote:
Originally Posted by Youssef221
Посмотреть сообщение
Wont this make some players' stats unsaved?
Only IF the player didn't register, and that should make since, if the player didn't register and don't have a file, why would I try to save his stats, if you want you could create a file if there wasn't one while your saving his stats.

Quote:
Originally Posted by Youssef221
Посмотреть сообщение
EDIT: the weird thing is that this problem doesn't occur in Windows only Linux.
Thats because Windows and Linus use different plugins, but the problem is there anyway.
Reply
#7

Nevermind, fixed it by deleting all players' data.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)