SA-MP Forums Archive
[13:59:06] [debug] Accessing element at index 999 past array upper bound 499 - 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: [13:59:06] [debug] Accessing element at index 999 past array upper bound 499 (/showthread.php?tid=522561)



[13:59:06] [debug] Accessing element at index 999 past array upper bound 499 - PawnOX - 28.06.2014

How to fix this?

Код:
[13:59:06] [debug] Run time error 4: "Array index out of bounds"
[13:59:06] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:06] [debug] AMX backtrace:
[13:59:06] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
[13:59:06] [debug] Run time error 4: "Array index out of bounds"
[13:59:06] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:06] [debug] AMX backtrace:
[13:59:06] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
[13:59:07] [debug] Run time error 4: "Array index out of bounds"
[13:59:07] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:07] [debug] AMX backtrace:
[13:59:07] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
[13:59:07] [debug] Run time error 4: "Array index out of bounds"
[13:59:07] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:07] [debug] AMX backtrace:
[13:59:07] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
[13:59:07] [debug] Run time error 4: "Array index out of bounds"
[13:59:07] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:07] [debug] AMX backtrace:
[13:59:07] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
[13:59:07] [debug] Run time error 4: "Array index out of bounds"
[13:59:07] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:07] [debug] AMX backtrace:
[13:59:07] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
[13:59:08] [debug] Run time error 4: "Array index out of bounds"
[13:59:08] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:08] [debug] AMX backtrace:
[13:59:08] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
[13:59:08] [debug] Run time error 4: "Array index out of bounds"
[13:59:08] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:08] [debug] AMX backtrace:
[13:59:08] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
[13:59:08] [debug] Run time error 4: "Array index out of bounds"
[13:59:08] [debug]  Accessing element at index 999 past array upper bound 499
[13:59:08] [debug] AMX backtrace:
[13:59:08] [debug] #0 00000eac in public OnObjectMoved (0x00000001) from BB.amx
pawn Код:
public OnObjectMoved(objectid)
{
    new i = Baller;
    if(ShootingBall == 2)
    {
                BallDown2(i);
                return 1;
    }
    else if(ShootingBall == 3)
    {
                BallDown3(i);
                return 1;
    }
    else if(ShootingBall == 4)
    {
                BallDown4(i);
                return 1;
    }
    else if(ShootingBall == 5)
    {
                BallDown5(i);
                return 1;
    }
    else if(ShootingBall == 6)
    {
        ApplyAnimation(i,"BSKTBALL","BBALL_walk",4.1,1,1,1,1,1);
                HavingBall[i] = 1;
                Anim[i] = 0;
    }
    if(BallBounce == 1)
    {
        new Float:x, Float:y, Float:z;
            GetObjectPos(Ball, x, y, z);
            MoveObject(Ball, x, y, z+1.2, 4);
            BallBounce = 2;
        }
        else if(BallBounce == 2)
    {
        new Float:x, Float:y, Float:z;
            GetObjectPos(Ball, x, y, z);
            MoveObject(Ball, x, y, z-1.2, 4);
            BallBounce = 3;
        }
        else if(BallBounce == 3)
    {
        new Float:x, Float:y, Float:z;
            GetObjectPos(Ball, x, y, z);
            MoveObject(Ball, x, y, z+0.8, 3);
            BallBounce = 4;
        }
        else if(BallBounce == 4)
    {
        new Float:x, Float:y, Float:z;
            GetObjectPos(Ball, x, y, z);
            MoveObject(Ball, x, y, z-0.8, 3);
            BallBounce = 5;
        }
        else if(BallBounce == 5)
    {
        new Float:x, Float:y, Float:z;
            GetObjectPos(Ball, x, y, z);
            MoveObject(Ball, x, y, z+0.5, 2);
            BallBounce = 6;
        }
        else if(BallBounce == 6)
    {
        new Float:x, Float:y, Float:z;
            GetObjectPos(Ball, x, y, z);
            MoveObject(Ball, x, y, z-0.5, 2);
            BallBounce = 7;
        }
        else if(BallBounce == 7)
    {
        new Float:x, Float:y, Float:z;
            GetObjectPos(Ball, x, y, z);
            MoveObject(Ball, x, y, z+0.2, 1);
            BallBounce = 8;
        }
        else if(BallBounce == 8)
    {
        new Float:x, Float:y, Float:z;
            GetObjectPos(Ball, x, y, z);
            MoveObject(Ball, x, y, z-0.2, 1);
            BallBounce = 0;
        }
    if(!HavingBall[i]) return 1;
        new Keys, ud, lr;
        GetPlayerKeys(i, Keys, ud, lr);
    if(Anim[i])
    {
        switch(BallStatus)
            {
                        case 0:
                        {
                                BallStatus = 1;
                                new Float:x, Float:y, Float:z;
                                GetPlayerPos(i, x, y, z);
                                StopObject(Ball);
                                new Float:x2, Float:y2;
                            GetXYInFrontOfPlayer(i, x2, y2, 0.4);
                                MoveObject(Ball, x2, y2, z+0.1, 5.5);
                        }
                        case 1:
                        {
                        BallStatus = 0;
                        new Float:x, Float:y, Float:z;
                                GetPlayerPos(i, x, y, z);
                                StopObject(Ball);
                                new Float:x2, Float:y2;
                                GetXYInFrontOfPlayer(i, x2, y2, 0.4);
                                MoveObject(Ball, x2, y2, z-0.8, 5.5);
                        }
                }
                return 1;
    }
    if(Keys & KEY_SPRINT)
        {
        ApplyAnimation(i,"BSKTBALL","BBALL_run",4.1,1,1,1,1,1);
        switch(BallStatus)
                {
                        case 0:
                        {
                                BallStatus = 1;
                                new Float:x, Float:y, Float:z;
                                GetPlayerPos(i, x, y, z);
                                StopObject(Ball);
                                new Float:x2, Float:y2;
                        GetXYInFrontOfPlayer(i, x2, y2, 1.5);
                                MoveObject(Ball, x2, y2, z+0.1, 8);
                        }
                        case 1:
                        {
                        BallStatus = 0;
                        new Float:x, Float:y, Float:z;
                                GetPlayerPos(i, x, y, z);
                                StopObject(Ball);
                                new Float:x2, Float:y2;
                                GetXYInFrontOfPlayer(i, x2, y2, 1.5);
                                MoveObject(Ball, x2, y2, z-0.8, 8);
                        }
                }
                return 1;
    }
    else
    {
        ApplyAnimation(i,"BSKTBALL","BBALL_walk",4.1,1,1,1,1,1);
    }
        switch(BallStatus)
        {
                case 0:
                {
                        BallStatus = 1;
                        new Float:x, Float:y, Float:z;
                        GetPlayerPos(i, x, y, z);
                        StopObject(Ball);
                        new Float:x2, Float:y2;
                    GetXYInFrontOfPlayer(i, x2, y2, 1.2);
                        MoveObject(Ball, x2, y2, z+0.1, 5);
                }
                case 1:
                {
                BallStatus = 0;
                new Float:x, Float:y, Float:z;
                        GetPlayerPos(i, x, y, z);
                        StopObject(Ball);
                        new Float:x2, Float:y2;
                        GetXYInFrontOfPlayer(i, x2, y2, 1.2);
                        MoveObject(Ball, x2, y2, z-0.8, 5);
                }
        }
    return 1;
}



Re: [13:59:06] [debug] Accessing element at index 999 past array upper bound 499 - BroZeus - 28.06.2014

make sure its like this-
new HavingBall[MAX_PLAYERS], Anim[MAX_PLAYERS];