04.07.2018, 16:17
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;
}