/createhouse crashing server and not sure if it will work :S -
NewerthRoleplay - 20.10.2012
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:
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;
}
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?
Re: /createhouse crashing server and not sure if it will work :S -
NewerthRoleplay - 20.10.2012
Just to add it is 2 problems, one is the server will crash and the other is that I am not sure if they will each have a unique ID or not. As a extra note I have got the correct includes, and plugins :P There is nothing in the log.
Re: /createhouse crashing server and not sure if it will work :S -
ReneG - 20.10.2012
Have you tried using BlueG's plugin? I haven't used the others, but I've never had a problem with BlueG's.
Re: /createhouse crashing server and not sure if it will work :S -
NewerthRoleplay - 20.10.2012
Well I haven't had too much luck with BlueG's plugin as I have not found a good tutorial which explains it all throughly and one that explains how to store table data into a array :S
Re: /createhouse crashing server and not sure if it will work :S -
ReneG - 20.10.2012
Kinda hard to understand without the pawn tags, but this one explains it well.
https://sampforum.blast.hk/showthread.php?tid=366019