Код:
stock LoadHouse(houseid)
{
new string[128];
printf("[LoadHouse] Loading HouseID %d's data from database...", houseid);
format(string, sizeof(string), "SELECT OwnerName.Username, h.* FROM houses h LEFT JOIN accounts OwnerName ON h.OwnerID = OwnerName.id WHERE `id` = %d", houseid+1);
mysql_function_query(MainPipeline, string, true, "OnLoadHouse", "i", houseid);
}
stock LoadHouses()
{
printf("[LoadHouses] Loading data from database...");
mysql_function_query(MainPipeline, "SELECT OwnerName.Username, h.* FROM houses h LEFT JOIN accounts OwnerName ON h.OwnerID = OwnerName.id", true, "OnLoadHouses", "");
}
Код:
stock SaveHouse(houseid)
{
new string[2048];
printf("Saving House ID %d", houseid);
format(string, sizeof(string), "UPDATE `houses` SET \
`Owned`=%d, \
`Level`=%d, \
`Description`='%s', \
`OwnerID`=%d, \
`ExteriorX`=%f, \
`ExteriorY`=%f, \
`ExteriorZ`=%f, \
`ExteriorR`=%f, \
`InteriorX`=%f, \
`InteriorY`=%f, \
`InteriorZ`=%f, \
`InteriorR`=%f, \
`ExtIW`=%d, \
`ExtVW`=%d, \
`IntIW`=%d, \
`IntVW`=%d,",
HouseInfo[houseid][hOwned],
HouseInfo[houseid][hLevel],
g_mysql_ReturnEscaped(HouseInfo[houseid][hDescription], MainPipeline),
HouseInfo[houseid][hOwnerID],
HouseInfo[houseid][hExteriorX],
HouseInfo[houseid][hExteriorY],
HouseInfo[houseid][hExteriorZ],
HouseInfo[houseid][hExteriorR],
HouseInfo[houseid][hInteriorX],
HouseInfo[houseid][hInteriorY],
HouseInfo[houseid][hInteriorZ],
HouseInfo[houseid][hInteriorR],
HouseInfo[houseid][hExtIW],
HouseInfo[houseid][hExtVW],
HouseInfo[houseid][hIntIW],
HouseInfo[houseid][hIntVW]
);
format(string, sizeof(string), "%s \
`Lock`=%d, \
`Rentable`=%d, \
`RentFee`=%d, \
`Value`=%d, \
`SafeMoney`=%d, \
`Pot`=%d, \
`Crack`=%d, \
`Materials`=%d, \
`Heroin`=%d, \
`Weapons0`=%d, \
`Weapons1`=%d, \
`Weapons2`=%d, \
`Weapons3`=%d, \
`Weapons4`=%d, \
`GLUpgrade`=%d, \
`CustomInterior`=%d, \
`CustomExterior`=%d, \
`ExteriorA`=%f, \
`InteriorA`=%f, \
`MailX`=%f, \
`MailY`=%f, \
`MailZ`=%f, \
`MailA`=%f, \
`MailType`=%d, \
`ClosetX`=%f, \
`ClosetY`=%f, \
`ClosetZ`=%f WHERE `id`=%d",
string,
HouseInfo[houseid][hLock],
HouseInfo[houseid][hRentable],
HouseInfo[houseid][hRentFee],
HouseInfo[houseid][hValue],
HouseInfo[houseid][hSafeMoney],
HouseInfo[houseid][hPot],
HouseInfo[houseid][hCrack],
HouseInfo[houseid][hMaterials],
HouseInfo[houseid][hHeroin],
HouseInfo[houseid][hWeapons][0],
HouseInfo[houseid][hWeapons][1],
HouseInfo[houseid][hWeapons][2],
HouseInfo[houseid][hWeapons][3],
HouseInfo[houseid][hWeapons][4],
HouseInfo[houseid][hGLUpgrade],
HouseInfo[houseid][hCustomInterior],
HouseInfo[houseid][hCustomExterior],
HouseInfo[houseid][hExteriorA],
HouseInfo[houseid][hInteriorA],
HouseInfo[houseid][hMailX],
HouseInfo[houseid][hMailY],
HouseInfo[houseid][hMailZ],
HouseInfo[houseid][hMailA],
HouseInfo[houseid][hMailType],
HouseInfo[houseid][hClosetX],
HouseInfo[houseid][hClosetY],
HouseInfo[houseid][hClosetZ],
houseid+1
);
mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
}
The query on LoadHouses seems correct to me. Try running it in phpMyAdmin or whatever you're using to be sure that it's correct.