View Single Post
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-28-2022 , 08:24   Re: Get only the x axis
Reply With Quote #4

PHP Code:
Float:get_2d_distance_f(const Float:fStart[3], const Float:fEnd[3])
{
   return 
floatsqroot( ( fStart[0] - fEnd[0] ) ^ 2.0 + ( fStart[1] - fEnd[1] ) ^ 2.0 );

Replace get_distance with get_2d_distance_f

And check if player z axis is approximately on the ground.

PHP Code:
if( (get_2d_distance_f(Originorigin_i) > 200.0) || !((Origin[2] - 72.0) <= origin_i[2] <= (Origin[2] + 36.0)) ) 
Full fixed code:-

PHP Code:
Check_AttackDamage2(id)
{
    new 
Float:origin_i[3], Float:Origin[3]
    
pev(idpev_originOrigin)
    
    for(new 
1<= g_MaxPlayersi++)
    {
        if(!
is_user_alive(i))
            continue
        
pev(ipev_originorigin_i)
        
        if( (
get_2d_distance_f(Originorigin_i) > 200.0) || !((Origin[2] - 36.0) <= origin_i[2] <= (Origin[2] + 36.0)) )
            continue    
        if(
cs_get_user_team(id) == cs_get_user_team(i))
            continue    
            
        
ExecuteHamB(Ham_TakeDamagei0id750.0DMG_SLASH)
        
Make_PlayerShake(i)
    }
    

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-28-2022 at 12:24.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh