30.12.2010, 14:36
pawn Код:
dcmd_buyhouse(playerid,params[])
{
#pragma unused params
for(new h = 0; h < MAX_HOUSES; h ++)
{
format(file,sizeof(file),"Stuff/Houses/%d.ini",h);
if(dini_Exists(file))
{
if(IsPlayerInRangeOfPoint(playerid,5,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ]))
{
if(!strlen(HouseInfo[h][Owner]))
{
if(GetPlayerMoney(playerid) >= HouseInfo[h][Price])
{
new string[70];
format(string,sizeof(string),"Do you want to buy this house for $%d?",HouseInfo[h][Price]);
ShowPlayerDialog(playerid,DIALOG_BUYHOUSE,DIALOG_STYLE_MSGBOX,"Buy a House",string,"Yes","No");
SetPVarInt(playerid,"BuyingHouse",h);
return 1;
}
else return SendClientMessage(playerid,COLOR_WHITE,"You do not have enough money to purchase this house.");
}
else return SendClientMessage(playerid,COLOR_WHITE," This house has already been bought.");
}
}
}
SendClientMessage(playerid,COLOR_WHITE," You are not near any unbought house pickup.");
return 1;
}