Run time error 4: "Array index out of bounds"
#5

Okey so I got this:

Код:
[22:24:03] [debug] Run time error 4: "Array index out of bounds"
[22:24:03] [debug]  Accessing element at index 63 past array upper bound 62
[22:24:03] [debug] AMX backtrace:
[22:24:03] [debug] #0 00043f10 in ForceDrop (playerid=0) at C:\Users\Lenovo\Desktop\dayz\gamemodes\dayz.pwn:5127
[22:24:03] [debug] #1 0002e7c0 in ?? (... <3 arguments>) at C:\Users\Lenovo\Desktop\dayz\gamemodes\dayz.pwn:3449
[22:24:03] [debug] #2 00017dc8 in public OnPlayerDeath (playerid=0, killerid=65535, reason=255) at C:\Users\Lenovo\Desktop\dayz\pawno\include\YSI\y_hooks/impl.inc:753
That means that problem is in ForceDrop which drops loots:
pawn Код:
stock ForceDrop(playerid)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    for(new i; i < 99; i++)
    {
        if(PlayerHasItem(playerid, ItemInfo[i][Item_Name])) // LINE IN ERROR
        {
            CreateDrop(ItemInfo[i][Item_ID], X+random(3), Y+random(5), Z);
        }
    }
    return 1;
}

stock PlayerHasItem(playerid,ItemName[])
{
    for(new item;item < MAX_INV_ITEMS; item++)
    {
        if(!_GetItemAmountPVar(playerid,item))continue;
        if(!strcmp(_GetItemNamePVar(playerid,item),ItemName,false))return _GetItemAmountPVar(playerid,item);
    }
    return 0;
}

stock CreateDrop(itemid, Float:X, Float:Y, Float:Z)
{
    if(itemid != -1)
    {
        for(new i; i < MAX_DROPS; i++)
        {
            if(DropInfo[i][dPosX] == 0.0 && DropInfo[i][dPosY] == 0.0 && DropInfo[i][dPosZ] == 0.0)
            {
                new str[100];

                DropInfo[i][dPosX] = X, DropInfo[i][dPosY] = Y, DropInfo[i][dPosZ] = Z-0.92;

                DropInfo[i][DropItemID] = itemid;

                format(str, sizeof(str), "{FFFFFF}[{27E6E6}%s{FFFFFF}]\nPress [{27E6E6}C{FFFFFF}] {FFFFFF}to Pickup.", ItemInfo[itemid][Item_Name]);
                DropInfo[i][DropLabel] = CreateDynamic3DTextLabel(str, -1, DropInfo[i][dPosX], DropInfo[i][dPosY], DropInfo[i][dPosZ], 1.5);
                DropInfo[i][DropObj] = CreateDynamicObject(ItemInfo[itemid][Item_Obj], DropInfo[i][dPosX], DropInfo[i][dPosY], DropInfo[i][dPosZ], ItemInfo[itemid][Item_RotX], ItemInfo[itemid][Item_RotY], ItemInfo[itemid][Item_RotZ]);
                return 1;
            }
        }
    }
    return 0;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)