Hello guys, i'm trying to make the old bunnyhop enabler make the player go faster than it does currently.
PHP Code:
#include <amxmodx>
#include <engine>
#define FL_WATERJUMP (1<<11) // player jumping out of water
#define FL_ONGROUND (1<<9) // At rest / on the ground
public plugin_init()
{
register_plugin("Super Bunny Hopper", "1.2", "Cheesy Peteza")
}
public client_PreThink(id)
{
entity_set_float(id, EV_FL_fuser2, 0.0);
if (entity_get_int(id, EV_INT_button) & 2)
{
new flags = entity_get_int(id, EV_INT_flags);
if (flags & FL_WATERJUMP)
return PLUGIN_CONTINUE;
if (entity_get_int(id, EV_INT_waterlevel) >= 2)
return PLUGIN_CONTINUE;
if (!(flags & FL_ONGROUND))
return PLUGIN_CONTINUE;
new Float:velocity[3];
entity_get_vector(id, EV_VEC_velocity, velocity);
velocity[2] += 250.0;
/* I wrote this - This kind of works, but sometimes it just throws the player to one side or another
if( velocity[ 1 ] > velocity[ 0 ] )
velocity[ 1 ] += ( velocity[ 1 ] > 0 ? 500 : -500 )
else
velocity[ 0 ] += ( velocity[ 0 ] > 0 ? 500 : -500 )
*/
new Float:fVelocity = vector_length( velocity ); // This is the formula according to this https://forums.alliedmods.net/showthread.php?t=91474
//new fSpeed = floatsqroot(floatpower(velocity[0], 2.0) + floatpower(velocity[1], 2.0)) // This is the code used in KZ Plugins
console_print( id, "%f", fVelocity ); // Just debug to know at what speed i'm
// VelocityByAim doesn't do what i need
entity_set_vector(id, EV_VEC_velocity, velocity);
entity_set_int(id, EV_INT_gaitsequence, 6);
}
return PLUGIN_CONTINUE;
}
I want to make it give speed faster. What i wrote does that, but sometimes it just throws the player to one side or another. I don't understand
angles and such things in half-life so i'm pretty sure i'm doing things wrong. I tried VelocityByAim which gives velocity, but the player can't jump after the first jump anymore. What am i missing?
__________________