AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Knockback on killed entity (https://forums.alliedmods.net/showthread.php?t=277812)

DavidLin 01-17-2016 07:25

Knockback on killed entity
 
How do I add a knock back to a player from the entity when it's destroyed :3 ?

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;



Depresie 01-17-2016 08:34

Re: Knockback on killed entity
 
look up for the lasermine plugin, it has such features, or the jetpack plugin


All times are GMT -4. The time now is 09:22.

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