local ctx = new_class()
:struct 'helpers' {
condition = 1,
onground_ticks2 = 0,
on_ground = function (self,indx,limit) onground = bit.band(indx.m_fFlags,1) if onground == 1 then self.onground_ticks2 = self.onground_ticks2 + 1 else self.onground_ticks2 = 0 end return self.onground_ticks2 > limit end,
velocity = function(self,indx) local vel = indx.m_vecVelocity local velocity = math.sqrt(vel.x * vel.x + vel.y * vel.y) return velocity end,
is_crouching = function (self,indx) return indx.m_flDuckAmount > 0.8 end
}
local run = new_class()
:struct 'setup_command' {
condition_get = function (self)
me = entity.get_local_player()
local weapon = me:get_player_weapon()
local is_knife = weapon ~= nil and weapon:get_classname() == "CKnife"
if ctx.helpers:is_crouching(me) and not ctx.helpers:on_ground(me,8) and not is_knife then
ctx.helpers.condition = 4
elseif is_knife then
ctx.helpers.condition = 7
elseif not ctx.helpers:on_ground(me,8) and not is_knife then
ctx.helpers.condition = 3
elseif references.slowwalk:get() and not is_knife then
ctx.helpers.condition = 6
elseif ctx.helpers:on_ground(me,8) and ctx.helpers:is_crouching(me) and not is_knife then
ctx.helpers.condition = 5
elseif ctx.helpers:on_ground(me,8) and ctx.helpers:velocity(me) > 3 and not is_knife then
ctx.helpers.condition = 2
elseif ctx.helpers:on_ground(me,8) and ctx.helpers:velocity(me) < 3 and not is_knife then
ctx.helpers.condition = 1
end
return ctx.helpers.condition
end
}
events.createmove:set(function(cmd)
run.setup_command:condition_get(cmd)
end)