SQLite Improved
#4

Quote:
Originally Posted by jlalt
Посмотреть сообщение
Your loading house is too slow and bad :c there're so faster & better way I could optimaze it for you when I get to my pc.... btw I think your problem answer's here
https://sampforum.blast.hk/showthread.php?tid=303682&page=15

EDIT:

Here we go about your house load now you just need a simple call for it,
Example:
OnGameModeInit we write LoadHouses(); and boom they will be loaded successfully [ this new script should be a lot faster than your old one, with less lag.... you can do a speed test

PHP код:
LoadHouses()
{
    new
        
query[256],
        
DBResult:dbresult,
        
field[20]
    ;
    
format(querysizeof(query), "SELECT * FROM `houses`);
    dbresult = db_query(database, query);
    if(db_num_rows(dbresult))
    {
        new rows = db_num_rows(dbresult);
        for(new i = 0; i < rows; i++) {
            if(i > MAX_HOUSES) {
               printf("   
ERRORMaximum houses value is %d but houses rows found are | %|",MAX_HOUSES,rows);
               break;
               // simple script to avoid loading houses which are more than MAX_HOUSES value
            }
            db_get_field_assoc(dbresult, "
owner", field, sizeof(field));        format(HouseInfo[i][hOwner], 92, field);
            db_get_field_assoc(dbresult, "
address", field, sizeof(field));        format(HouseInfo[i][hAddress], 92, field);
            db_get_field_assoc(dbresult, "
forsale", field, sizeof(field));      HouseInfo[i][hForSale] = strval(field);
            db_get_field_assoc(dbresult, "
price", field, sizeof(field));          HouseInfo[i][hPrice] = strval(field);
            db_get_field_assoc(dbresult, "
x", field, sizeof(field));              HouseInfo[i][housePos][0] = floatstr(field);
            db_get_field_assoc(dbresult, "
y", field, sizeof(field));              HouseInfo[i][housePos][1] = floatstr(field);
            db_get_field_assoc(dbresult, "
z", field, sizeof(field));              HouseInfo[i][housePos][2] = floatstr(field);
            db_get_field_assoc(dbresult, "
a", field, sizeof(field));              HouseInfo[i][housePos][3] = floatstr(field);
            db_get_field_assoc(dbresult, "
ix", field, sizeof(field));              HouseInfo[i][houseInt][0] = floatstr(field);
            db_get_field_assoc(dbresult, "
iy", field, sizeof(field));              HouseInfo[i][houseInt][1] = floatstr(field);
            db_get_field_assoc(dbresult, "
iz", field, sizeof(field));              HouseInfo[i][houseInt][2] = floatstr(field);
            db_get_field_assoc(dbresult, "
ia", field, sizeof(field));              HouseInfo[i][houseInt][3] = floatstr(field);
            db_get_field_assoc(dbresult, "
hox", field, sizeof(field));              HouseInfo[i][houseObjectPos][0] = floatstr(field);
            db_get_field_assoc(dbresult, "
hoy", field, sizeof(field));              HouseInfo[i][houseObjectPos][1] = floatstr(field);
            db_get_field_assoc(dbresult, "
hoz", field, sizeof(field));              HouseInfo[i][houseObjectPos][2] = floatstr(field);
            db_get_field_assoc(dbresult, "
hoa", field, sizeof(field));              HouseInfo[i][houseObjectPos][3] = floatstr(field);
            db_get_field_assoc(dbresult, "
interior", field, sizeof(field));       HouseInfo[i][houseInterior] = strval(field);
            db_get_field_assoc(dbresult, "
exteriorint", field, sizeof(field));  HouseInfo[i][houseExteriorInt] = strval(field);
            db_get_field_assoc(dbresult, "
exteriorvw", field, sizeof(field));   HouseInfo[i][houseExteriorVW] = strval(field);
            db_get_field_assoc(dbresult, "
locked", field, sizeof(field));          HouseInfo[i][houseLocked] = strval(field);
            db_get_field_assoc(dbresult, "
money", field, sizeof(field));          HouseInfo[i][houseMoney] = strval(field);
            db_get_field_assoc(dbresult, "
sx", field, sizeof(field));              HouseInfo[i][houseStore][0] = floatstr(field);
            db_get_field_assoc(dbresult, "
sy", field, sizeof(field));              HouseInfo[i][houseStore][1] = floatstr(field);
            db_get_field_assoc(dbresult, "
sz", field, sizeof(field));              HouseInfo[i][houseStore][2] = floatstr(field);
            House_Refresh(i);
            ServerInfo[total_houses]++;
            db_next_row(dbresult);
        }
    }
    db_free_result(dbresult);
    return 1;

about the "stock" thing
https://sampforum.blast.hk/showthread.php?tid=570635
Does this load and stored the datas base upon from ID row (for example, ID: 1) because I am having issues with the IDs when loading it using the rows (ID 1 all of the sudden becomes ID 0, ID row arent set to primary key btw)

@Konstantinos - Gonna try that out thx
Reply


Messages In This Thread
SQLite Improved - by JaKe Elite - 12.05.2016, 05:57
Re: SQLite Improved - by jlalt - 12.05.2016, 06:04
Re: SQLite Improved - by Konstantinos - 12.05.2016, 09:17
Re: SQLite Improved - by JaKe Elite - 12.05.2016, 11:24
Re: SQLite Improved - by jlalt - 12.05.2016, 11:42
Re: SQLite Improved - by JaKe Elite - 12.05.2016, 11:59
Re: SQLite Improved - by JaKe Elite - 12.05.2016, 12:40
Re: SQLite Improved - by jlalt - 12.05.2016, 12:55
Re: SQLite Improved - by JaKe Elite - 12.05.2016, 13:32
Re: SQLite Improved - by jlalt - 12.05.2016, 14:28

Forum Jump:


Users browsing this thread: 1 Guest(s)