You want your code to be executed, when the "+use" key doesn't activate ANYTHING?
What fysiks said, you can hook "Ham_Use" or a similar name, check if the hooked function was called. Another (much easier) method is to; before you check when they pushed the use key. Do a trace line (get_user_aiming) and see if there looking at a "usable" entity.
Here's the second method:
Code:
public client_PreThink(id)
{
if(!is_user_alive(id))
return
if(!(entity_get_int(id,EV_INT_button) & IN_USE && !(entity_get_int(id,EV_INT_oldbuttons) & IN_USE)))
return
new Index,Body
get_user_aiming(id,Index,Body,200); // not sure how far HL checks when doing the use key
// Filter out any entity's
// I filter out other players, and "trigger_*" entity's as you cannot "+use" them
if(is_valid_ent(Index))
{
static Classname[33]
entity_get_string(Index,EV_SZ_classname,Classname,32)
if(!equali(Classname,"player") || !(containi(Classname,"trigger_") != -1))
return
}
// Your code
}
__________________