Raised This Month: $ Target: $400
 0% 

Knockback on killed entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DavidLin
Member
Join Date: Jan 2016
Old 01-17-2016 , 07:25   Knockback on killed entity
Reply With Quote #1

How do I add a knock back to a player from the entity when it's destroyed ?

PHP Code:

public fwPropaneDestroyedentityattacker ) {

        if( !
pev_validentity ) )
                return 
HAM_IGNORED;

        if( 
get_user_weaponattacker ) == CSW_KNIFE )
                return 
HAM_IGNORED;

        static 
ent_t_class32 ];
        
entity_get_stringentityEV_SZ_classnameent_t_classcharsmaxent_t_class ) );

        if( !
equalent_t_classentity_name ) )
                return 
HAM_IGNORED;
                
        new 
EntasOwner peventitypev_iuser2 );
        if( !
is_user_connectedEntasOwner ) )
                
EntasOwner attacker;
                        
        new 
Float:EntasOrigin];
        
entity_get_vectorentityEV_VEC_originEntasOrigin );
        for( new 
index 1index <= maxPlayersindex++ ) {
                if( 
is_user_aliveindex ) && get_user_teamEntasOwner ) != get_user_teamindex ) ) {
                        new 
Float:userOrigin];
                        
entity_get_vectorindexEV_VEC_originuserOrigin );
                        new 
Float:DistanceBoom get_distance_fEntasOriginuserOrigin );
                        if( 
DistanceBoom <= get_pcvar_floatEntas_radius ) ) {
                                new 
victim_health get_user_healthindex );
                                new 
Float:damage_to_do = ( 1.0 - ( DistanceBoom get_pcvar_floatEntas_radius ) ) ) * get_pcvar_floatEntas_damage );
                                if( 
victim_health <= damage_to_do && is_user_connectedEntasOwner ) )
                                        
ExecuteHamBHam_KilledindexEntasOwner);
                                else
                                        
ExecuteHamBHam_TakeDamageindex"player"EntasOwnerdamage_to_doDMG_BLAST );

                                
// Knockback //
                        
}
                }
        }

        
remove_entityentity );
        return 
HAM_IGNORED;

DavidLin is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 01-17-2016 , 08:34   Re: Knockback on killed entity
Reply With Quote #2

look up for the lasermine plugin, it has such features, or the jetpack plugin
__________________
Depresie 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 09:22.


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