Raised This Month: $ Target: $400
 0% 

Imune from hs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 08-28-2012 , 14:55   Imune from hs
Reply With Quote #1

How to do that every time player gets a shot into head there would be 50% chance to avoid that shot's damage?
PHP Code:
public player_Attack idiAttackerFloat:flDamageFloat:fVecDir[3], tr )
{
    if ( 
get_user_flagsid ) & VIP_ACCESS )
    {
        if ( 
IsPlayeriAttacker ) && heavy_activeid ] && cs_get_user_teamid ) != cs_get_user_teamiAttacker ) && get_tr2trTR_iHitgroup ) == HIT_HEAD && get_tr2trTR_iHitgroup ) == HIT_HEAD )
        {
            
set_tr2trTR_iHitgroupHIT_CHEST );
            
set_tr2trTR_iHitgroupHIT_STOMACH );
            
            
            
message_beginMSG_ONE_UNRELIABLEg_msgFade, .player=id );
            {
                
write_short1<<12 );
                
write_short1<<);
                
write_shortFFADE_IN );
                
write_byte139 );
                
write_byte34 );
                
write_byte34 );
                
write_byte75 );
            }
            
message_end( );
            
            
message_beginMSG_ONE_UNRELIABLEg_msgShake, .player=id );
            {
                
write_short255<<);
                
write_short50<<);
                
write_short255<<);
            }
            
message_end( );
        }
    }

GhostMan is offline
GhostMan
Senior Member
Join Date: Jun 2012
Old 09-08-2012 , 12:38   Re: Imune from hs
Reply With Quote #2

Anybody?
GhostMan is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-08-2012 , 13:26   Re: Imune from hs
Reply With Quote #3

how do you hook the function?

also...
Code:
&& get_tr2( tr, TR_iHitgroup ) == HIT_HEAD && get_tr2( tr, TR_iHitgroup ) == HIT_HEAD )
why?

Check out this plugin. Its a good example of how to catch headshots
http://forums.alliedmods.net/showthr...light=headshot
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 09-08-2012 at 13:46.
Liverwiz is offline
GhostMan
Senior Member
Join Date: Jun 2012
Old 09-08-2012 , 15:31   Re: Imune from hs
Reply With Quote #4

I dont know why there is that part, i even wasnt sure what it was for untill you show me HS Modes plugin.

Now i think i get it So would this code work? It should give 50% chance to entiraly block damage if you get HS.

PHP Code:
public player_Attack idiAttackerFloat:flDamageFloat:fVecDir[3], tr )
{
    if ( 
get_user_flagsid ) & VIP_ACCESS )
    {
        if ( 
IsPlayeriAttacker ) && heavy_activeid ] && cs_get_user_teamid ) != cs_get_user_teamiAttacker ))
        {
            if( 
get_tr2trTR_iHitgroup ) == HIT_HEAD )
            {
                new 
p_Random random_num(1100)
                
                if(
p_Random <= 50)
                {
                    
message_beginMSG_ONE_UNRELIABLEg_msgFade, .player=id );
                    {
                        
write_short1<<12 );
                        
write_short1<<);
                        
write_shortFFADE_IN );
                        
write_byte139 );
                        
write_byte34 );
                        
write_byte34 );
                        
write_byte75 );
                    }
                    
message_end( );
                    
                    
message_beginMSG_ONE_UNRELIABLEg_msgShake, .player=id );
                    {
                        
write_short255<<);
                        
write_short50<<);
                        
write_short255<<);
                    }
                    
message_end( );
                    
                    return 
HAM_SUPERCEDE;
                }
            }
        }
    }
    return 
HAM_IGNORED;

GhostMan is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-08-2012 , 15:38  
Reply With Quote #5

Code is hard to read but.... Random(1); gets numbers 0-1 and if == 1 is a 50% chance also.....
Doc-Holiday 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 05:48.


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