What's wrong with this?
#1

Tbh, I don't really see anything wrong with this.. please can someone help me?

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;
}
noob@samp
Reply
#2

What is the problem?
Reply
#3

It doesn't update the house. Just stays the same & when you use in a command - it returns the command as a unsuccessful... example:

pawn Код:
COMMAND:sellhouse(playerid, params[])
{
    new tmpid=IsPlayerOutHouse(playerid);
    if(tmpid == -1) return SendClientError(playerid, "You are not standing at any house!");
//==============================================================================
    new owner[100], Query[240], savingstring[1028];
    format(Query, sizeof(Query), "SELECT `rentable`, `rentprice`, `owner` FROM `HouseInfo` WHERE `Casa` = %d", tmpid);
    mysql_query(Query);
    mysql_store_result();
    while(mysql_fetch_row_format(Query, "|"))
    {
        mysql_fetch_field_row(savingstring, "rentable");
        House[tmpid][tmprentprice] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "rentprice");
        House[tmpid][tmprentable] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "owner");
        myStrcpy(owner, savingstring);
    }
    //sscanf(Query, "p<|>iis", House[tmpid][tmprentable], House[tmpid][tmprentprice], owner);
    mysql_free_result();
    if(strcmp(owner, PlayerName(playerid), false) && PlayerInfo[playerid][power] < 10) return SendClientError(playerid, "You don't own this house!");
    new iPrice;
    if( sscanf ( params, "d", iPrice))  return SCP(playerid, "[amount]");
    if(iPrice < 250000 || iPrice > 25000000) return SCP(playerid, "Min. $250,000 - Max $25,000,000");
    House[tmpid][tmpbuyable] = 1;
    format(Query, sizeof(Query), "UPDATE `HouseInfo` SET `buyable` = 1, `fullprice` = %d WHERE `Casa` = %d", iPrice, tmpid);
    mysql_query(Query);
    SendClientMSG(playerid, COLOR_GREEN, "[HOUSE] Your house ID %d is now on sale for $%s.", tmpid, number_format(iPrice));
    UpdateHouse(tmpid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)