PHP Code:
#include <amxmodx>
#include <engine>
#define PLUGIN_NAME "jumpit"
#define PLUGIN_VERSION "v.1.2"
#define PLUGIN_AUTHOR "dajrokan"
new Float:XY = 250.0
new Float:Z = 270.0
new Float:tposs
new Float:jorig[3]
new Float:corig[3]
new Float:stack
new Float:counter
new lj = false
public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SERVER)
register_menucmd(register_menuid("\rJump It!"), 1023, "action_jump")
register_clcmd("say /jumpit", "display_jump", 0, " - velocity jump menu")
return PLUGIN_CONTINUE
}
public client_PreThink(id) {
new Float:vec[3]
new jmp[10], dck[10], fwd[10], bck[10], lft[10], rgh[10], b = 1
entity_get_vector(id, EV_VEC_velocity, vec)
vec[2] = 0.0
vec[0] = vector_length(vec)
if (lj) {
if (vec[0] < 180.0) {
lj = false
if (tposs > 1.0)
client_print(0, print_chat, "Last tracking: %.1f units", tposs)
} else {
stack += vec[0]
counter += 1.0
tposs = (((stack / counter) - 202) * 0.75) + 180
entity_get_vector(id, EV_VEC_origin, corig)
set_hudmessage(255, 255, 255, -1.0, 0.0, 0, 0.0, 0.1, 0.0, 0.0, 1)
show_hudmessage(id, "Speed [xy]: %.1f px/s | AV: %.1f px/sec^nTracking possibility: %.1f u.", vec[0], stack / counter, tposs)
}
} else {
set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 0.0, 0.1, 0.0, 0.0, 1)
show_hudmessage(id, "Speed [xy]: %.1f px/s^nJump statistic: N/A", vec[0])
}
if(get_user_button(id) & IN_MOVELEFT)
lft = "<= LEFT"
else {
lft = " "
b = 0
}
if(get_user_button(id) & IN_MOVERIGHT)
rgh = "RIGHT =>"
else {
rgh = " "
b = 0
}
if (b)
set_hudmessage(255, 0, 0, -1.0, 0.15, 0, 0.0, 0.1, 0.0, 0.0, 2)
else
set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 0.0, 0.1, 0.0, 0.0, 2)
show_hudmessage(id, "%s %s", lft, rgh)
if(get_user_button(id) & IN_JUMP) {
jmp = "^^JUMP^^"
if (!lj && !(get_user_oldbutton(id) & IN_JUMP)) {
counter = 0.0
stack = 0.0
tposs = 0.0
entity_get_vector(id, EV_VEC_origin, jorig)
lj = true
}
} else
jmp = ""
if(get_user_button(id) & IN_DUCK)
dck = "_duck_"
else
dck = ""
set_hudmessage(255, 0, 255, -1.0, 0.10, 0, 0.0, 0.1, 0.0, 0.0, 3)
show_hudmessage(id, "^n%s^n%s", jmp, dck)
if(get_user_button(id) & IN_FORWARD)
fwd = "/FORWARD\ "
else
fwd = ""
if(get_user_button(id) & IN_BACK)
bck = "\BACK/"
else
bck = ""
set_hudmessage(255, 255, 255, -1.0, 0.10, 0, 0.0, 0.1, 0.0, 0.0, 4)
show_hudmessage(id, "%s^n^n^n%s", fwd, bck)
}
public action_jump(id, key) {
switch (key) {
case 0: Z += 1.0
case 1: Z -= 1.0
case 2: XY += 1.0
case 3: XY -= 1.0
case 4: jump(id)
default: return PLUGIN_HANDLED
}
display_jump(id)
return PLUGIN_HANDLED
}
public display_jump(id) {
new menuBody[512]
new keys = (1<<9)
new key = 0
new len = format(menuBody,511, "\rJump It!\w^n^n")
keys |= (1<<key)
key++
len += format(menuBody[len],511-len,"%d. + Z velocity^n", key)
keys |= (1<<key)
key++
len += format(menuBody[len],511-len,"%d. - Z velocity^n", key)
keys |= (1<<key)
key++
len += format(menuBody[len],511-len,"%d. + XY velocity^n", key)
keys |= (1<<key)
key++
len += format(menuBody[len],511-len,"%d. - XY velocity^n \dZ (normal 270.0, bhop 230.0): %.1f px/sec | XY: %.0f px/sec\w^n^n", key, Z, XY)
keys |= (1<<key)
key++
len += format(menuBody[len],511-len,"%d. Jump!^n^n0. Exit", key)
show_menu(id, keys, menuBody)
return PLUGIN_HANDLED
}
public jump(id) {
new Float:vec[3], Float:norm[3]
entity_get_vector(id, EV_VEC_v_angle, vec)
norm[2] = Z
norm[1] = floatsin(vec[1], degrees) * XY
norm[0] = floatcos(vec[1], degrees) * XY
entity_set_vector(id, EV_VEC_velocity, norm)
return PLUGIN_CONTINUE
}