08.02.2012, 11:29
Replace the buy command with this:
pawn Код:
dcmd_buyhouse(playerid,params[]) {
#pragma unused params
if(IsPlayerConnected(playerid)){
for(new h = 0; h <= MAX_HOUSES; h++){
if(PlayerToPoint(PTP_RADIUS, playerid, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ])){
if(strcmp(HouseInfo[h][hName],GetName(playerid), false ) != 0){
if(HouseInfo[h][hSellable] == 1){
if(GetPlayerMoney(playerid) < HouseInfo[h][hSell]) return SendClientMessage(playerid, COLOR_WHITE, ".:: [HOUSE]: You do not have anough money to buy this house.");
if(GetPlayerScore(playerid) >=50)
{
DestroyPickup(HouseInfo[h][hPickup]);
HouseInfo[h][hPickup] = CreatePickup(1272,23, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ]); // bought
HouseInfo[h][hSellable] = 0; GivePlayerMoney(playerid, -HouseInfo[h][hSell]);
format(HouseInfo[h][hName], 24, "%s", GetName(playerid)); SavePlayerHouse(h);
}
else return SendclientMessage(playerid, 0xFFFFFFFF, "You need at least level 50.");
} else return SendClientMessage(playerid, COLOR_WHITE, ".:: [HOUSE]: This house is not for sale.");
} else return SendClientMessage(playerid, COLOR_WHITE, ".:: [HOUSE]: You are cannot buy the house you are selling.");
} } }
return true;
}