So i'm trying out SQLx at the moment, so i used Hawk552's example of that 'Core' thingy (His last example on the topic).
So, i got an function like this:
Code:
public hrp_is_job(id,authid)
{
SQL_ThreadQuery(sql_get_handle(),"QueryHandle","SELECT job FROM users WHERE steamid='%s'",authid)
}
public QueryHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
//Thanks Hawk552 <3
if(FailState == TQUERY_CONNECT_FAILED)
return set_fail_state("[HRPi]SQL Connection Failed.")
else if(FailState == TQUERY_QUERY_FAILED)
return set_fail_state("[HRPi]Query failed.")
if(Errcode)
return log_amx("[HRPi]Error on query: %s",Error)
server_print("[HRPi] SQL Connection Successfull!")
return Handle:Query
}
And, i'm calling that function with this:
Code:
if(!hrp_is_job(id,authid) >= 2 && !hrp_is_job(id,authid) <= 11)
{
client_print(id,print_chat,"You must be an Police for the Tazer to work!")
return PLUGIN_HANDLED
}
SQL_ThreadQuery gives an error of the authid thing, but isn't that how it's supposed to be so it would work?
Also, I think i should have an 'return (something)' in 'public hrp_is_job' to return the value of the job, but what should i return?
Any help would be nice :/
__________________