thread mysql function
#1

pawn Код:
stock isPlayerAccountRegistred(account[])
{
    new string[128];
    format(string, sizeof(string), "SELECT `pName` FROM `accs` WHERE `pName`='%s'", account);
    mysql_query(string);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        mysql_free_result();
        return 1;
    }
    mysql_free_result();
    return 0;
}
how can i thraed that so it work with mysql R7? by blueg i use it many places
Reply
#2

Hi Unknown123,

I don't think you have actually threaded the query here. The mysql_query function needs more parameters to be threaded. Take a look at this: https://sampwiki.blast.hk/wiki/MySQL#mysql_query

The resultid is the equivalent of the thread. You need to put a number in here for your query to be threaded.

Cheers,

TJ
Reply
#3

The places where you check if acc is registered, just put the query there instead with mysql_function_query, then you make a callback were you do the rest.
Reply
#4

Quote:
Originally Posted by Richie©
Посмотреть сообщение
The places where you check if acc is registered, just put the query there instead with mysql_function_query, then you make a callback were you do the rest.
but i use it many other places too, i was looking for a shorter ways if posible
Reply
#5

I had alot of theese i had to fix in my gm to for it to work with the r7 plugin. If you want the things threaded i think there is no other choice. You send the query, let samp server continue doing its thing, when query is finished it 'calls' the callback you specified with mysql_function_query.
Reply
#6

ok tahnsk
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)