12.05.2014, 11:22
It saves successfully without errors but it doesn't load weirdly enough..?
MYSQL LOG
SCRIPT USED FOR LOADING
MYSQL LOG
Quote:
[13:33:59] [DEBUG] cache_get_data - connection: 1 [13:33:59] [WARNING] cache_get_data - no active cache [13:33:59] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `houses` WHERE `ID` = '0'", callback: "OnLoadHouses", format: "(null)" [13:33:59] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [13:33:59] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [13:33:59] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [13:33:59] [DEBUG] CMySQLConnection::Connect - connection was successful [13:33:59] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [13:33:59] [DEBUG] CMySQLQuery::Execute[OnLoadHouses] - starting query execution [13:33:59] [DEBUG] CMySQLConnection::Connect - connection was successful [13:33:59] [DEBUG] CMySQLQuery::Execute[OnLoadHouses] - query was successfully executed within 0.413 milliseconds [13:33:59] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [13:33:59] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [13:33:59] [DEBUG] Calling callback "OnLoadHouses".. [13:33:59] [DEBUG] cache_get_data - connection: 1 [13:33:59] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called |
pawn Код:
stock LoadHouses()
{
new rows, fields, result[5], query[300];
cache_get_data(rows, fields);
if(rows)
{
cache_get_field_content(0, "ID", result);
g_HouseInfo[HouseID][hSQLid] = strval(result);
}
format(query, sizeof query, "SELECT * FROM `houses` WHERE `ID` = '%d'", HouseID);
mysql_function_query(g_Handle, query, true, "OnLoadHouses", "");
return 1;
}
pawn Код:
forward OnLoadHouses();
public OnLoadHouses()
{
new rows, fields, result[129], string[128];
cache_get_data(rows, fields);
if(rows != 0)
{
cache_get_field_content(0, "Owner", result), format(g_HouseInfo[HouseID][hOwner], 24, result);
cache_get_field_content(0, "OwnerID", result), g_HouseInfo[HouseID][hOwnerid] = strval(result);
cache_get_field_content(0, "EnPosX", result), g_HouseInfo[HouseID][hEnPosX] = floatstr(result);
cache_get_field_content(0, "EnPosY", result), g_HouseInfo[HouseID][hEnPosY] = floatstr(result);
cache_get_field_content(0, "EnPosZ", result), g_HouseInfo[HouseID][hEnPosZ] = floatstr(result);
cache_get_field_content(0, "ExPosX", result), g_HouseInfo[HouseID][hExPosX] = floatstr(result);
cache_get_field_content(0, "ExPosY", result), g_HouseInfo[HouseID][hExPosY] = floatstr(result);
cache_get_field_content(0, "ExPosZ", result), g_HouseInfo[HouseID][hExPosZ] = floatstr(result);
cache_get_field_content(0, "Interior", result), g_HouseInfo[HouseID][hInterior] = strval(result);
cache_get_field_content(0, "World", result), g_HouseInfo[HouseID][hWorld] = strval(result);
cache_get_field_content(0, "Pickup", result), g_HouseInfo[HouseID][hPickup] = strval(result);
cache_get_field_content(0, "Price", result), g_HouseInfo[HouseID][hPrice] = strval(result);
cache_get_field_content(0, "Locked", result), g_HouseInfo[HouseID][hLocked] = strval(result);
cache_get_field_content(0, "StreetName", result), format(g_HouseInfo[HouseID][hStreetName], 64, result);
cache_get_field_content(0, "LabelID", result), _:g_HouseInfo[HouseID][hLabel] = strval(result);
HouseID++;
}
if(g_HouseInfo[HouseID][hOwned] == 0)
{
format(string, sizeof(string), "STREET NOT SET\nResidence of The State\nPrice: $%d", g_HouseInfo[HouseID][hPrice]);
g_HouseInfo[HouseID][hPickup] = CreateDynamicPickup(1273, 23, g_HouseInfo[HouseID][hEnPosX], g_HouseInfo[HouseID][hEnPosY], g_HouseInfo[HouseID][hEnPosZ], 0, 0, -1, 250);
}
if(g_HouseInfo[HouseID][hOwned] == 1)
{
format(string, sizeof(string), "%s\nResidence of %s", g_HouseInfo[HouseID][hStreetName], g_HouseInfo[HouseID][hOwner]);
g_HouseInfo[HouseID][hPickup] = CreateDynamicPickup(1318, 23, g_HouseInfo[HouseID][hEnPosX], g_HouseInfo[HouseID][hEnPosY], g_HouseInfo[HouseID][hEnPosZ], 0, 0, -1, 250);
}
g_HouseInfo[HouseID][hLabel] = CreateDynamic3DTextLabel(string, -1, g_HouseInfo[HouseID][hEnPosX], g_HouseInfo[HouseID][hEnPosY], g_HouseInfo[HouseID][hEnPosZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 10.0);
printf("> %d houses have been loaded from the database.", HouseID);
return 1;
}