Mysql Float problem
#1

So i have a housing script but the floats for it are actually too big for it.... So it misses some numbers wich make them pretty badly misplaced.... Anyone an idea?
Reply
#2

Make the float field sizes bigger?
Reply
#3

Its impossible when i set the field bigger it doesnt show it is bigger...
Reply
#4

Ok so now i used Double for it... But now the loading is still failing O_O
pawn Код:
LoadHouses()
{
    print("Houses are being loaded");
    mysql_query("SELECT NULL FROM Houses");
    mysql_store_result();
    new rows = mysql_num_rows();
    mysql_free_result();
   
    CheckMySQL();
   
    for(new i; i < rows; i++)
    {
        new string[128], string2[128];
        format(string, sizeof(string), "SELECT * FROM Houses WHERE HouseID = '%d'", i);
        mysql_query(string);
        mysql_store_result();
       
        new row[128];
        new field[11][24];
        mysql_fetch_row_format(row, "|");
        explode(row, field, "|");
        mysql_free_result();
        AHouseData[i][ID] = strval(field[0]);
        AHouseData[i][price] = strval(field[1]);
        format(AHouseData[i][Owner], 24, "%s", field[2]);
        AHouseData[i][HouseX] = strval(field[3]);
        AHouseData[i][HouseY] = strval(field[4]);
        AHouseData[i][HouseZ] = strval(field[5]);
        if(strlen(AHouseData[i][Owner]) > 0)
        {
            CreatePickup(1272, 1, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ] + 0.5, -1);
            format(string2, sizeof(string2), "This house is owned by:\n%s", AHouseData[i][Owner]);
        }
        else
        {
            CreatePickup(1273, 1, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ] + 0.5, -1);
            format(string2, sizeof(string2), "This house is for sale!\nPrice: %i\n Type /buyhouse to buy", AHouseData[i][price]);
        }
        CreateDynamic3DTextLabel(string2, 0x008080FF, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ] + 1.5, 40.0);
        printf("House %d created", i);
    }
    print("Loading finished");
}
Anyone an idea?
Reply
#5

put the Pos row to string type and do :

PHP код:
AHouseData[i][HouseY] = floatstr(result
Reply
#6

Sorry if I wrong, but U are doing a free result here:

pawn Код:
new row[128];
        new field[11][24];
        mysql_fetch_row_format(row, "|");
        explode(row, field, "|");
->        mysql_free_result();
        AHouseData[i][ID] = strval(field[0]);
        AHouseData[i][price] = strval(field[1]);
        format(AHouseData[i][Owner], 24, "%s", field[2]);
        AHouseData[i][HouseX] = strval(field[3]);
        AHouseData[i][HouseY] = strval(field[4]);
        AHouseData[i][HouseZ] = strval(field[5]);
I think you have to put there:

pawn Код:
new row[128];
        new field[11][24];
        mysql_fetch_row_format(row, "|");
        explode(row, field, "|");
        AHouseData[i][ID] = strval(field[0]);
        AHouseData[i][price] = strval(field[1]);
        format(AHouseData[i][Owner], 24, "%s", field[2]);
        AHouseData[i][HouseX] = strval(field[3]);
        AHouseData[i][HouseY] = strval(field[4]);
        AHouseData[i][HouseZ] = strval(field[5]);
        mysql_free_result();
Reply
#7

Dude if that didnt work i would ask it -.- Anyway anyone can show me how to use the AHouseData[i][HouseY] = floatstr(result)? Can u show me the code how to put in cause i dont understand if i still have to use field[3] and stuff
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)