Sellhouse doesnt check right for the right owner
#1

So i have a sellhouse command wich should check if the house was owned by the guy but it doesnt work i can just sell anyone's property. This is my code:
pawn Код:
CMD:sellhouse(playerid, params[])
{
    for(new i; i < MAX_HOUSES; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.50, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ]))
        {
            new pName[MAX_PLAYER_NAME], string[128], string2[128], string3[128], string4[128];
            GetPlayerName(playerid, pName, sizeof(pName));
            format(string, sizeof(string), "SELECT Houseowner FROM Houses WHERE HouseID = '%d'", i);
            mysql_query(string);
            mysql_store_result();
            new howner[MAX_PLAYER_NAME];
            mysql_fetch_field_row("Houseowner", howner);
            if(!strcmp(howner, pName, false))
            {
                format(string2, sizeof(string2), "UPDATE Houses SET Houseowner = '' WHERE HouseID = '%d'", i);
                mysql_query(string2);
                SendClientMessage(playerid, 0xFF0000, "Your house has been sold");
                format(string3, sizeof(string3), "UPDATE Users SET Houses = '%d' WHERE Name = '%s'", APlayerData[playerid][Houses]--, APlayerData[playerid][Name]);
                mysql_query(string3);
                DestroyDynamicPickup(AHouseData[i][PickupID]);
                AHouseData[i][PickupID] = CreatePickup(1273, 1, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ], -1);
                format(string4, sizeof(string4), "This house is for sale!\nPrice: %i\n Type /buyhouse to buy", AHouseData[i][price]);
                UpdateDynamic3DTextLabelText(AHouseData[i][HouseName], COLOR_GREY, string4);
                strdel(AHouseData[i][Owner], 0, 24); //Owner = "" Anyway why the pickup wont get deleted? :| old pickupwill stay
            }
            else
                SendClientMessage(playerid, COLOR_GREY, "This house is not owned by you!");
            mysql_free_result();
        }
    }
    return 1;
}
Thanks in advance
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)