Raised This Month: $ Target: $400
 0% 

[SOLVED] Find origin of a players head.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-02-2009 , 23:09   [SOLVED] Find origin of a players head.
Reply With Quote #1

Sorry http://forums.alliedmods.net/showthread.php?t=79054

I want to be able to check if a players head is visible for another player. How would I edit this to return true if origin2s head is visible to origin1? +karma

PHP Code:
public is_in_line_of_sight(origin1[3], origin2[3], ignore_players)
{
    new 
Float:fOrigin1[3];
    new 
Float:fOrigin2[3];
    new 
trace 0
    IVecFVec
(origin1,fOrigin1 );
    
IVecFVec(origin2,fOrigin2 );
    
    
draw_laserfOrigin1 fOrigin2 )
    
    
engfunc(EngFunc_TraceLinefOrigin1fOrigin2, (ignore_players IGNORE_MONSTERS DONT_IGNORE_MONSTERS), 0trace)
    
    new 
Float:fraction
    get_tr2
(traceTR_flFractionfraction)
    
    return (
fraction == 1.0) ? 0

__________________

Last edited by Bugsy; 02-02-2009 at 23:17.
Bugsy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-03-2009 , 14:28   Re: [SOLVED] Find origin of a players head.
Reply With Quote #2

Code:
bool:user_can_see_head(client, victim) {     if( !is_user_alive(client) || !is_user_alive(victim) ) return false;         static Float:client_head[3];     static Float:victim_head[3];     static Float:angles[3];         engfunc(EngFunc_GetBonePosition, client, 8, client_head, angles);     engfunc(EngFunc_GetBonePosition, victim, 8, victim_head, angles);         engfunc(EngFunc_TraceLine, client_head, victim_head, DONT_IGNORE_MONSTERS, client, 0);         return (get_tr2(0, TR_pHit) == victim); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:04.


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