Code:
/* AMX Mod script.
* Special thanks goes to JGHG for MOST of the code!
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define SPEED 800.0
public plugin_init() {
register_plugin("HE Knockback", "1.0", "ThantiK")
register_event("Damage", "hedamage_event", "b", "2!0", "4!0", "5!0", "6!0")
}
public hedamage_event(id) {
new MAXPLAYERS
MAXPLAYERS = get_maxplayers()
new inflictor = entity_get_edict(id, EV_ENT_dmg_inflictor)
if (inflictor <= MAXPLAYERS)
return PLUGIN_CONTINUE
new classname2[8]
entity_get_string(inflictor, EV_SZ_classname, classname2, 7)
if (!equal(classname2, "grenade"))
return PLUGIN_CONTINUE
new bangorigin[3]
bangorigin[0] = read_data(4)
bangorigin[1] = read_data(5)
bangorigin[2] = read_data(6)
new Float:upVector[3]
upVector[0] = float(bangorigin[0])
upVector[1] = float(bangorigin[1])
upVector[2] = float(bangorigin[2])
entity_set_vector(id, EV_VEC_velocity, upVector);
client_print(0, print_chat, "%d got hit by %d which is a %s, from %d, %d, %d", id, inflictor, classname2, bangorigin[0], bangorigin[1], bangorigin[2])
server_print("%d got hit by %d which is a %s, from %d, %d, %d", id, inflictor, classname2, bangorigin[0], bangorigin[1], bangorigin[2])
return PLUGIN_CONTINUE
}
This was my idea back in the AMX mod days when it "couldn't be done"...now I've made it...but the calculation is messed up. Seems HE's only send you 1 direction based on where you are on the map. Would anyone mind taking a look at this and telling me what kind of calculation I gotta do to send the user in the correct direction?...and possibly even set up a variable on how strong the effect is?