22.02.2012, 05:28
PHP код:
stock BuyHouse(playerid, houseid)
{
new string2[256];
new name[24];
GetPlayerName(playerid, name, sizeof(name));
#if defined PRINT_HOUSES
printf("%s Bought House ID %d", name, houseid);
#endif
GivePlayerMoney(playerid, -hInfo[houseid][Cost]);
format(string2,sizeof(string2), HOUSE_FILE, houseid);
INI_Open(string2);
INI_WriteString("Name", name);
INI_WriteInt("Locked", 0);
INI_Save();
INI_Close();
hInfo[houseid][Name] = name;
hInfo[houseid][Locked] = 0;
DestroyPickup(HousePickup[houseid]);
HousePickup[houseid] = CreatePickup(1272, 23, hInfo[houseid][ExteriorX], hInfo[houseid][ExteriorY], hInfo[houseid][ExteriorZ]);
ShowBoughtHouseMessage(playerid);
return 1;
}