Houses aren't loading again.. -
div - 04.07.2018
Hello, I managed to fix that houses weren't loading, but I had a problem with my PC and lost that..
here's another i made.. pls help
Код:
LoadHouses()
{
new rows = cache_get_row_count();
new Houselabel[145], Cache:housecache, query[45];
mysql_format(dbHandle, query, sizeof(query), "SELECT * FROM `houses`");
housecache = mysql_query(dbHandle, query, true);
for(new i = 0; i < rows; i++)
{
cache_set_active(housecache);
for(new z = 0; z < MAX_HOUSES; z++)
{
hInfo[z][HouseEX] = cache_get_field_content_float(i, "HouseEX");
hInfo[z][HouseEY] = cache_get_field_content_float(i, "HouseEY");
hInfo[z][HouseEZ] = cache_get_field_content_float(i, "HouseEZ");
cache_get_field_content(i, "HouseTitle", hInfo[z][HouseTitle]);
hInfo[z][HouseOwned] = cache_get_field_content_int(i, "HouseOwned");
cache_get_field_content(i, "HouseOwner", hInfo[z][HouseOwner]);
hInfo[z][HousePassworded] = cache_get_field_content_int(i, "HousePassworded");
cache_get_field_content(i, "HousePassword", hInfo[z][HousePassword]);
hInfo[z][HousePrice] = cache_get_field_content_int(i, "HousePrice");
if(hInfo[i][HouseOwned] == 0)
{
format(Houselabel, 145, "{FFD700}House Title(%i): {FFFFFF}%s\n{FFD700}House Owner: {FFFFFF}No-one\n {FFD700}House Price: {FFFFFF}$%d", hInfo[z][HouseID], hInfo[z][HouseTitle], hInfo[z][HousePrice]);
hInfo[z][HouseDetails] = CreateDynamic3DTextLabel(Houselabel, 0xFFFFFF, hInfo[z][HouseEX], hInfo[z][HouseEY], hInfo[z][HouseEZ], 15.0, .worldid = 0, .interiorid = 0, .streamdistance = 15.0);
hInfo[z][HouseCP] = CreateDynamicCP(hInfo[z][HouseEX], hInfo[z][HouseEY], hInfo[z][HouseEZ], 1, .worldid = 0, .interiorid = 0, .streamdistance = 15);
}
else if(hInfo[i][HouseOwned] == 1)
{
format(Houselabel, 145, "{FFD700}House Title(%i): {FFFFFF}%s\n{FFD700}House Owner: {FFFFFF}%s\n {FFD700}House Price: {FFFFFF}$%d", hInfo[z][HouseID], hInfo[z][HouseTitle], hInfo[z][HousePrice]);
hInfo[z][HouseDetails] = CreateDynamic3DTextLabel(Houselabel, 0xFFFFFF, hInfo[z][HouseEX], hInfo[z][HouseEY], hInfo[z][HouseEZ], 15.0, .worldid = 0, .interiorid = 0, .streamdistance = 15.0);
hInfo[z][HouseCP] = CreateDynamicCP(hInfo[z][HouseEX], hInfo[z][HouseEY], hInfo[z][HouseEZ], 1, .worldid = 0, .interiorid = 0, .streamdistance = 15);
break;
}
housecache = cache_save();
}
}
}
and MySQL Logs..
Код:
[14:34:00] [ERROR] "mysql_tquery" - invalid connection handle (id: 1)
[14:34:00] [WARNING] cache_get_field_content_float - no active cache
[14:34:00] [WARNING] cache_get_field_content_float - no active cache
[14:34:00] [WARNING] cache_get_field_content_float - no active cache
[14:34:00] [WARNING] cache_get_field_content_int - no active cache
[14:34:00] [WARNING] cache_get_field_content_int - no active cache
[14:34:00] [WARNING] cache_get_row_count - no active cache
[14:34:02] [ERROR] cache_get_field_content_int - invalid datatype
[14:34:03] [WARNING] cache_get_field_content_int - no active cache
MySQL R39
Re: Houses aren't loading again.. -
div - 04.07.2018
Noone to help me? :/
Re: Houses aren't loading again.. -
kovac - 04.07.2018
PHP код:
// OnGameModeInit
mysql_tquery(dbHandle, "SELECT * FROM `houses`;", "OnhousesLoad", "");
forward OnhousesLoad();
public OnhousesLoad()
{
new rows = cache_num_rows(), Houselabel[128];
if(rows)
{
for(new i = 0; i < rows; i++)
{
cache_get_value_name_float(i, "HouseEX", hInfo[i][HouseEX]);
cache_get_value_name_float(i, "HouseEY", hInfo[i][HouseEX]);
cache_get_value_name_float(i, "HouseEZ", hInfo[i][HouseEX]);
cache_get_value_name(i, "HouseTitle", hInfo[i][HouseTitle], 50);
cache_get_value_name_int(i, "HouseOwned", hInfo[i][HouseOwned]);
cache_get_value_name(i, "HouseOwner", hInfo[i][HouseOwner], MAX_PLAYER_NAME);
cache_get_value_name_int(i, "HousePassworded", hInfo[i][HousePassworded]);
cache_get_value_name(i, "HousePassword", hInfo[i][HousePassword], 128);
cache_get_value_name_int(i, "HousePrice", hInfo[i][HousePrice]);
if(hInfo[i][HouseOwned] == 0)
{
format(Houselabel, sizeof(Houselabel), "{FFD700}House Title(%i): {FFFFFF}%s\n{FFD700}House Owner: {FFFFFF}No-one\n {FFD700}House Price: {FFFFFF}$%d", hInfo[i][HouseID], hInfo[i][HouseTitle], hInfo[i][HousePrice]);
hInfo[i][HouseDetails] = CreateDynamic3DTextLabel(Houselabel, 0xFFFFFF, hInfo[i][HouseEX], hInfo[i][HouseEY], hInfo[i][HouseEZ], 15.0, 0, 0,15.0);
hInfo[i][HouseCP] = CreateDynamicCP(hInfo[i][HouseEX], hInfo[i][HouseEY], hInfo[i][HouseEZ], 1, 0, 0, 15);
}
else if(hInfo[i][HouseOwned] == 1)
{
format(Houselabel, sizeof(Houselabel), "{FFD700}House Title(%i): {FFFFFF}%s\n{FFD700}House Owner: {FFFFFF}%s\n {FFD700}House Price: {FFFFFF}$%d", hInfo[i][HouseID], hInfo[i][HouseTitle], hInfo[i][HousePrice]);
hInfo[i][HouseDetails] = CreateDynamic3DTextLabel(Houselabel, 0xFFFFFF, hInfo[i][HouseEX], hInfo[i][HouseEY], hInfo[i][HouseEZ], 15.0, 0, 0, 15.0);
hInfo[i][HouseCP] = CreateDynamicCP(hInfo[i][HouseEX], hInfo[i][HouseEY], hInfo[i][HouseEZ], 1, 0, 0, 15);
}
}
printf("Total houses loaded: %d", rows);
}
return 1;
}