local me = entity_get_local_player()
if me == nil or not me:is_alive() then return end
local teamnum = me.m_iTeamNum
local ct = teamnum == 3
local t = teamnum == 2
local vx, vy, vz = me.m_vecVelocity.x, me.m_vecVelocity.y, me.m_vecVelocity.z
local p_still = math.sqrt(vx ^ 2 + vy ^ 2) < 5
if not ref.dt:get() and not ref.hideshot:get() then
var.p_state = 8
elseif in_air(me) and me.m_flDuckAmount > 0.7 then
var.p_state = 7 -- air+ducking
elseif in_air(me) then
var.p_state = 6 -- air
elseif ref.slowwalk:get() then
var.p_state = 5 -- slowwalk
elseif t and me.m_flDuckAmount > 0.7 then
var.p_state = 4 -- duck ct
elseif ct and me.m_flDuckAmount > 0.7 then
var.p_state = 3 -- duck t
elseif not p_still then
var.p_state = 2 -- moving
elseif p_still then
var.p_state = 1 -- standing
end