Build query [MYSQL]
#1

Ok so i try to make a house with mysql and i got this:
pawn Код:
BuildHouse(HPrice, Float:X, Float:Y, Float:Z)
{
    new Message[128];
    mysql_query("SELECT NULL FROM Houses");
    mysql_store_result();
    new rows = mysql_num_rows();
    mysql_free_result();
    new HouseID = rows++;
    if(HouseID < MAX_HOUSES)
    {
        CheckMySQL();
        new string[128];
        format(string, sizeof(string), "INSERT INTO Houses (HouseID, Houseprice, Houseowner, Owned, X, Y, Z) VALUES ('%d', '%d', 'None', 'false', '%f', '%f', '%f')", HouseID, HPrice, X, Y, Z);
        mysql_query(string);
        CreatePickup(1273, 1, X, Y, Z, 1);
        printf("House %d created", HouseID);
        AHouseData[HouseID][ID] = HouseID;
        AHouseData[HouseID][Houseprice] = HPrice;
        AHouseData[HouseID][HouseX] = X;
        AHouseData[HouseID][HouseY] = Y;
        AHouseData[HouseID][HouseZ] = Z;
        format(Message, sizeof(Message), "This house is for sale!\nHouseprice: %i\n Type /buyhouse to buy this house", AHouseData[HouseID][Houseprice]);
        CreateDynamic3DTextLabel(Message, 0xFFFFFFF, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ], 100.0);
    }
   
    return 1;
}
And it was working before i thought but not it wont work can anyone see a mistake here? if you need the CMD:
pawn Код:
COMMAND:createhouse(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new HPrice;
        if (sscanf(params, "i", HPrice)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/createhouse <price>\"");
        else
        {
            GetPlayerPos(playerid, AHouseData[playerid][HouseX], AHouseData[playerid][HouseY], AHouseData[playerid][HouseZ]);
            BuildHouse(HPrice, AHouseData[playerid][HouseX], AHouseData[playerid][HouseY], AHouseData[playerid][HouseZ]);
        }
    }
    else SendClientMessage(playerid, 0xFFFFFF, "{FF0000}You are not authorized to use this command!");
    return 1;
}
Weird thing is when i try to query it on mysql server itself it does put in a new row :S
Help please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)