01.12.2011, 19:34
This wont set the string(players name) or the set integer. I know they both work as they're used elsewhere.
pawn Код:
CMD:buyhouse(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
if(GetPlayerHouseID(playerid) >= 1) return SendClientMessage(playerid, COLOUR_GREY, "You already own a house");
for(new x = 0; x < MAX_HOUSES; x++)
{
if(IsPlayerInRangeOfPoint(playerid, 5, HouseEntX[x], HouseEntY[x], HouseEntZ[x]))
{
if(PlayerMoney[playerid] >= HousePrice[x])
{
PlayerMoney[playerid] -= HousePrice[x];
GivePlayerMoney(playerid, -HousePrice[x]);
}
if(!(strcmp(HouseOwner[x], "nobody", true)))
{
HouseSQLID[x] = MySQL_GetValue(HouseSQLID[x], "id", "houses");
MySQL_SetString(HouseSQLID[x], "HouseOwner", GetName(playerid), "houses");
MySQL_SetInteger(HouseSQLID[x], "HousePrice", 0, "houses");
new string[100];
format(string, sizeof(string), "Congratulations, you have purchased Address: %s, You are now the owner!", HouseName[x]);
SendClientMessage(playerid, COLOUR_ORANGE, string);
}
}
}
return 1;
}