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

Weapon Knocback?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
semihkerim31
Member
Join Date: Feb 2017
Old 04-14-2017 , 14:12   Weapon Knocback?
Reply With Quote #1

Weapon Knockback plugin ?
semihkerim31 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-14-2017 , 14:49   Re: Weapon Knocback?
Reply With Quote #2

Search ?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
TunnS
Junior Member
Join Date: Feb 2017
Old 04-14-2017 , 15:28   Re: Weapon Knocback?
Reply With Quote #3

Quote:
#include <amxmodx>
#include <engine>

#define PLUGIN "Pump Knockback (when shot by one)"
#define VERSION "1.0"
#define AUTHOR "v3x & Chronic"

new cvar_pump_active , cvar_pump_force;

public plugin_init()
{
register_plugin(PLUGIN , VERSION , AUTHOR);

register_event("Damage" , "event_Damage" , "b" , "2>0");

cvar_pump_active = register_cvar("pump_knockback" , "1");
cvar_pump_force = register_cvar("pump_force" , "999");
}

public event_Damage(id)
{
if(!get_pcvar_num(cvar_pump_active))
return PLUGIN_CONTINUE;

if(!is_user_alive(id))
return PLUGIN_CONTINUE;

new weapon , attacker = get_user_attacker(id , weapon);

if(!is_user_alive(attacker))
return PLUGIN_CONTINUE;

if(weapon == CSW_AWP)
{
new Float:vec[3];
new Floatldvelo[3];
get_user_velocity(id, oldvelo);
create_velocity_vector(id , attacker , vec);
vec[0] += oldvelo[0];
vec[1] += oldvelo[1];
set_user_velocity(id , vec);
}

return PLUGIN_CONTINUE;
}

// Stock by the one and only, Chronic
stock create_velocity_vector(victim,attacker,Float: velocity[3])
{
if(!is_user_alive(victim) || !is_user_alive(attacker))
return 0;

new Float:vicorigin[3];
new Float:attorigin[3];
entity_get_vector(victim , EV_VEC_origin , vicorigin);
entity_get_vector(attacker , EV_VEC_origin , attorigin);

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

new Float:largestnum = 0.0;

if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0]);
if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1]);

origin2[0] /= largestnum;
origin2[1] /= largestnum;

velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_pump_force) * 3000) ) / get_entity_distance(victim , attacker);
velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_pump_force) * 3000) ) / get_entity_distance(victim , attacker);
if(velocity[0] <= 20.0 || velocity[1] <= 20.0)
velocity[2] = random_float(200.0 , 275.0);

return 1;
}

Last edited by TunnS; 04-14-2017 at 15:28.
TunnS is offline
deadman909
Veteran Member
Join Date: Oct 2008
Old 04-14-2017 , 15:51   Re: Weapon Knocback?
Reply With Quote #4

There should already be a plugin like that. Try the Zombie Plague section. Ive seen it in allot of those servers
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
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:04.


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