SA-MP Forums Archive
Run time error 4: "Array index out of bounds" - 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: Run time error 4: "Array index out of bounds" (/showthread.php?tid=578174)



Run time error 4: "Array index out of bounds" - MW - 17.06.2015

pawn Код:
[13:45:48] [debug] Run time error 4: "Array index out of bounds"
[13:45:48] [debug]   Accessing element at index 3 past array upper bound 2
[13:45:48] [debug] Backtrace (most recent call first):
[13:45:48] [debug] #0  public OnPlayerPickUpStreamPickup()+0x22d4 from GJ.amx
[13:45:48] [debug] #1  public OnPlayerPickUpDynamicPickup()+0x20 from GJ.amx
[13:45:48] [debug] #2  native Streamer_CallbackHook() from streamer.DLL
[13:45:48] [debug] #3  0x00000000()+0x292e0 from GJ.amx
pawn Код:
public OnPlayerPickUpStreamPickup(playerid,pickupid)
{
    for(new h = 0; h < sizeof(FamilyInfo); h++)
    {
        if(pickupid == FamilyInfo[h][PickupID])
        {
            if(FamilyInfo[h][FamilySafe] == 1)
            {
                GameTextForPlayer(playerid, "~b~Family Locker~n~~w~Type ~r~/flocker~w~ to store items", 5000, 3);
            }
            return 1;
        }
    }
    for(new i = 0; i < sizeof(Restaurants);i++)
    {
        if(PlayerToPoint(2,playerid,
            Restaurants[i][rest_x],
            Restaurants[i][rest_y],
            Restaurants[i][rest_z]
        ))
        {
            LastUsedEntrance[playerid] = gettime();
            SetPlayerPos(playerid,377.0800,-192.9900,1000.6410);
            SetPlayerFacingAngle(playerid,0.0);
            SetPlayerInterior(playerid,17);
            SetPlayerVirtualWorld(playerid,i);
            return 1;
        }
    }

    return 1;
}
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    OnPlayerPickUpStreamPickup(playerid, pickupid);
    return 1;
}



Re: Run time error 4: "Array index out of bounds" - Darrenr - 17.06.2015

Is this from an include that you've downloaded?


Re: Run time error 4: "Array index out of bounds" - MW - 17.06.2015

Server log