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

Plugin that makes humans' knife to knock back zombies


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 03-15-2022 , 18:45   Plugin that makes humans' knife to knock back zombies
Reply With Quote #1

There is a plugin that makes humans' knife to kick zombies at large distances. If a human attack a zombie with a knife, the zombie will be kicked out at a large distance.

What is the name of this plugin? Can someone give me a link to download this plugin?
GlobalPlague is offline
Dyaus
Member
Join Date: Aug 2021
Old 03-15-2022 , 20:01   Re: Plugin that makes humans' knife to knock back zombies
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <cstrike>
#include <fakemeta_util>

new cvar_knife_kbcvar_knife_kb_enable

public plugin_init()
{
    
register_plugin("[ZP] knife knock-back""1.0""Dyaus")
    
    
cvar_knife_kb_enable register_cvar("zp_kb_enable""1")
    
cvar_knife_kb register_cvar("zp_kb_val""6.0")
    
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
}
public 
fw_TakeDamage(victiminflictorattackerFloat:damage_type)
{
    if(!
is_user_connected(attacker))
        return 
HAM_IGNORED
    
if(zp_get_user_zombie(attacker))
        return 
HAM_IGNORED
    
if(get_pcvar_num(cvar_knife_kb_enable) == 1)
    {
        if(
get_user_weapon(attacker) == CSW_KNIFE)
        {
            new 
Float:vec[3]
            new 
Float:oldvelo[3]
            
pev(victimpev_velocityoldvelo)
            
create_velocity_vector(victim attacker vec)
            
vec[0] += oldvelo[0] + get_pcvar_float(cvar_knife_kb)
            
vec[1] += oldvelo[1] + 0
            set_pev
(victimpev_velocityvec)
        }
    }
    return 
HAM_IGNORED
}

stock create_velocity_vector(victim,attacker,Float:velocity[3])
{
        if(!
zp_get_user_zombie(victim) || !is_user_alive(attacker))
                return 
0;

        new 
Float:vicorigin[3];
        new 
Float:attorigin[3];
        
pev(victimpev_origin vicorigin);
        
pev(attackerpev_origin attorigin);

        new 
Float:origin2[3]
        
origin2[0] = vicorigin[0] - attorigin[0];
        
origin2[1] = vicorigin[1] - attorigin[1];

        new 
Float:largestnum 0.0;

        if(
floatabs(origin2[0])>largestnumlargestnum floatabs(origin2[0]);
        if(
floatabs(origin2[1])>largestnumlargestnum floatabs(origin2[1]);

        
origin2[0] /= largestnum;
        
origin2[1] /= largestnum;
        
        if (
get_user_weapon(attacker) == CSW_KNIFE)
        {
                
velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knife_kb) * 10000 ) / floatround(get_distance_f(vicoriginattorigin));
                
velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knife_kb) * 10000 ) / floatround(get_distance_f(vicoriginattorigin));
        }
        if(
velocity[0] <= 20.0 || velocity[1] <= 20.0)
        
velocity[2] = random_float(200.0 275.0);

        return 
1;

this is not tested !! try it and tell me
Dyaus 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 19:36.


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