02.02.2014, 02:45
my createhouse script seems to bug, somewhere it returns 0, because im getting an unknown command error. If I add debug lines, it prints 1, but not 2, which makes me think that it is an issue in there, though all it does is set variables...
pawn Код:
CMD:createhouse(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >=4)
{
new Query[400], price, string[100], owner[MAX_PLAYER_NAME];
housescreated++;
new id = housescreated;
new Float:X, Float:Y, Float:Z;
if(sscanf(params, "d", price)) return UsageMessage(pid, "/createhouse [price]");
GetPlayerPos(playerid, X, Y, Z);
print("1");
format(owner, sizeof(owner), "None");
HouseInfo[id][hAddress] = id;
HouseInfo[id][hOwner] = owner;
HouseInfo[id][hintX] = 0;
HouseInfo[id][hintY] = 0;
HouseInfo[id][hintZ] = 0;
HouseInfo[id][hextX] = X;
HouseInfo[id][hextY] = Y;
HouseInfo[id][hextZ] = Z;
HouseInfo[id][hVW] = 0;
print("2");
HouseInfo[id][hint] = id+1000;
format(Query, sizeof(Query), "INSERT INTO `HOUSES` (`ADDRESS`, `OWNER`, `INTX`, `INTY`, `INTZ`, `EXTX`, `EXTY`, `EXTZ`, `VW`, `INT`, `PRICE`) VALUES(%d, '%s', %f, %f, %f, %f, %f, %f, %d, %d, %d)", id, HouseInfo[id][hOwner], HouseInfo[id][hintX], HouseInfo[id][hintY], HouseInfo[id][hintZ], HouseInfo[id][hextX], HouseInfo[id][hextY], HouseInfo[id][hextZ], HouseInfo[id][hVW], HouseInfo[id][hint], price);
format(string, sizeof(string), "%House For Sale\nAddress: %d\nPrice: %d", id, price);
print("3");
HouseInfo[id][hLabel] = Create3DTextLabel(string, COLGREEN, X, Y, Z, 20.0, 0, 1);
db_query(gamemode, Query);
//SaveHouse(id);
return 1;
}
return 1;
}