Errors in LOG.
#1

Hi!

I have this error in server_log

Quote:

[16:44:38] [debug] Run time error 4: "Array index out of bounds"
[16:44:38] [debug] Attempted to read/write array element at index 300 in array of size 120
[16:44:38] [debug] AMX backtrace:
[16:44:38] [debug] #0 002b17e4 in public pc_cmd_henter (playerid=2, params[]=@002be7b4 "300") at grandlarc.pwn:36899

Command:
Quote:

CMD:henter(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < return SendClientMessage(playerid, COLOR_WHITE, "{5CAD5C}Error: Your admin/helper level isn't high enough to use this command.");
new id;
if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GREY, "INFO: /henter [id]");
new Float:X, Float:Y, Float:Z, Float:A, string[200];
GetPlayerPos(playerid, X, Y, Z);
HouseInfo[id][hEntx] = X;
HouseInfo[id][hEnty] = Y;
HouseInfo[id][hEntz] = Z;
GetPlayerFacingAngle(playerid, A);
HouseInfo[id][hEntrancea] = A;
DestroyDynamic3DTextLabel(HouseLabel[id]);
if(HouseInfo[id][hOwned])
{
if(!HouseInfo[id][hRent]) { format(string, sizeof(string), "{006400}House %d \n{006400}This House is owned by {FFFFFF}%s \n{006400}Level: {FFFFFF}%d", id, HouseInfo[id][hOwner], HouseInfo[id][hLevel]); }
else { format(string, sizeof(string), "{006400}House %d \n{006400}This House is owned by {FFFFFF}%s \n{006400}Rent: {FFFFFF}%d$ \n{006400}Level: {FFFFFF}%d \n{006400}Type /rentroom to rent a room", id, HouseInfo[id][hOwner], HouseInfo[id][hRent], HouseInfo[id][hLevel]); }
HouseLabel[id] = CreateDynamic3DTextLabel(string, 0x006400FF, HouseInfo[id][hEntx], HouseInfo[id][hEnty], HouseInfo[id][hEntz], 15.0);
}
else
{
format(string, sizeof(string), "{006400}House %d \nThis House is for sale \n{006400}Cost: {FFFFFF}%d$ \n{006400}Level: {FFFFFF}%d \n{006400}To buy this house type /buyhouse", id, HouseInfo[id][hValue], HouseInfo[id][hLevel]);
HouseLabel[id] = CreateDynamic3DTextLabel(string, 0x006400FF, HouseInfo[id][hEntx], HouseInfo[id][hEnty], HouseInfo[id][hEntz], 15.0);
}
if(IsValidDynamicMapIcon(HouseInfo[id][hPickup])) DestroyDynamicMapIcon(HouseInfo[id][hPickup]);
HouseInfo[id][hPickup] = CreateDynamicMapIcon(X, Y, Z, 31, COLOR_GREEN);
format(string,sizeof(string), "You have set House: %d's Entrance", id);
SendClientMessage(playerid, COLOR_ADMIN, string);
format(string, sizeof(string), "%s (%d) House Enter %d %s %s", PlayerInfo[playerid][pName], playerid, id, GetDMY(1), GetHMS());
AdminLog(string);
return 1;
}

I say in chat: /henter 300
Reply
#2

You can't go higher than 119. If you want have more house than this number, increase your array's size.
Reply
#3

Код:
Run time error 4: "Array index out of bounds"
You're trying to reach an index that doesn't exist in the array.

Код:
Attempted to read/write array element at index 300 in array of size 120
Your array is capped at 119 "entries".

A possible fix:
pawn Код:
#define    MAX_HOUSES   1000
pawn Код:
HouseInfo[MAX_HOUSES][...]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)