14.12.2015, 10:54
Just add in your PlayerInfo a variable which marks if the player owns a house or not
I think that's enough help, the rest is up to you
PHP код:
// pInfo
House,
//BuyHouse
if(GetPlayerMoney(playerid) > HouseInfo[houseid][Price]) { // guess you forgot that
return SendClientMessage(playerid, -1, "You don't have enough money!");
}
if(PlayerInfo[playerid][House] != -1) {
return SendClientMessage(playerid, -1, "You already own a house!");
}
PlayerInfo[playerid][House] = houseid;
//SellHouse
if(PlayerInfo[playerid][House] == -1) {
return SendClientMessage(playerid, -1, "You don't own a house!");
}
PlayerInfo[playerid][House] = -1;
//At register
PlayerInfo[playerid][House] = -1; // or any other invalid id
// at login, load variable from file
// at disconnect, save variable to file