[FIXED] Buy house problem :'(
#1

hi i got once more error....

when the player is got a house, he still can buy another house....
what dan i do to make the player can only buy 1 house?

here's my /buyhouse command
pawn Код:
CMD:buyhouse(playerid,params[])
{
    #pragma unused params
    new str1[128], housenumber, rows;
    housenumber = GetHouseID(playerid);
    if(housenumber == -1) return SendClientMessageLang(playerid, COLOR_RED, ""Err" You're not near from a house icon", ""Err" Anda sedang tidak berada didekat icon rumah!");

    format(str1, sizeof(str1), "SELECT * FROM `House` WHERE `Name` = '%s'", params);
    mysql_query(str1);
    mysql_store_result();
    /*if(mysql_num_rows() != 0)
    {
        SendClientMessageLang(playerid, COLOR_RED, ""Err" You can only own 1 house!!", ""Err" Anda hanya boleh memiliki 1 rumah!");
    }*/

    rows = mysql_num_rows();
    if(rows == 0)
    {
        if (strcmp(hInfo[housenumber][Name],"For Sale",true)) return SendClientMessageLang(playerid, COLOR_RED, ""Err" This house is not for sale!", ""Err" Rumah ini tidak dijual!");
        if(GetPlayerMoney(playerid)<hInfo[housenumber][Cost]) return SendClientMessageLang(playerid, COLOR_RED, ""Err" Not enough money!", ""Err" Uang anda tidak cukup untuk membeli rumah!");
        if(pInfo[playerid][pDay]<TimeMin) return SendClientMessageLang(playerid, COLOR_RED, ""Err" You need to play for 3 days in-game to buy a house!", ""Err" Anda harus bermain 3 hari in-game untuk membeli rumah!");
        SendClientMessageLang(playerid, COLOR_YELLOW, ""Inf" House succefully bought!", ""Inf" Rumah berhasil dibeli!");

        SetPlayerMoney(playerid,GetPlayerMoney(playerid)-hInfo[housenumber][Cost]);
        format(str1, sizeof(str1), "UPDATE `House` SET `Name` = '%s', `Locked` = '0' WHERE `Houseid` = '%d'", pName(playerid), housenumber);
        mysql_query(str1);
        format(hInfo[housenumber][Name] , 24, pName(playerid));
        hInfo[housenumber][Locked] = 0;

        DestroyPickup(HousePickup[housenumber]);
        HousePickup[housenumber] = CreatePickup(1272, 23, hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
    }
    else
    {
        SendClientMessageLang(playerid, COLOR_RED, ""Err" You can only own 1 house!!", ""Err" Anda hanya boleh memiliki 1 rumah!");
    }
    mysql_free_result();
    return 1;
}
Reply


Messages In This Thread
[FIXED] Buy house problem :'( - by AiRaLoKa - 12.05.2014, 08:23
Re: Buy house problem :'( - by AiRaLoKa - 12.05.2014, 08:28
Re: [FIXED] Buy house problem :'( - by Ciandlah - 12.05.2014, 08:35
Re: [FIXED] Buy house problem :'( - by AiRaLoKa - 12.05.2014, 08:36

Forum Jump:


Users browsing this thread: 1 Guest(s)