Jump to content
  • 0

Accessing element at index 100 past array upper bound 99


Gabriel03

Question

Am folosit crashdetect si in loguri am primit asta:


[09:31:01] [debug] Run time error 4: "Array index out of bounds"
[09:31:01] [debug]  Accessing element at index 100 past array upper bound 99
[09:31:01] [debug] AMX backtrace:
[09:31:01] [debug] #0 00262cf4 in public LoadProperty () from wa-rpg.amx
[09:31:01] [debug] #1 00093800 in public zcmd_OnGameModeInit () from wa-rpg.amx
[09:31:01] [debug] #2 native CallLocalFunction () from samp03svr
[09:31:01] [debug] #3 0001f9dc in public L_AFK_OnGM () from wa-rpg.amx
[09:31:01] [debug] #4 native CallLocalFunction () from samp03svr
[09:31:01] [debug] #5 00012c20 in public SSCANF_OnGameModeInit () from wa-rpg.amx

Functia:

function LoadProperty() {
	new result[180],index = 0;
    mysql_query(SQL,"SELECT * FROM `houses` ORDER BY `houses`.`ID` ASC");
    mysql_store_result();
    while(mysql_retrieve_row()) {
        housess++;
		index++;
		new i = index;

		mysql_get_field("ID", result);				HouseInfo[i][hID] = strval(result);
   	    mysql_get_field("Entrancex", result);		HouseInfo[i][hEntrancex] = floatstr(result);
    	mysql_get_field("Entrancey", result);		HouseInfo[i][hEntrancey] = floatstr(result);
        mysql_get_field("Entrancez", result);		HouseInfo[i][hEntrancez] = floatstr(result);
        mysql_get_field("Exitx", result);			HouseInfo[i][hExitx] = floatstr(result);
        mysql_get_field("Exity", result);			HouseInfo[i][hExity] = floatstr(result);
        mysql_get_field("Exitz", result);			HouseInfo[i][hExitz] = floatstr(result);
        mysql_get_field("Owner", result);			strmid(HouseInfo[i][hOwner], result, 0, 32, 32);
        mysql_get_field("Discription", result);		strmid(HouseInfo[i][hDiscription], result, 0, 24, 24);
        mysql_get_field("Value", result);			HouseInfo[i][hValue] = strval(result);
        mysql_get_field("Hel", result);				HouseInfo[i][hHel] = strval(result);
        mysql_get_field("Arm", result);				HouseInfo[i][hArm] = strval(result);
        mysql_get_field("Interior", result);		HouseInfo[i][hInterior] = strval(result);
        mysql_get_field("Lockk", result);			HouseInfo[i][hLock] = strval(result);
        mysql_get_field("Owned", result);			HouseInfo[i][hOwned] = strval(result);
        mysql_get_field("Rent", result);			HouseInfo[i][hRent] = strval(result);
        mysql_get_field("Rentabil", result);		HouseInfo[i][hRentabil] = strval(result);
        mysql_get_field("Takings", result);			HouseInfo[i][hTakings] = strval(result);
        mysql_get_field("Level", result);			HouseInfo[i][hLevel] = strval(result);
        mysql_get_field("Virtual", result);			HouseInfo[i][hVirtual] = strval(result);
        mysql_get_field("Radio", result);			HouseInfo[i][hRadio] = strval(result);		
			
		UpdateLabel(1,HouseInfo[i][hID]);	
	}
	mysql_free_result();
	printf("Houses: %d", index);
	return 1;
}


Si aici aveti si definitiile:

 

enum hInfo {
    hID,
    Float:hEntrancex,    Float:hEntrancey,
    Float:hEntrancez,     Float:hExitx,
    Float:hExity,         Float:hExitz,
    hOwner[25],         hDiscription[64],
    hValue,             hHel,
    hArm,                 hInterior,
    hLock,                 hOwned,
    hRent,                 hRentabil,
    hTakings,             hLevel,
    hVirtual,             hPickupID,
    hRadio
};
new HouseInfo[100][hInfo], Text3D:HouseLabel[sizeof(HouseInfo)];

Ceva idei?

Edited by CTMBeast
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
HouseInfo[100][hInfo],

modifici din 100 in 300 sau depinde cate case ai tu in baza de date

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
31 minutes ago, Mister said:
HouseInfo[100][hInfo],

modifici din 100 in 300 sau depinde cate case ai tu in baza de date

Aceasta a fost rezolvarea, am incercat sa mai schimb inainte in mai mult dar tot nu mergea cred ca din cauza ca nu erau suficiente sloturi sa corespunda cu baza de date. Mersi mult ca mi-ai dat idea cu 300 :))

 

Puteti da T/C

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.