Problem to get data from sqlite
#1

hi $:

pawn Код:
forward FUNCTION_LoadHouses();
public FUNCTION_LoadHouses()
{
    new DBResult:HOUSE_RESULT;
    new ftd[75];
    HOUSE_RESULT = db_query(HouseData,  "SELECT * FROM `HOUSEINFO`");
    if(db_num_rows(HOUSE_RESULT) > 0) // Logged In
    {
        new id;
        for (new x=0; x<db_num_rows(HOUSE_RESULT); x++)
        {

            db_get_field_assoc(HOUSE_RESULT, "ID", ftd, 26);
            id = strval(ftd);

            db_get_field_assoc(HOUSE_RESULT, "Title", ftd, 30);
            hInfo[id][Hname] = strval(ftd);

            db_get_field_assoc(HOUSE_RESULT, "Owner", ftd, 30);
            hInfo[id][owner] = strval(ftd);
           
            db_get_field_assoc(HOUSE_RESULT, "Price", ftd, 30);
            hInfo[id][costprice] = strval(ftd);

            db_get_field_assoc(HOUSE_RESULT, "EnterX", ftd, 30);
            hInfo[id][hEnterPos][0] = floatstr(ftd);

            db_get_field_assoc(HOUSE_RESULT, "EnterY", ftd, 30);
            hInfo[id][hEnterPos][1] = floatstr(ftd);

            db_get_field_assoc(HOUSE_RESULT, "EnterZ", ftd, 30);
            hInfo[id][hEnterPos][2] = floatstr(ftd);

            db_get_field_assoc(HOUSE_RESULT, "Type", ftd, 30);
            hInfo[id][Type] = strval(ftd);

            //native CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
            hInfo[id][hcheckpointidx][0] =  CreateDynamicCP(hInfo[id][hEnterPos][0], hInfo[id][hEnterPos][1], hInfo[id][hEnterPos][2], 1.0, 0, -1, -1, 50.0);
            format(fquery, sizeof(fquery), HOUSE_LABEL, hInfo[id][Hname], id, hInfo[id][owner],  Comma(hInfo[id][costprice]));
            hInfo[id][htextid][0] = Create3DTextLabel(fquery, 0x00bbffFF, hInfo[id][hEnterPos][0], hInfo[id][hEnterPos][1], hInfo[id][hEnterPos][2] + 0.5, 15.0, 0, 0);
            switch(hInfo[id][Type])
            {
                case 0:
                {
                    hInfo[id][hcheckpointidx][1] = CreateDynamicCP(271.884979, 306.631988, 999.148437, 1.0, 15500000+id , 2, -1, 5.0); // Default house
                    hInfo[id][htextid][1] = Create3DTextLabel("[Exit]", 0x00bbffFF, 271.884979, 306.631988, 999.148437, 8.0, 15500000+id, 1);
                }
            }
            db_next_row(HOUSE_RESULT);
        }
    }
    houseid = db_num_rows(HOUSE_RESULT);
    return 1;
}
HOUSE_LABEL:
pawn Код:
#define HOUSE_LABEL "{00bbff}House Name:{FFFFFF} %s(%d)\n{00bbff}House Owner:{FFFFFF} %s\n{00bbff}House Price:{FFFFFF} $%s"
Picture:


simply not passing because the id is correct showing like the price, not because the name of the house and the owner does not appear..

Help me please T.T
Reply
#2

maybe u havent set the name or noone has buyed it..
Reply
#3

pawn Код:
db_get_field_assoc(HOUSE_RESULT, "Owner", ftd, 30);
hInfo[id][owner] = strval(ftd);
if owner is meant to be a name then why would you use strval on it? that'd convert the string to an integer
Reply
#4

Quote:
Originally Posted by cessil
Посмотреть сообщение
pawn Код:
db_get_field_assoc(HOUSE_RESULT, "Owner", ftd, 30);
hInfo[id][owner] = strval(ftd);
if owner is meant to be a name then why would you use strval on it? that'd convert the string to an integer
thanks!!!!!!!!!!!!!!! <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)