Try this:
I might have messed up your checks with the flags, buttons, and oldbuttons when I tried to optimize them.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
new jumpnum[33] = 0
new bool:dojump[33] = false
new cvar_maxjumps
public plugin_init()
{
register_plugin("MultiJump","1.1","MasI")
cvar_maxjumps = register_cvar("amx_maxjumps","50")
register_forward(FM_PlayerPreThink, "forward_PreThink")
register_forward(FM_PlayerPostThink, "forward_PostThink")
}
public client_putinserver(id)
{
jumpnum[id] = 0
dojump[id] = false
}
public client_disconnect(id)
{
jumpnum[id] = 0
dojump[id] = false
}
public forward_PreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED
new nbut = pev(id, pev_button)
new obut = pev(id, pev_oldbuttons)
new flags = pev(id, pev_flags)
if(nbut & IN_JUMP)
{
if(flags & FL_ONGROUND)
{
jumpnum[id] = 0
}
else if(!(obut & IN_JUMP) && jumpnum[id] < get_pcvar_num(cvar_maxjumps))
{
dojump[id] = true
jumpnum[id]++
}
}
return FMRES_IGNORED
}
public forward_PostThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED
if(dojump[id] == true)
{
new Float:velocity[3]
pev(id, pev_velocity, velocity)
velocity[2] = random_float(265.0,285.0)
set_pev(id, pev_velocity, velocity)
dojump[id] = false
}
return FMRES_IGNORED
}
__________________