29.04.2012, 14:47
(
Последний раз редактировалось Padarom; 29.04.2012 в 15:46.
)
Hello.
I have a few errors which I'm unable to fix by no stretch of the imagination.
Here the appreciable part of the code. The errors are mainly in the callback LoadHaus
Hier der relevante Teil des Codes. Hauptsдchlich sind die Fehler im Callback LoadHaus.
Hope you can help me.
Thanks in advance.
Padarom
I have a few errors which I'm unable to fix by no stretch of the imagination.
Код:
error 032: array index out of bounds (variable "haus") // 13x - Everywhere I use haus[i][...]
Hier der relevante Teil des Codes. Hauptsдchlich sind die Fehler im Callback LoadHaus.
pawn Код:
#define MAX_HAUS 350
enum hInfo {
Float:X,
Float:Y,
Float:Z,
Preis,
Gebiet[5],
Besitzer[24],
KeyID,
pickup,
bool:loaded = false
};
new haus[MAX_HAUS][hInfo];
public LoadHaus()
{
new text[128];
for(new i=0; i<MAX_HAUS; i++)
{
if(haus[i][loaded] == false)
{
format(mQuery, 128, "SELECT * FROM haus WHERE ID = %i", i);
mysql_query(mQuery);
mysql_store_result();
if(mysql_num_rows())
{
mysql_free_result();
haus[i][X] = mysql_GetFloat("haus", "X", "ID", i);
haus[i][Y] = mysql_GetFloat("haus", "Y", "ID", i); // error 032
haus[i][Z] = mysql_GetFloat("haus", "Z", "ID", i); // error 032
haus[i][Besitzer] = mysql_GetString("haus", "Besitzer", "ID", i); // error 032
haus[i][Gebiet] = mysql_GetString("haus", "Gebiet", "ID", i); // error 032
haus[i][KeyID] = mysql_GetInt("haus", "KeyID", "ID", i); // error 032
haus[i][Preis] = mysql_GetInt("haus", "Preis", "ID", i); // error 032
haus[i][loaded] = true;
if(strlen(haus[i][Besitzer]) > 2) // error 032
{ // Bewohnt
format(text, 128, "- Besitzer: %s -\n- Gebiet: %s -", haus[i][Besitzer], haus[i][Gebiet]); // error 032
haus[i][pickup] = CreatePickup(1272, 1, haus[i][X], haus[i][Y], haus[i][Z], -1); // error 032
Create3DTextLabel(text, cAQUA, haus[i][X], haus[i][Y], haus[i][Z]+1, 5, 0, 0); // error 032
}
else
{ // Verkдuflich
format(text, 128, "- Verkдuflich -\n- Preis: $%i -\n- Gebiet: %s -", haus[i][Preis], haus[i][Gebiet]); // error 032
haus[i][pickup] = CreatePickup(1273, 1, haus[i][X], haus[i][Y], haus[i][Z], -1); // error 032
Create3DTextLabel(text, cDONE, haus[i][X], haus[i][Y], haus[i][Z]+1, 5, 0, 0); // error 032
}
}
}
mysql_free_result();
}
return 1;
}
Thanks in advance.
Padarom