AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to detect you are point at a entity ? (https://forums.alliedmods.net/showthread.php?t=153670)

K.K.Lv 03-27-2011 11:33

How to detect you are point at a entity ?
 
As the title !

Flipper_SPb 03-27-2011 11:46

Re: How to detect you are point at a entity ?
 
You can use get_user_aiming()
http://www.amxmodx.org/funcwiki.php?...ming&go=search

K.K.Lv 03-27-2011 11:56

Re: How to detect you are point at a entity ?
 
sorry for my mistake, this function only use for player right ?
I don't want to detect the player .

K.K.Lv 03-27-2011 12:07

Re: How to detect you are point at a entity ?
 
according to this code
Code:

Vector v_forward;
  Vector v_src = edict->v.origin + edict->v.view_ofs;

  ANGLEVECTORS(edict->v.v_angle, v_forward, NULL, NULL);
  TraceResult trEnd;
  Vector v_dest = v_src + v_forward * static_cast<float>(params[4]);
  TRACE_LINE(v_src, v_dest, 0, edict, &trEnd);

i think I have find a right way !
thx your reply :)

Flipper_SPb 03-27-2011 12:13

Re: How to detect you are point at a entity ?
 
get_user_aiming() will return any entity. Not only players


All times are GMT -4. The time now is 14:40.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.