30.12.2010, 14:13
Hello,
This works fine for house ID 0 (so file is called 0). But for the others, it just gives the message 'You are not near any unbought house pickup'. Why? Everything in the enum is just fine.
Regards, Jochem
Note: MAX_HOUSES = 200.
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);
}
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.");
}
else return SendClientMessage(playerid,COLOR_WHITE," You are not near any unbought house pickup.");
}
}
return 1;
}
Regards, Jochem
Note: MAX_HOUSES = 200.