pawn Код:
stock UpdateHouse(hid, moved = 0)
{
new tmps[1082], owner[100];
new buyable, fullprice, Query[240], savingstring[1028];
format(Query, sizeof(Query), "SELECT `owner`, `buyable`, `fullprice` FROM `HouseInfo` WHERE `Casa` = %d", hid);
mysql_query(Query);
mysql_store_result();
while(mysql_fetch_row_format(Query, "|"))
{
mysql_fetch_field_row(savingstring, "owner");
myStrcpy(owner, savingstring);
mysql_fetch_field_row(savingstring, "buyable");
buyable = strval(savingstring);
mysql_fetch_field_row(savingstring, "fullprice");
fullprice = strval(savingstring);
}
mysql_free_result();
new zone[60];
GetZone(House[hid][House_x],House[hid][House_y],House[hid][House_z], zone);
if(House[hid][tmprentable] == 1)
{
format(tmps, 256, "{07aa0b}[ {ffffff}%d, %s {07aa0b}]\n{07aa0b}Owner: {ffffff}%s\n{07aa0b}Rent: {ffffff}$%s\n{07aa0b}Commands: {ffffff}/rentroom /unrent", hid, zone, NoUnderscore(House[hid][tmpowner]), number_format(House[hid][tmprentprice]));
}
else
{
format(tmps, 256, "{07aa0b}[ {ffffff}%d, %s {07aa0b}]\n{07aa0b}Owner: {ffffff}%s", hid, zone, NoUnderscore(owner));
}
DestroyDynamicPickup(House[hid][hPickup]);
if(buyable > 0)
{
format(iStr, sizeof(iStr), "\n{07aa0b}For Sale: {ffffff}$%s", number_format(fullprice));
House[hid][hPickup] = CreateDynamicPickup(1273, 1, House[hid][House_x],House[hid][House_y],House[hid][House_z]);
strcat(tmps, iStr);
}
else
{
House[hid][hPickup] = CreateDynamicPickup(1272, 1, House[hid][House_x],House[hid][House_y],House[hid][House_z]);
}
if(moved == 1)
{
DestroyDynamic3DTextLabel(House[hid][hLabel]);
UpdateDynamic3DTextLabelText(House[hid][hLabel], COLOR_GREEN, tmps);
House[hid][hLabel] = CreateDynamic3DTextLabel(tmps, COLOR_GREEN, House[hid][House_x],House[hid][House_y],House[hid][House_z]+0.3, 25.0);
}
else
{
DestroyDynamic3DTextLabel(House[hid][hLabel]);
UpdateDynamic3DTextLabelText(House[hid][hLabel], COLOR_GREEN, tmps);
House[hid][hLabel] = CreateDynamic3DTextLabel(tmps, COLOR_GREEN, House[hid][House_x],House[hid][House_y],House[hid][House_z]+0.3, 25.0);
}
DestroyDynamic3DTextLabel(House[hid][Roof_Label]);
format(tmps, 256, "{07aa0b}[ {ffffff}%d House roof {07aa0b}]", hid);
House[hid][Roof_Label] = CreateDynamic3DTextLabel(tmps, COLOR_GREEN, House[hid][Roof_X],House[hid][Roof_Y],House[hid][Roof_Z]+0.3, 25.0);
return 1;
}