[debug] Attempted to read/write array element at index 90 in array of size 90 HELP ME D: - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [debug] Attempted to read/write array element at index 90 in array of size 90 HELP ME D: (
/showthread.php?tid=630556)
[debug] Attempted to read/write array element at index 90 in array of size 90 HELP ME D: -
tomasfernandez - 15.03.2017
[16:34:21] [debug] Run time error 4: "Array index out of bounds"
[16:34:21] [debug] Attempted to read/write array element at index 90 in array of size 90
[16:34:21] [debug] AMX backtrace:
[16:34:21] [debug] #0 00169514 in public dmgTdUpdate () from Mundito.amx
CODE:
PHP код:
public dmgTdUpdate()
{
        for(new playerid = 0; playerid < MAX_SERVER_PLAYERS; playerid++)
        {
                if(!IsPlayerConnected(playerid)) continue;
                if(txdAlpha[0][playerid] > 0)
                {
                        TextDrawColor(txd[0][playerid], setAlpha(COLOR_LEFT, txdAlpha[0][playerid]));
                        TextDrawBackgroundColor(txd[0][playerid], setAlpha(0x000000FF, txdAlpha[0][playerid] / 0x6));
                        TextDrawShowForPlayer(playerid, txd[0][playerid]);
                        txdAlpha[0][playerid] -= 0x6;
                }
                else if(txdAlpha[0][playerid] < 0)
                {
                        TextDrawHideForPlayer(playerid, txd[0][playerid]);
                        txdAlpha[0][playerid] = 0;
                        for(new a = 0; a < MAX_SERVER_PLAYERS; a++)
                                currentHpLoss[0][playerid][a] = 0.0;
                }
                if(txdAlpha[1][playerid] > 0)
                {
                        TextDrawColor(txd[1][playerid], setAlpha(COLOR_RIGHT, txdAlpha[1][playerid]));
                        TextDrawBackgroundColor(txd[1][playerid], setAlpha(0x000000FF, txdAlpha[1][playerid] / 0x6));
                        TextDrawShowForPlayer(playerid, txd[1][playerid]);
                        txdAlpha[1][playerid] -= 0x6;
                }
                else if(txdAlpha[1][playerid] < 0)
                {
                        TextDrawHideForPlayer(playerid, txd[1][playerid]);
                        txdAlpha[1][playerid] = 0;
                        for(new a = 0; playerid < MAX_SERVER_PLAYERS; a++)
                                currentHpLoss[1][playerid][a] = 0.0;
                }
        }
}
setAlpha(color, a)
{
        return (((color >> 24) & 0xFF) << 24 | ((color >> 16) & 0xFF) << 16 | ((color >> 8) & 0xFF) << 8 | floatround((float(color & 0xFF) / 255) * a));
}
createTextDraws()
{
        for(new playerid = 0; playerid < MAX_SERVER_PLAYERS; playerid++)
        {
                txd[0][playerid] = TextDrawCreate(200.0, 370.0, " ");
                TextDrawLetterSize(txd[0][playerid], 0.24, 1.1);
                TextDrawColor(txd[0][playerid], COLOR_LEFT);
                TextDrawFont(txd[0][playerid], 1);
                TextDrawSetShadow(txd[0][playerid], 0);
                TextDrawAlignment(txd[0][playerid], 2);
                TextDrawSetOutline(txd[0][playerid], 1);
                TextDrawBackgroundColor(txd[0][playerid], 0x0000000F);
                txd[1][playerid] = TextDrawCreate(440.0, 370.0, " ");
                TextDrawLetterSize(txd[1][playerid], 0.24, 1.1);
                TextDrawColor(txd[1][playerid], COLOR_RIGHT);
                TextDrawFont(txd[1][playerid], 1);
                TextDrawSetShadow(txd[1][playerid], 0);
                TextDrawAlignment(txd[1][playerid], 2);
                TextDrawSetOutline(txd[1][playerid], 1);
                TextDrawBackgroundColor(txd[1][playerid], 0x0000000F);
        }
}Â
help me, u_u
Re: [debug] Attempted to read/write array element at index 90 in array of size 90 HELP ME D: -
SkyLineGT - 16.03.2017
show the creation of txdAlpha & currentHpLoss arrays
Respuesta: [debug] Attempted to read/write array element at index 90 in array of size 90 HELP ME D: -
tomasfernandez - 16.03.2017
PHP код:
new
 Text:txd[2][MAX_SERVER_PLAYERS],
 txdAlpha[2][MAX_SERVER_PLAYERS],
 Float:currentHpLoss[2][MAX_SERVER_PLAYERS][MAX_SERVER_PLAYERS];Â
Re: [debug] Attempted to read/write array element at index 90 in array of size 90 HELP ME D: -
Toroi - 16.03.2017
PHP код:
new Text:txd[2][MAX_SERVER_PLAYERS], txdAlpha[2][MAX_SERVER_PLAYERS], Float:currentHpLoss[2][MAX_SERVER_PLAYERS][MAX_SERVER_PLAYERS+1];Â