I encountered a major problem, when I have the jump plugin (double step and double jump) and the weapon mod v0.8 running at the same time.
Initially the double jump and double steps don’t work.
But then I realized, if I pull the trigger from the assault cannon (primary or secondary fire – turning or firing – doesn’t matter), the jump plugins will work immediately.
Maybe someone here has an idea how to solve this or maybe can help me out with that?
Here’s the assault cannon plugin:
viewtopic.php?f=42&t=784Here’s the code from the jump plugin:
Код:
#include < amxmodx >
#include < engine >
#pragma semicolon 1
#define PLUGIN "UT_DoubleSteps"
#define VERSION "1.5"
#define TMAXUS 0.3 //The amount of time between keystrokes to activate the plugin.
#define TMINUS 0.1
const USEFULL_BUTTONS = IN_JUMP | IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT;
new g_iLastButtonPressed[33];
new Float:g_flLastButtonPressedTime[33];
new g_iDoubleJump[33];
new g_pcvarForceMove, g_pcvarForceJump, g_pcvarForceJumpMove;
public plugin_init()
{
register_plugin( PLUGIN, VERSION, "ConnorMcLeod" );
set_pcvar_string
(
register_cvar(PLUGIN, VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY),
VERSION
);
g_pcvarForceMove = register_cvar("ut_dstep_moveforce", "750.0");
g_pcvarForceJump = register_cvar("ut_djump_jumpforce", "270.0");
g_pcvarForceJumpMove = register_cvar("ut_dstep_jumpforce", "220.0");
}
public client_PostThink(id)
{
static doublejump;
doublejump = g_iDoubleJump[id];
if( doublejump )
{
new Float:velocity[3];
entity_get_vector(id, EV_VEC_velocity, velocity);
if( doublejump & IN_JUMP )
{
velocity[2] += get_pcvar_float(g_pcvarForceJump);
}
else
{
new Float:vector[3], Float:force;
entity_get_vector(id, EV_VEC_v_angle, vector);
if( doublejump & (IN_MOVERIGHT|IN_MOVELEFT) )
{
angle_vector(vector, ANGLEVECTOR_RIGHT, vector);
}
else
{
angle_vector(vector, ANGLEVECTOR_FORWARD, vector);
}
force = doublejump & (IN_BACK|IN_MOVELEFT) ? -get_pcvar_float(g_pcvarForceMove) : get_pcvar_float(g_pcvarForceMove);
velocity[0] = vector[0] * force;
velocity[1] = vector[1] * force;
velocity[2] = get_pcvar_float(g_pcvarForceJumpMove);
}
entity_set_vector(id, EV_VEC_velocity, velocity);
g_iDoubleJump[id] = 0;
}
}
public client_PreThink(id)
{
if( is_user_alive(id) && entity_get_float(id, EV_FL_maxspeed) > 1.0 )
{
static buttons, oldbuttons, newbuttons, Float:flTime, Float:flWait;
if( !(buttons = entity_get_int(id, EV_INT_button) & USEFULL_BUTTONS) )
{
return;
}
oldbuttons = entity_get_int(id, EV_INT_oldbuttons) & USEFULL_BUTTONS;
if( !(newbuttons = buttons & ~oldbuttons) )
{
return;
}
flTime = get_gametime();
flWait = flTime - g_flLastButtonPressedTime[id];
if( flWait >= TMAXUS || flWait <= TMINUS )
{
if( newbuttons && entity_get_int(id, EV_INT_flags) & FL_ONGROUND )
{
g_flLastButtonPressedTime[id] = flTime;
g_iLastButtonPressed[id] = newbuttons;
}
}
else
{
static doublebuttons;
doublebuttons = g_iLastButtonPressed[id] & newbuttons;
if( doublebuttons )
{
if( ~entity_get_int(id, EV_INT_flags) & FL_ONGROUND )
{
if( doublebuttons & IN_JUMP )
{
g_iDoubleJump[id] = IN_JUMP;
g_flLastButtonPressedTime[id] = 0.0;
g_iLastButtonPressed[id] = 0;
}
}
else
{
doublebuttons &= ~IN_JUMP;
if( doublebuttons )
{
g_iDoubleJump[id] = doublebuttons;
g_flLastButtonPressedTime[id] = 0.0;
g_iLastButtonPressed[id] = 0;
}
}
}
}
}
}