Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Array index out of bounds

$
0
0
Hello,
here is the server log error:

[10:33:28] [CMD]: Oblivion(0) has used the command '/createhouse 10000000 1'
[10:33:28] A_I value of the newly entered house: 818
[10:33:28] [debug] Run time error 4: "Array index out of bounds"
[10:33:28] [debug] Attempted to read/write array element at index 818 in array of size 800
[10:33:28] [debug] AMX backtrace:
[10:33:28] [debug] #0 0003807c in public OnHouseCreate (0, 1159458251, -992784088, 1097613312, 1135864766, 1159458279, -992804568, 1097613312, 1, 10000000) from gamemode.amx

also with this, the house is not created in-game. I think it has something to do with this.

Here is the OnHouseCreate code.

Code:

forward OnHouseCreate(playerid, Float:inX, Float:inY, Float:inZ, Float:outA, Float:outX, Float:outY, Float:outZ, interiorID, cost);
public OnHouseCreate(playerid, Float:inX, Float:inY, Float:inZ, Float:outA, Float:outX, Float:outY, Float:outZ, interiorID, cost)
{
        new h = cache_insert_id();
        new labeltext[300];

    printf("A_I value of the newly entered house: %d", h);
        hInfo[h][CPOutX] = inX, hInfo[h][CPOutY] = inY, hInfo[h][CPOutZ] = inZ;
        hInfo[h][SpawnOutX] = outX, hInfo[h][SpawnOutY] = outY, hInfo[h][SpawnOutZ] = outZ, hInfo[h][SpawnOutAngle] = outA;
        hInfo[h][HouseInterior] = interiorID;

        format(hInfo[h][HousePassword], 28, "%s", "INVALID_HOUSE_PASSWORD");
        format(hInfo[h][HouseName], 28, "%s", DEFAULT_HOUSE_NAME);
        format(hInfo[h][HouseOwner], 24, "%s", INVALID_HOWNER_NAME);
        format(hInfo[h][HouseLocation], 30, "%s", GetHouseLocation(h));
        hInfo[h][HouseValue] = cost, hInfo[h][HouseStorage] = 0, hInfo[h][HouseForSale] = 0;

        format(labeltext, sizeof(labeltext), LABELTEXT1, DEFAULT_HOUSE_NAME, ToCurrency(cost), h);
        HouseMIcon[h] = CreateDynamicMapIcon(inX, inY, inZ, 31, -1, -1, -1, -1, MICON_VD);
        HouseLabel[h] = CreateDynamic3DTextLabel(labeltext, COLOR_GREEN, inX, inY, inZ+0.7, TEXTLABEL_DISTANCE, .testlos = 1);
        HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, inX, inY, inZ, -1, -1, -1, 30.0);
        HousePickupInt[h] = CreateDynamicPickup(PICKUP_MODEL_INT, PICKUP_TYPE, hIntInfo[interiorID][IntCPX], hIntInfo[interiorID][IntCPY], hIntInfo[interiorID][IntCPZ], (h + 1000), hIntInfo[interiorID][IntInterior], -1, 15.0);
 
        ShowInfoBox(playerid, I_H_CREATED, h);
        format(str, sizeof(str), "Server: "GREY2_E"House ID "GREY_E"[%d] "GREY2_E"created!", h);
        SendClientMessage(playerid, COLOR_RED, str);
       
        Iter_Add(Houses, h);
        format(query, sizeof(query), "UPDATE houses SET hlocation='%s',hint=%d WHERE house_id=%d", hInfo[h][HouseLocation], interiorID, h);
        MySQL_updateQuery(query);
        return 1;
}

Please do help me, thanks.

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>