houses
#1

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;
}
Reply
#2

the ID (housescreated) may exceed the array's size?
Reply
#3

no, that's not it, i tried to define it as 0, still bugged...It did work until I added SaveHouse, but thats why its commented out
Reply
#4

I had an issue with mysql, so I had converted some things into sqlite, i found the cmd works if I dont load the houses, I reckon this is why.

pawn Код:
mysql_fetch_field_row(string, "ADDRESS");
        HouseInfo[ID][hAddress] = strval(Field);
It saves in sqlite, but loads in mysql LOL

Reply
#5

....
Reply
#6

Well i have no knowelge about SQLite, I find the actual SQL easier to manage;

Little thing:

pawn Код:
format(owner, sizeof(owner), "None");
HouseInfo[id][hOwner] = owner;
You can do this:

pawn Код:
format(HouseInfo[id][hOwner], 24, "None");

About your error, there's no reason on why it shouldn't print the "2"; It should fail after the second and before the third check if you're using two different methods of saving.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)