14.06.2015, 15:55
Idk why ?!
PHP код:
CMD:buyhouse(playerid, params[])
{
for(new a, j = cache_get_row_count(); a != j; ++a)
{
if (a >= sizeof HouseInfo) break;
if(IsPlayerInRangeOfPoint(playerid, 7.0, HouseInfo[a][EntranceX], HouseInfo[a][EntranceY], HouseInfo[a][EntranceZ]))
{
if(HouseInfo[a][HousePrice] > GetPlayerMoney(playerid)) return SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
new draw[200];
format(draw,sizeof(draw),"ID: %i\nPrice %i\nOwned: Yes\nOwner: %s",PlayerName(playerid));
new query[200];
format(query, sizeof(query), "UPDATE houses SET owner='%s', owned='true', text='%s'", PlayerName(playerid), draw);
Update3DTextLabelText(HouseLabel, COLOR_GREEN, draw);
GivePlayerMoney(playerid, -HouseInfo[a][HousePrice]);
PlayerInfo[playerid][pHouseID] = HouseInfo[a][HouseID];
SendClientMessage(playerid, COLOR_GREEN, "You've bought this house successfully!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not near any house");
}
}
return 1;
}