No, because immediately after calling SqlGetUserIndex(), you are expecting to have the return value from the threaded query. As HamletEagle said, the query is asynchronous, meaning you can think if it as being added to a queue and executed when resources are available. You cannot expect results to be immediately available.
PHP Code:
new VarTest[33]
public MyFunction(id)
{
// Query
SqlGetUserIndex(id)
}
public SqlGetUserIndex(id)
{
VarTest[id] = -1
new data[1]
data[0] = id
SQL_ThreadQuery(handle, "_SqlGetUserIndex", "SELECT id FROM users WHERE authid = 'STEAM_XXXXXXXX'", data, sizeof(data))
}
public _SqlGetUserIndex(fail_state, Handle:query, error[], error_code, data[], data_size)
{
// check fails, etc....
new id = data[0]
if(SQL_NumResults(query))
{
VarTest[id] = SQL_ReadResult(xQuery, 0)
}
else
{
VarTest[id] = -1
//Do what you want here that you would do in your code above when the value = -1
}
}
__________________