20.10.2012, 16:12
Hey I have been having some problems with my house system lately but now I am not sure whether or not my house's will each have a individual and unique id. Also whenever I create a house it is supposed to create a dynamic 3d text label however all it does is crash the server.
Here is my /createhouse command:
There is also no errors in the log, all it says is that I have joined but it does not say that I have left?
Here is my /createhouse command:
pawn Код:
CMD:createhouse(playerid, params[])
{
new housecost, houseint, houselevel;
if (sscanf(params, "iii", housecost, houseint, houselevel)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Usage: /createhouse <Price> <Interior> <Level>");
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have permission to use that command!");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
samp_mysql_query("CREATE TABLE IF NOT EXISTS houseinfo(id INT AUTO_INCREMENT PRIMARY KEY, owner VARCHAR(32), owned INT, interior INT, EnterX FLOAT, EnterY FLOAT, EnterZ FLOAT, price INT, level INT)");
new owned;
new sql[200];
owned = 0;
format(sql, sizeof(sql), "INSERT INTO `houseinfo` (owner, owned, interior, EnterX, EnterY, EnterZ, price, level) VALUES ('', %i, %i, '%f', '%f', '%f', %i, %i)", owned, houseint, x, y, z, housecost, houselevel);
samp_mysql_query(sql);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have created a house in this position!");
new housequery[200], houseresult[200];
housecount ++;
new id = housecount;
format(housequery, sizeof(housequery), "SELECT * FROM `houseinfo` WHERE id = %i", id);
samp_mysql_query(housequery);
samp_mysql_fetch_row(houseresult);
samp_mysql_get_field("id", HouseInfo[id][houseid]);
samp_mysql_get_field("owner", HouseInfo[id][howner]);
samp_mysql_get_field("owned", HouseInfo[id][houseowned]);
samp_mysql_get_field("price", HouseInfo[id][hprice]);
samp_mysql_get_field("level", HouseInfo[id][hlevel]);
new houselabel[200];
format(houselabel, sizeof(houselabel), "House ID: %i\nHouse Owner: %s\nHouse Price: $%i\nHouseLevel: %i\nUse /buy to buy this house!", HouseInfo[id][houseid], HouseInfo[id][howner], HouseInfo[id][hprice], HouseInfo[id][hlevel]);
CreateDynamic3DTextLabel(houselabel, COLOR_LIGHTGREEN, x, y, z, 40.0, 0, 0);
return 1;
}