SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/01/2018, 02:01 PM   #1
Meller
Banned
 
Join Date: Dec 2016
Posts: 578
Reputation: 132
Default Threaded query with num rows isn't being printed as a log.

Simple issue, weird response.

Current log:
PHP Code:
[databaseConnecting to the database..
[
databaseConnected to the database after (17ms)
[
achievementsLoaded a total of 4 achievements..
Number of vehicle models0
[housesLoaded 55 house wallpapers successfully.
[
interiorsLoaded 4 doors successfully.
[
objectsLoaded 0 objects from the database
And how my house module is looking like:
PHP Code:
enum houseWallpapersVariables {
    
hWP_ID,
    
Float:hWP_x,
    
Float:hWP_y,
    
Float:hWP_z,
    
Float:hWP_rotx,
    
Float:hWP_roty,
    
Float:hWP_rotz,
    
hWP_model,
    
hWP_txdModel,
    
hWP_txdTXD[32],
    
hWP_txdTexture[32],
    
hWP_type,

    
hWP_object
}
static 
houseWallpapersData[500][250][houseWallpapersVariables];

enum houseVariables {
    
houseID,
    
houseOwner[MAX_PLAYER_NAME],
    
houseAdress[64]
}
static 
houseData[500][houseVariables];

#include <YSI\y_hooks>

hook OnGameModeInit() {
    
inline OnHouseDataReceived() {
        for(new 
icache_num_rows(); i++) {
            
cache_get_value_name_int(i"id"houseData[i][houseID]);
            
cache_get_value_name(i"adress"houseData[i][houseAdress], 64);
            
cache_get_value_name(i"owner"houseData[i][houseOwner], MAX_PLAYER_NAME);
        }
        
printf("[houses] Loaded %i houses successfully."cache_num_rows());
    }
    
mysql_tquery(databaseConnection"SELECT * FROM houses");

    
inline OnHouseWallpapersReceived() {
        for(new 
rowrow cache_num_rows(); row++) {
            static 
id;
            
cache_get_value_name_int(row"houseid"id);

            
cache_get_value_name_int(row"model"houseWallpapersData[id][row][hWP_model]);
            
cache_get_value_name_int(row"type"houseWallpapersData[id][row][hWP_type]);
            
cache_get_value_name_int(row"txdModel"houseWallpapersData[id][row][hWP_txdModel]);
            
cache_get_value_name(row"txdTXD"houseWallpapersData[id][row][hWP_txdTXD], 32);
            
cache_get_value_name(row"txdTexture"houseWallpapersData[id][row][hWP_txdTexture], 32);

            
cache_get_value_name_float(row"x"houseWallpapersData[id][row][hWP_x]);
            
cache_get_value_name_float(row"y"houseWallpapersData[id][row][hWP_y]);
            
cache_get_value_name_float(row"z"houseWallpapersData[id][row][hWP_z]);

            
cache_get_value_name_float(row"rotx"houseWallpapersData[id][row][hWP_rotx]);
            
cache_get_value_name_float(row"roty"houseWallpapersData[id][row][hWP_roty]);
            
cache_get_value_name_float(row"rotz"houseWallpapersData[id][row][hWP_rotz]);

            
SetDynamicObjectMaterial((houseWallpapersData[id][row][hWP_object] = CreateDynamicObject(houseWallpapersData[id][row][hWP_model], houseWallpapersData[id][row][hWP_x], houseWallpapersData[id][row][hWP_y], houseWallpapersData[id][row][hWP_z], houseWallpapersData[id][row][hWP_rotx], houseWallpapersData[id][row][hWP_roty], houseWallpapersData[id][row][hWP_rotz])), 0houseWallpapersData[id][row][hWP_txdModel], houseWallpapersData[id][row][hWP_txdTXD], houseWallpapersData[id][row][hWP_txdTexture], 0);
        }
        
printf("[houses] Loaded %i house wallpapers successfully."cache_num_rows());
    }
    
mysql_tquery_inline(databaseConnection"SELECT * FROM `house wallpapers` LIMIT 5000"using inline OnHouseWallpapersReceived);


Why isn't the first /printf/ being printed? I'm so lost.
Meller is offline   Reply With Quote
Old 24/01/2018, 02:09 PM   #2
jlalt
Banned
 
Join Date: Oct 2014
Location: Iran
Posts: 1,266
Reputation: 366
Default Re: Threaded query with num rows isn't being printed as a log.

you mean why this isn't getting printed?
PHP Code:
printf("[houses] Loaded %i houses successfully."cache_num_rows()); 
if yes then bruh you're executing threaded query for a inline callback. [ didn't work with that so far but maybe ]
so try changing
PHP Code:
mysql_tquery(databaseConnection"SELECT * FROM houses"); 
to ->
PHP Code:
mysql_tquery_inline(databaseConnection"SELECT * FROM houses"using inline OnHouseDataReceived); 
jlalt is offline   Reply With Quote
Old 24/01/2018, 02:12 PM   #3
Sithis
Gangsta
 
Join Date: Mar 2013
Location: the Netherlands
Posts: 887
Reputation: 79
Default Re: Threaded query with num rows isn't being printed as a log.

^ Try the above. I was too late with the same solution.
__________________
Developer and owner of https://trinityrpg.com
Sithis is offline   Reply With Quote
Old 24/01/2018, 02:16 PM   #4
Meller
Banned
 
Join Date: Dec 2016
Posts: 578
Reputation: 132
Default Re: Threaded query with num rows isn't being printed as a log.

ahhhh shieeet, completely forgot to link it to the inline callack
Meller is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Threaded query problem WhoIsYourDaddy Scripting Help 20 26/02/2016 04:35 PM
How to get a cache id from threaded query? Su37Erich Scripting Help 0 18/12/2014 04:40 PM
MySQL Threaded Query Help unSatisfied Scripting Help 2 03/04/2014 10:15 PM
MySQL Query result is different than printed FalconWingsX Scripting Help 1 15/12/2013 06:39 PM
[Tutorial] Threaded query AppleX Lançamentos/Releases 5 23/01/2012 07:39 PM


All times are GMT. The time now is 03:07 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.