Quote:
Originally Posted by hornet
Search the Approved plugins section for No Walls. The plugin prevents players from attacking one another through walls. I've posted an update on the last page - you can get the method from there.
|
Okay, so now I got what I need.
One more thing, how to check who I'm attacking?
PHP Code:
public CBasePlayer_TraceAttack( iVictim, iAttacker, Float:flDamage, Float:vDirection[ 3 ], ptr, Bits )
{
if( get_pcvar_num( g_pEnabled ) && iAttacker && get_user_weapon( iAttacker ) != CSW_KNIFE )
{
static Float:vStart[ 3 ], Float:vEnd[ 3 ], Float:flFraction;
get_tr2( ptr, TR_vecEndPos, vEnd );
get_tr2( ptr, TR_flFraction, flFraction );
xs_vec_mul_scalar( vDirection, -1.0, vDirection );
xs_vec_mul_scalar( vDirection, flFraction * 9999.0, vStart );
xs_vec_add( vStart, vEnd, vStart );
new iTarget = trace_line( iVictim, vEnd, vStart, vEnd );
if( !iTarget )
// Show this meesage to the atacker
client_print(id, print_chat, "You are shooting at %s trough a wall, szVictim")
//return HAM_SUPERCEDE;
// Show this message to the victim
client_print(id, print_chat, "%s is shooting at you trough a wall, szAttacker")
// Show this message when the player killed the victim trought the wall
client_print(0, print_chat, "%s killed %s trough a wall, szAttacker, szVictim")
}
return HAM_IGNORED;
}