Okay, I started playing with SQL in AMXX, and I've stumbled upon a problem ...
I have used SQL in few different programming languages (PHP, C/C++) but something here bugs me too much ...

I made a simple code that does SQL check query in client_connect if the player steamid is in table or not (for example ban plugin), and then kick him if he is ...
So, I've managed to do everything except the kick part

I don't know how to do that from "QueryCheckAuth" ?
Main question is this:
How do I get player id in that function so I can do for example server_cmd("kick #%d",get_user_userid(id)) if mysql_num_rows>0 ?
See the last function in the code
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <sqlx>
new pc_sql_host
new pc_sql_user
new pc_sql_pass
new pc_sql_db
new Handle:g_sql_tuple
public plugin_init() {
register_plugin("SQL test", "0.1", "Turshija");
pc_sql_host = register_cvar("db_host", "XXX.XXX.XXX.XXX");
pc_sql_user = register_cvar("db_user", "username here");
pc_sql_pass = register_cvar("db_pass", "password here", FCVAR_PROTECTED);
pc_sql_db = register_cvar("db_name", "db name here");
set_task(0.1, "grab_cvars")
}
public grab_cvars(){
new sql_host[32], sql_user[32], sql_pass[32], sql_db[32]
get_pcvar_string(pc_sql_host, sql_host, 31)
get_pcvar_string(pc_sql_user, sql_user, 31)
get_pcvar_string(pc_sql_pass, sql_pass, 31)
get_pcvar_string(pc_sql_db, sql_db, 31)
g_sql_tuple = SQL_MakeDbTuple(sql_host, sql_user, sql_pass, sql_db)
}
public client_connect (id){
new name[32],auth[32];
new cache[500];
get_user_name(id, name, 31);
get_user_authid(id, auth, 31);
formatex(cache,500, "SELECT * FROM table WHERE auth='%s'",auth);
SQL_ThreadQuery( g_sql_tuple, "QueryCheckAuth", cache );
return PLUGIN_CONTINUE;
}
public QueryCheckAuth( iFailState, Handle:hQuery, szError[ ], iError, iData[ ], iDataSize, Float:fQueueTime ) {
if( iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED ) {
log_amx( "Error!" );
} else if( SQL_NumResults( hQuery ) ) {
///////////////////////
// NOW WHAT ?! -_-
///////////////////////
}
}