Raised This Month: $12 Target: $400
 3% 

Get only the x axis


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OW3R
Junior Member
Join Date: Sep 2021
Old 06-27-2022 , 08:28   Get only the x axis
Reply With Quote #1

Do not damage the y and z axes.

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

OW3R is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-27-2022 , 23:36   Re: Get only the x axis
Reply With Quote #2

What in the world does that mean and what is your question?
__________________
fysiks is offline
zXCaptainXz
Member
Join Date: May 2017
Old 06-28-2022 , 06:02   Re: Get only the x axis
Reply With Quote #3

He probably wants to damage players in front of him only, won’t even bother to help because he’s going to delete his post after a solution is posted as usual.
zXCaptainXz is offline
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
OW3R
Junior Member
Join Date: Sep 2021
Old 06-28-2022 , 09:25   Re: Get only the x axis
Reply With Quote #5

Wow. Thanks for all.
OW3R is offline
Reply


Thread Tools
Display Modes

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 05:17.


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