01.12.2011, 18:21
I know for a fact MySQL_SetString and MySQL_SetInteger work.
The problem is: It won't set the string OR the integer, yet I use them elsewhere and it works. I get the clientmessage but it wont actually set the string or integer.
GetPlayerHouseID
The problem is: It won't set the string OR the integer, yet I use them elsewhere and it works. I get the clientmessage but it wont actually set the string or integer.
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", NormalName[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;
}
pawn Код:
stock GetPlayerHouseID(playerid)
{
for(new x = 0; x < MAX_HOUSES; x++)
{
if(!(strcmp(HouseOwner[x],NormalName[playerid], true)))
{
return x;
}
}
return 0;
}