filterscript problem
#1

hi,

i'm writing my first filterscript and i've already faced a problem. I am trying to load the mysql row to enum OnPlayerConnect callback, but the query never executes.
Debug.txt shows only that connection was successfull, the query isn't showed at all. I was experimenting a little, and if i change the OnPlayerConnect to OnPlayerSpawn callback, the filterscript works.

So, is it even possible to query a database from onplayerconnect cb?

my code:
pawn Код:
public OnPlayerConnect(playerid)
{
    format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM accounts WHERE username = '%s'", PlayerName(playerid));
    mysql_query(sqlQuery);
    mysql_store_result();
    if(mysql_num_rows())
    {
        while(mysql_fetch_row_format(sqlQuery, "|"))
        {
            sscanf(sqlQuery, "p<|>e<is[24]s[40]s[255]s[15]ii>", PlayerData[playerid]);
        }
    }
    mysql_free_result();
    return 1;
}
sqlQuery is a global variable, PlayerName(playerid) is a stock function that returns a name, and enum matches perfectly to sscanf.

and this is the debug.txt
Код:
[01:15:27] MySQL Debugging activated (09/17/11)

[01:15:27] ---------------------------

[01:15:27]  

[01:15:27] >> mysql_connect( )

[01:15:27] CMySQLHandler::CMySQLHandler() - constructor called.

[01:15:27] CMySQLHandler::CMySQLHandler() - Connecting to "somehost" | DB: "database" | Username: "user" ...

[01:15:27] CMySQLHandler::Connect() - Connection was successful.

[01:15:27] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
script is loaded correctly, added in server.cfg.

any advice is appreciated.

br
Reply


Messages In This Thread
filterscript problem - by [Diablo] - 16.09.2011, 23:44
Re: filterscript problem - by MP2 - 17.09.2011, 01:57
Re: filterscript problem - by Vortrex - 17.09.2011, 02:52
Re: filterscript problem - by MP2 - 17.09.2011, 04:45
Re: filterscript problem - by [Diablo] - 17.09.2011, 10:16

Forum Jump:


Users browsing this thread: 1 Guest(s)