SA-MP Forums Archive
thread mysql function - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: thread mysql function (/showthread.php?tid=325442)



thread mysql function - Unknown123 - 13.03.2012

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


Re: thread mysql function - TTJJ - 13.03.2012

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


Re: thread mysql function - Richie© - 13.03.2012

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.


Re: thread mysql function - Unknown123 - 13.03.2012

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


Re: thread mysql function - Richie© - 13.03.2012

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.


Re: thread mysql function - Unknown123 - 13.03.2012

ok tahnsk