23.08.2012, 21:49
What's going on? I've made it the exact same way as my userdata, vehicledata and businessdata but my houses aren't saving!
They do get created, but whenever I buy them the variable doesnt save
And this is part of /buyhouse
It all works ingame, and I can exit/enter/lock/store etc everything with the house, but the variable won't save in the SQL database!
Screenshot in the attachment
I have no idea what's going on to be honest, everything else saves perfectly fine.
They do get created, but whenever I buy them the variable doesnt save
pawn Код:
forward SaveHouses2(i);
public SaveHouses2(i)
{
new query[1500];
format(query, sizeof(query), "UPDATE housedata SET HouseOwner=%d,HouseX=%f,HouseY=%f,HouseZ=%f WHERE HouseID=%i",Housee[i][HouseOwner],Housee[i][HouseX],Housee[i][HouseY],Housee[i][HouseZ], i);
mysql_function_query(ServerInfo[MySQL], query, true, "Something", "i",i);
format(query, sizeof(query), "UPDATE housedata SET HouseX2=%f, HouseY2=%f, HouseZ2=%f,HousePrice=%i WHERE HouseID=%i",Housee[i][HouseOwner],Housee[i][HouseX2],Housee[i][HouseY2],Housee[i][HouseZ2],Housee[i][HousePrice], i);
mysql_function_query(ServerInfo[MySQL], query, true, "Something", "i",i);
format(query, sizeof(query), "UPDATE housedata SET HouseInt=%d, HouseWep=%d,HouseWepAmmo=%d,HouseMats=%d WHERE HouseID=%i",Housee[i][HouseInt],Housee[i][HouseWep],Housee[i][HouseWepAmmo],Housee[i][HouseMats], i);
mysql_function_query(ServerInfo[MySQL], query, true, "Something", "i",i);
format(query, sizeof(query), "UPDATE housedata SET HouseHeroin=%d,HouseLocked=%d,HouseOwnerName='%s' WHERE HouseID=%i",Housee[i][HouseHeroin], Housee[i][HouseLocked],Housee[i][HouseLocked],Housee[i][HouseOwnerName], i);
mysql_function_query(ServerInfo[MySQL], query, true, "Something", "i",i);
return 1;
}
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 1.5,Housee[i][HouseX],Housee[i][HouseY],Housee[i][HouseZ]))
{
if(PlayerInfo[playerid][Cash] < Housee[i][HousePrice]) return error(playerid, "You do not have enough money.");
if(PlayerInfo[playerid][House] != 0) return error(playerid, "You already own a property.");
if(Housee[i][HouseOwner] != 0) return error(playerid, "This house is not for sale.");
Housee[i][HouseOwner] = PlayerInfo[playerid][UserId];
new stringg[24];
format(stringg, sizeof(stringg), "%s",GetNameEx(playerid));
Housee[i][HouseOwnerName] = stringg;
PlayerInfo[playerid][House] = i;
GivePlayerCash(playerid, -Housee[i][HousePrice]);
new string[128];
format(string, sizeof(string), "{6B5BBD}[{5BBD8A}Owned House{6B5BBD}]\n{6B5BBD}[{5BBD8A} Owner: %s{6B5BBD}]",Housee[i][HouseOwnerName]);
Update3DTextLabelText(HouseText[i], red, string);
SaveHouses2(i);
return 1;
}
Screenshot in the attachment
I have no idea what's going on to be honest, everything else saves perfectly fine.