local state = {} local x = {} local z = {} function chopping_fools_legs_init(e) state[e] = "init" CollisionOff(e) Hide(e) end function chopping_fools_legs_main(e) if z[e] == nil then for a = e-50, e+50 do if g_Entity[a] ~= nil then if GetDistance(e,a) < 120 then if weapon_name[a] == "chopping zombie" then z[e] = a break end end end end else if state[e] == "init" then if dead[z[e]] == 0 then SetPosition(e,g_Entity[z[e]]['x'],g_Entity[z[e]]['y']+20,g_Entity[z[e]]['z']) SetRotation(e,60,g_PlayerAngY,0) x[e] = 0 else Show(e) if x[e] < 10 then MoveForward(e,120) x[e] = x[e] + 1 else CollisionOn(e) end end end end end --main function GetDistance(e,v) if g_Entity[e] ~= nil and g_Entity[e] ~= 0 and g_Entity[v] ~= nil then local disx = g_Entity[e]['x'] - g_Entity[v]['x'] local disy = g_Entity[e]['y'] - g_Entity[v]['y'] local disz = g_Entity[e]['z'] - g_Entity[v]['z'] return math.sqrt(disx^2 + disy^2 + disz^2) end end