Code:
public is_user_registered(id)
{
if(!g_SqlConnection) { // We lost connection, don't continue.
return 0
}
new authid[33]
get_user_authid(id,authid,32)
//format(query,255,"SELECT steamid FROM main WHERE steamid='%s'",authid)
new Handle:Query = SQL_PrepareQuery(g_SqlConnection,"SELECT steamid FROM main WHERE steamid='%s'",authid)
if(!SQL_Execute(Query))
{
// if there were any problems
SQL_QueryError(Query,g_error,511)
set_fail_state(g_error)
}
// checks to make sure there's more results
// notice that it starts at the first row, rather than null
new Data
while(SQL_MoreResults(Query))
{
Data = SQL_ReadResult(Query,0)
SQL_NextRow(Query)
console_print(0,"[AMXX SQL] Your SteamID: %s Matched with the SQL SteamID: %s",authid,Query)
SQL_FreeHandle(Query)
return 1
}
return 0
//SQL_FreeHandle(g_SqlConnection)
}
This seemed to work, but I still am clueless on some parts. Like, is it necessary to close the connection after the Query is complete?