View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-29-2018 , 10:51   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #50

Quote:
Originally Posted by Natsheh View Post
PHP Code:
bool:IsInLineOfSightent1 ent2 

    new 
iTrace Float:fFractionFloat:fOrigin1[3], Float:fOrigin2[3], Float:fViewOfs[3]; 
    
pev(ent1pev_v_ofsfViewOfs);
    
pev(ent1pev_originfOrigin1)
    
fOrigin1 += fViewOfs;
    
pev(ent2pev_v_ofsfViewOfs);
    
pev(ent2pev_originfOrigin2)
    
fOrigin2 += fViewOfs;
    
engfuncEngFunc_TraceLine fOrigin1 fOrigin2 IGNORE_MONSTERS iTrace ); 
    
get_tr2iTrace TR_flFraction fFraction ); 
     
    return 
bool:( fFraction == 1.0 ); 

Now its more accurate.
Can you please explain what exactly this does in comparison to the function I created? I am seeing no difference while in game.

Also, it's not compiling.
Code:
//pev_v_ofs undefined, should this be pev_view_ofs?
pev( ent1 , pev_v_ofs , fViewOfs );
pev( ent1 , pev_origin , fOrigin1 ) //You cannot do this with arrays.
fOrigin1 += fViewOfs;
//Should each index of the array be incremented? fOrigin1[ 0 ] += fViewOfs[ 0 ]; fOrigin1[ 1 ] += fViewOfs[ 1 ]; fOrigin1[ 2 ] += fViewOfs[ 2 ];
__________________

Last edited by Bugsy; 04-29-2018 at 10:58.
Bugsy is offline