When a player disconnects the server crashes because of these errors
#1

Hello guys, today i knew why the server was crashing sometimes when the player disconnects.
I just kicked someone then checked my server log.
and i found these errors, i'm using crash detect.

Код:
[19:51:24] [debug] Run time error 4: "Array index out of bounds"
[19:51:24] [debug]  Attempted to read/write array element at negative index -1
[19:51:24] [debug] AMX backtrace:
[19:51:24] [debug] #0 000bed98 in ?? (-1) from RDM.amx
[19:51:24] [debug] #1 000becd0 in ?? (-1, 0) from RDM.amx
[19:51:24] [debug] #2 000beab8 in ?? (2, 2) from RDM.amx
[19:51:24] [debug] #3 000396d8 in public SSCANF_OnPlayerDisconnect (2, 2) from RDM.amx
[19:51:24] [debug] #4 000069e0 in public Iter_OnPlayerDisconnect (2, 2) from RDM.amx
[19:51:24] [debug] #5 000067c0 in public _y_utils_OnPlayerDisconnect (2, 2) from RDM.amx
[19:51:24] [debug] #6 00004ec0 in public OnPlayerDisconnect (2, 2) from RDM.amx
[19:51:24] [debug] #7 native Kick () from sampsvr-port_97
[19:51:24] [debug] #8 000b9910 in public kickedtimer (2) from RDM.amx
[19:51:24] [part] Legacy has left the server (2:2)
Can you tell me what i must do?
Reply
#2

Show OnPlayerDisconnect and kickedtimer.
Reply
#3

sure
Код:
public OnPlayerDisconnect(playerid, reason)
{
    
    Adved[playerid] = 0;
    useexs[playerid] = 0;
    Jumpboost[playerid] = 0;
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection/Crash)", pname);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked/Banned)", pname);
    }
    if(dini_Isset(AddDirFile("users", GetName(playerid)), "busid"))
    {
        KillTimer(busdata[dini_Int(AddDirFile("users", GetName(playerid)), "busid")][ptimer]);
    }
    if(logged[playerid] == 1)
    {
        SavePlayer(playerid);
        logged[playerid] = 0;
    }
    if(IsBeingSpeced[playerid] == 1)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i,false);
            }
        }
    }
    if(Dueling[playerid] == true)
    {
        SetPlayerHealth(playerid,0.0);
        SendClientMessage(playerid,COLOR_ORANGE,"the duel has been canceled due to bad connection or leaving");
        SendClientMessage(Invited[playerid],COLOR_ORANGE,"the duel has been canceled due to bad connection or leaving");
        DuelActive = false;
        Dueling[Duelist[playerid]] = false;
        Duelist[Duelist[playerid]] = -1;
        Dueling[playerid] = false;
        WinningPrice = 0;
        SpawnPlayer(playerid);
        SpawnPlayer(Invited[playerid]);
        SetPlayerHealth(Invited[playerid],0);
        SetPlayerInterior(Invited[playerid],1);
        SetPlayerInterior(playerid,1);
        SetPlayerHealth(playerid,0);
    }
    if(indm[playerid])
    {
        indm[playerid] =false, pfrozen[playerid] =false;
        SetPlayerWantedLevel(playerid,0), ResetPlayerWeapons(playerid);
        playernumberdm--, KillTimer(playerstimerdm[playerid]);
    }
    if(indm2[playerid])
    {
        indm2[playerid] =false, pfrozen2[playerid] =false;
        SetPlayerWantedLevel(playerid,0), ResetPlayerWeapons(playerid);
        playernumberdm2--, KillTimer(playerstimerdm2[playerid]);
    }
    if(indm3[playerid])
    {
        indm3[playerid] =false, pfrozen3[playerid] =false;
        SetPlayerWantedLevel(playerid,0), ResetPlayerWeapons(playerid);
        playernumberdm3--, KillTimer(playerstimerdm3[playerid]);
    }
    if(indm4[playerid])
    {
        indm4[playerid] =false, pfrozen4[playerid] =false;
        SetPlayerWantedLevel(playerid,0), ResetPlayerWeapons(playerid);
        playernumberdm4--, KillTimer(playerstimerdm4[playerid]);
    }
    if(indm5[playerid])
    {
        indm5[playerid] =false, pfrozen5[playerid] =false;
        SetPlayerWantedLevel(playerid,0), ResetPlayerWeapons(playerid);
        playernumberdm5--, KillTimer(playerstimerdm5[playerid]);
    }
    if(AccData[playerid][JailDuration] != 0)
    {
        dini_IntSet(AddDirFile("users", GetPlayerNameEx(playerid)), "JailDuration", AccData[playerid][JailDuration]);
        KillTimer(jailtimer[playerid]);
        AccData[playerid][JailDuration] = 0;
    }
    SendClientMessageToAll(0xAAAAAAAA, string);
    LastPm[playerid] = -1;
    request[playerid] = 0;
    streak[playerid] = 0;
    mechjob[playerid] = 0;
    Repairing[playerid] = 0;
    fishing[playerid] = 0;
    security[playerid] = 0;
    farmerjob[playerid] = 0;
    AccData[playerid][bLevel] = 0;
    AccData[playerid][pBombs] = 0;
    Healing[playerid] = 0;
    SF[playerid] = 0;
    LV[playerid] = 0;
    LS[playerid] = 0;
    FiremanJob[playerid] = 0;
    infreeroam[playerid] = 0;
    injail[playerid] = 0;
    mjob[playerid] = 0;
    pjob[playerid] = 0;
    pizza[playerid] = 0;
    KillTimer(Timer[playerid]);
    lobby[playerid]=1;
    InDM[playerid] = 0;
    InDM2[playerid] = 0;
    InDM3[playerid] = 0;
    InDM4[playerid] = 0;
    InDM5[playerid] = 0;
    InDM6[playerid] = 0;
    InDM7[playerid] = 0;
    InDM8[playerid] = 0;
    InDM9[playerid] = 0;
    InDM10[playerid] = 0;
    gLevel[playerid] = 0;
    vjump[playerid] = 0;
    vtext[playerid] = 0;
    city[playerid] = 0;
    undead[playerid] = 0;
    explose[playerid] = 0;
    shoot[playerid] = 0;
    tank[playerid] = 0;
    useundead[playerid] = 0;
    useexplose[playerid] = 0;
    useshoot[playerid] = 0;
    AnticheatSpam[playerid] = 0;
    asked[playerid] = 0;
    pSkin[playerid]= 0;
    LeaveGroup(playerid, 2);
    return 1;
}
Код:
forward kickedtimer(id);
public kickedtimer(id)
{
    
    Kick(id);
    return 1;
}
Reply
#4

I think you have to remove return from the public kickedtimer
Reply
#5

Well why should i remove it? i'm currently using it mate
Reply
#6

try to remove just the "return"
Reply
#7

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
try to remove just the "return"
Man, "return" isn't the error
Reply
#8

As usually, compile the script with latest includes of pawno and plugins.
Reply
#9

Quote:
Originally Posted by Bolex_
Посмотреть сообщение
As usually, compile the script with latest includes of pawno and plugins.
I'm using the latest includes and plugins, mate.
Reply
#10

I dont think that return is a problem, just add a debug messages and try to reach a cause of the crash.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)