23.02.2016, 17:28
The "LoadHouses" function is ran under "OnGameModeInit". I have looked at other threads and can't fix the issue.
The "OnHousesLoad" function is not called but "LoadHouses" is. Similar MySQL queries function correctly.
The "OnHousesLoad" function is not called but "LoadHouses" is. Similar MySQL queries function correctly.
Код:
public LoadHouses() {
mysql_tquery(databaseConnection, "SELECT * FROM `houses`", "OnHousesLoad");
print("test"); // Prints
return 1;
}
Код:
forward OnHousesLoad();
public OnHousesLoad() {
print("Callback test"); // Does not print
new name[128], string[64];
for(new i = 0, j = cache_get_row_count(); i <= j; i++) {
print("loop test"); // Does not print
Houses[i][SQLID] = cache_get_field_content_int(i, "SQLID", databaseConnection);
Houses[i][CharacterSQLID] = cache_get_field_content_int(i, "CharacterSQLID", databaseConnection);
Houses[i][Price] = cache_get_field_content_int(i, "Price", databaseConnection);
Houses[i][Interior] = cache_get_field_content_int(i, "Interior", databaseConnection);
Houses[i][VirtualWorld] = cache_get_field_content_int(i, "VirtualWorld", databaseConnection);
Houses[i][hEnteranceX] = cache_get_field_content_float(i, "EnteranceX", databaseConnection);
Houses[i][hEnteranceY] = cache_get_field_content_float(i, "EnteranceY", databaseConnection);
Houses[i][hEnteranceZ] = cache_get_field_content_float(i, "EnteranceZ", databaseConnection);
Houses[i][hExitX] = cache_get_field_content_float(i, "ExitX", databaseConnection);
Houses[i][hExitY] = cache_get_field_content_float(i, "ExitY", databaseConnection);
Houses[i][hExitZ] = cache_get_field_content_float(i, "ExitZ", databaseConnection);
cache_get_field_content(i, "Name", name, databaseConnection, sizeof(name));
CreatePickup(1272, 1, Houses[i][hEnteranceX], Houses[i][hEnteranceY], Houses[i][hEnteranceZ], i);
format(string, sizeof(string), "%s\nOwner:%s", name, GetCharacterName(Houses[i][CharacterSQLID]));
Create3DTextLabel(string, -1, Houses[i][hEnteranceX], Houses[i][hEnteranceY], Houses[i][hEnteranceZ], 25, 0, 0);
housesTotal++;
printf("Houses loaded: %d ID: %d X: %f Y: %f Z: %f", housesTotal, Houses[i][SQLID], Houses[i][hEnteranceX], Houses[i][hEnteranceY], Houses[i][hEnteranceZ]);
}
}

