Code:
format(query,255,"SELECT steamid, reason, time FROM tempbans")
should be
Code:
format(query,255,"SELECT steamid, reason, time FROM tempbans WHERE steamid = '%s'",authid)
That would make it run cleaner. I would also suggest you use
public client_authorized(id){
to do the check so that you know the player has a steam id.
++edit++
Try this code
Code:
new Sql:dbc
new Result:result
// ...
public client_authorized(id)
{
new authid[32]
get_user_authid(id, authid, 31)
result = dbi_query(dbc,"SELECT steamid, reason, time FROM tempbans WHERE steamid = '%s'",authid)
if (dbi_num_rows(result) < 1) //not in db
{
return PLUGIN_CONTINUE
}
else
{ //get the info from the database
dbi_nextrow(result)
new reason[101], var;
dbi_result(result, "reason" , reason , 100)
var = dbi_result(result, "time")
new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"[AMXX] %s (%s) is still banned for %i minutes",name,authid,var)
server_cmd("kick #%d ^"%s (%i minutes left in ban)^"",get_user_userid(id),reason,var)
return PLUGIN_CONTINUE
}
dbi_free_result(result)
return PLUGIN_CONTINUE
}