MySql Plugin (now on github!)
#1

Hi I wanna ask about my problem. I want load some my data with function mysql_tquery, but the callback doesn't called. Here's my code:




SERVERLOG.txt
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z-R4, ©2005-2014 SA-MP Team

[23:02:09] 
[23:02:09] Server Plugins
[23:02:09] --------------
[23:02:09]  Loading plugin: streamer
[23:02:09]   Loaded.
[23:02:09]  Loading plugin: sscanf
[23:02:09] 

[23:02:09]  ===============================

[23:02:09]       sscanf plugin loaded.     

[23:02:09]          Version:  2.8.1        

[23:02:09]    © 2012 Alex "******" Cole  

[23:02:09]  ===============================

[23:02:09]   Loaded.
[23:02:09]  Loading plugin: mysql
[23:02:09]  >> plugin.mysql: R39-2 successfully loaded.
[23:02:09]   Loaded.
[23:02:09]  Loaded 3 plugins.

[23:02:09] 
[23:02:09] Filterscripts
[23:02:09] ---------------
[23:02:09]   Loading filterscript 'ls_mall.amx'...
[23:02:09]   Loading filterscript 'ls_elevator.amx'...
[23:02:09]   Loading filterscript 'VehSys.amx'...
[23:02:09]  
[23:02:09] > Connecting to MySQL server...
[23:02:09]   Loaded 3 filterscripts.

[23:02:09] Loaded 3 vehicles from: vehicles/trains.txt
[23:02:09] Loaded 3 vehicles from: vehicles/pilots.txt
[23:02:09] Loaded 15 vehicles from: vehicles/lv_law.txt
[23:02:09] Loaded 39 vehicles from: vehicles/lv_airport.txt
[23:02:09] Loaded 255 vehicles from: vehicles/lv_gen.txt
[23:02:09] Loaded 38 vehicles from: vehicles/sf_law.txt
[23:02:09] Loaded 35 vehicles from: vehicles/sf_airport.txt
[23:02:09] Loaded 353 vehicles from: vehicles/sf_gen.txt
[23:02:09] Loaded 24 vehicles from: vehicles/ls_law.txt
[23:02:09] Loaded 37 vehicles from: vehicles/ls_airport.txt
[23:02:09] Loaded 98 vehicles from: vehicles/ls_gen_inner.txt
[23:02:09] Loaded 389 vehicles from: vehicles/ls_gen_outer.txt
[23:02:09] Loaded 71 vehicles from: vehicles/whetstone.txt
[23:02:09] Loaded 168 vehicles from: vehicles/bone.txt
[23:02:09] Loaded 61 vehicles from: vehicles/flint.txt
[23:02:09] Loaded 96 vehicles from: vehicles/tierra.txt
[23:02:09] Loaded 96 vehicles from: vehicles/red_county.txt
[23:02:09] Total vehicles from files: 1781
[23:02:09] 
---------------------------------------
[23:02:09] Running Grand Larceny - by the SA-MP team

[23:02:09] ---------------------------------------

[23:02:09] Number of vehicle models: 173
[23:02:10]
mysql.log
Код:
[23:01:24] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `prices`;", callback: "CarPriceLoadInit", format: "(null)"
[23:01:24] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:01:24] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLQuery::Execute[CarPriceLoadInit] - starting query execution
[23:01:24] [DEBUG] CMySQLQuery::Execute[CarPriceLoadInit] - query was successfully executed within 0.580 milliseconds
[23:01:24] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[23:01:24] [DEBUG] Calling callback "CarPriceLoadInit"..
[23:01:24] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
pawn code:
Код:
public OnFilterScriptInit()
{
    print( "> Connecting to MySQL server..." );
    sqlconn = mysql_connect( "127.0.0.1", "root", "samp", "thepassistrue" );

    ManualVehicleEngineAndLights();
    mysql_tquery( sqlconn, "SELECT * FROM `prices`;", "CarPriceLoadInit" );
    return 1;
}

forward CarPriceLoadInit();
public CarPriceLoadInit()
{
    new tmp[16];
    print("Loading Car Prices data.....");
    
    for( new i = 0; i < cache_get_row_count( sqlconn ); i++ ) {
        cache_get_field_content( i, "model", tmp, sqlconn ); VehInfo[i][Model] = strval(tmp);
        cache_get_field_content( i, "type", tmp, sqlconn ); VehInfo[i][Type] = strval(tmp);
        cache_get_field_content( i, "name", VehInfo[i][Name], sqlconn, 64 );
        cache_get_field_content( i, "price", tmp, sqlconn ); VehInfo[i][Price][0] = strval(tmp);
    }
    printf("|- %d Car Prices loaded from database. -|", cache_get_row_count( sqlconn ));
    return 1;
}
Reply
#2

Hmm, what plugin version are you using?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)