04.12.2014, 07:57
Please help me!
I give /buyhouse I do not buy the house buyhouse correct.
Example: I go to the house with ID: 30 and I give / buyhouse buy my house with ID: 1, normal should buy my house with ID: 30
I give /buyhouse I do not buy the house buyhouse correct.
Example: I go to the house with ID: 30 and I give / buyhouse buy my house with ID: 1, normal should buy my house with ID: 30
Код HTML:
CMD:buyhouse(playerid, params[])
{
new Float:oldposx, Float:oldposy, Float:oldposz, sendername[MAX_PLAYER_NAME], query[512];
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(IsPlayerInRangeOfPoint(3, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) || HouseInfo[h][hOwned] == 0)
{
if(PlayerInfo[playerid][pHouseKey] < 255) return SendClientMessage(playerid, COLOR_ERROR, "You already own a House.");
if(PlayerInfo[playerid][pCash] > HouseInfo[h][hValue])
{
PlayerInfo[playerid][pHouseKey] = h;
HouseInfo[h][hOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
GivePlayerCash(playerid, -HouseInfo[h][hValue]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Congratulations, on your new Purchase !");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /help to review the new property help section !");
mysql_format(handle, query, sizeof(query), "UPDATE `houses` SET `Owner` = '%s', `Owned` = '%i' WHERE ID = '%i'", HouseInfo[h][hOwner], HouseInfo[h][hOwned], h);
mysql_query(handle, query);
Update(playerid, pHouseKeyu);
OnPropTextdrawUpdate(1, h);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "You don't have enough cash to buy this House.");
}
}
}
return 1;
}