SA-MP Forums Archive
[Ajuda] CrashDetect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] CrashDetect (/showthread.php?tid=498302)



CrashDetect - iHarzard - 02.03.2014

Bom galera, tenho este cуdigo na minha OnPlayerTakeDamage, sу que o crashdetect estб detectando crash nele. Alguem sabe porque e como retirar esse crash?

Log do crash:
pawn Code:
[17:28:42] [debug] Run time error 4: "Array index out of bounds"
[17:28:42] [debug] Accessing element at index 65535 past array upper bound 499
[17:28:42] [debug] AMX backtrace:
[17:28:42] [debug] #0 000ad0bc in public OnPlayerTakeDamage (0x00000000, 0x0000ffff, 0x409e6667, 0x00000036) from GM4.amx
Cуdigo:
pawn Code:
if(IsPlayerConnected(playerid))
    {
        new str[256], TempoMostrarLife[MAX_PLAYERS];
        PlayerPlaySound(playerid, 1095,  0.0, 0.0, 0.0);
        PlayerPlaySound(issuerid, 6401,  0.0, 0.0, 0.0);
        //===================[ playerid ]==================================
        new Float:health;
        GetPlayerHealth(playerid, health);
        if(issuerid == INVALID_PLAYER_ID)
        {
            KillTimer(TempoMostrarLife[playerid]);
            TextDrawShowForPlayer(playerid, MostrarVida[playerid]);
            format(str,sizeof(str),"~y~Vida:~r~  -%.1f", amount);
            TextDrawSetString(MostrarVida[playerid], str);
            TempoMostrarLife[playerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", playerid);
            MostrandoVida[playerid] = 1;
        }
        else
        {
            KillTimer(TempoMostrarLife[playerid]);
            TextDrawShowForPlayer(playerid, MostrarVida[playerid]);
            format(str,sizeof(str),"~y~%s ~n~~w~tirou:  ~r~-%.1f", Nome(issuerid), amount);
            TextDrawSetString(MostrarVida[playerid], str);
            TempoMostrarLife[playerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", playerid);
            MostrandoVida[playerid] = 1;
        }
        //==================[ issuerid ] ======================================
        KillTimer(TempoMostrarLife[issuerid]);
        TextDrawShowForPlayer(issuerid, MostrarVida[issuerid]);
        format(str,sizeof(str),"~y~%s:~g~  -%.1f",Nome(playerid), amount);
        TextDrawSetString(MostrarVida[issuerid], str);
        TempoMostrarLife[issuerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", issuerid);
        MostrandoVida[issuerid] = 1;
    }



Re: CrashDetect - Konstantinos - 02.03.2014

pawn Code:
if (issuerid != INVALID_PLAYER_ID)
{
    KillTimer(TempoMostrarLife[issuerid]);
    TextDrawShowForPlayer(issuerid, MostrarVida[issuerid]);
    format(str,sizeof(str),"~y~%s:~g~  -%.1f",Nome(playerid), amount);
    TextDrawSetString(MostrarVida[issuerid], str);
    TempoMostrarLife[issuerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", issuerid);
    MostrandoVida[issuerid] = 1;
}