Hello everyone!
Well I have clean csgosimple source ... I added configmanager ( load & save configs ), all works great! But after some time I add aimbot ... and just with aimbot settings I have problems ( because I take them from std::map ). Maybe someone can help me with that ? I will thank you very much.

Here is the code:

options.hpp

Code:
#pragma once
#include <string>
#include <map>
#include <unordered_map>
#include "valve_sdk/Misc/Color.hpp"
#include <limits>

#define OPTION(type, var, val) type var = val



struct aimbot_settings                            < ------------ Aimbot structure
{
	bool enabled;
	bool friendlyfire = false;
	bool autopistol = false;
	bool check_smoke = false;
	bool check_flash = false;
	bool autowall = false;
	bool silent = false;
	bool rcs = false;
	bool rcs_fov_enabled = false;
	bool rcs_smooth_enabled = false;
	bool humanize = false;
	struct 
	{
	bool enabled = false; int ticks = 6;
	} backtrack;
	bool only_in_zoom = true;
	int aim_type = 1;
	int priority = 0;
	int fov_type = 0;
	int rcs_type = 0;
	int hitbox = 1;
	float fov = 0.f;
	float silent_fov = 0.f;
	float rcs_fov = 0.f;
	float smooth = 1;
	float rcs_smooth = 1;
	int shot_delay = 0;
	int kill_delay = 0;
	int rcs_x = 100;
	int rcs_y = 100;
	int rcs_start = 1;
	int min_damage = 1;
};


class Config
{
public:
	// 
	// ESP
	// 
	OPTION(bool, esp_enabled, false);                      <----- NO PROBLEMS HERE
	OPTION(bool, esp_enemies_only, false);
        etc ......

	//
	//AIM
	//
	std::map<int, aimbot_settings> aimbot = {};     <------ HERE IS THE PROBLEM
};

extern Config g_Options;
extern bool   g_Save;
extern bool   g_Load;

Here is my options.cpp

Code:
#include "options.hpp"

Config g_Options;
bool   g_Save = false;
bool   g_Load = false;

Here is configmanager.cpp

Code:
#include "configmanager.h"
#include "options.hpp"
#include "valve_sdk/misc/Color.hpp"
#include "valve_sdk/csgostructs.hpp"


void CConfig::SetupValue(int &value, int def, std::string category, std::string name)
{
	value = def;
	ints.push_back(new ConfigValue< int >(category, name, &value));
}

void CConfig::SetupValue(float& value, float def, std::string category, std::string name)
{
	value = def;
	floats.push_back(new ConfigValue< float >(category, name, &value));
}


void CConfig::SetupValue(bool& value, bool def, std::string category, std::string name)
{
	value = def;
	bools.push_back(new ConfigValue< bool >(category, name, &value));
}

void CConfig::SetupValue(char &value, char def, std::string category, std::string name)
{
	value = def;
	chars.push_back(new ConfigValue< char >(category, name, &value));
}




void CConfig::Setup()
{
	//ESP
	SetupValue(g_Options.esp_enabled, false, "ESP", "esp_enabled"); < ----------- NO PROBLEM HERE ( Save and Load )
        etc ..........

}



void CConfig::SetupAimbotSettings()
{
		int guns[] = {
		WEAPON_DEAGLE,
		WEAPON_ELITE,
		WEAPON_FIVESEVEN,
                etc ......

 };


	for (int i = 0; i < _countof(guns); i++)
	{
		SetupValue(g_Options.aimbot[guns[i]].enabled, false, ::std::string("legit_", guns[i]), "enabled");    < --------- HERE IS PROBLEM
                etc .....
	}
}
Here is configmanager.h

Code:
class CConfig
{
protected:
	std::vector< ConfigValue< int >* > ints;
	std::vector< ConfigValue< bool >* > bools;
	std::vector< ConfigValue< float >* > floats;
	std::vector< ConfigValue< char >* > chars;


private:

	void SetupValue(int&, int, std::string, std::string);
	void SetupValue(bool&, bool, std::string, std::string);
	void SetupValue(float&, float, std::string, std::string);
	void SetupValue(char&, char, std::string, std::string);
	void SetupValueC(Color& color, Color def, std::string category, std::string name);
	

public:
	CConfig()
	{
		Setup();
		SetupAimbotSettings();

	}
	
	
	void Setup();
	void SetupAimbotSettings();
	void Save(std::string cfg);
	void Load(std::string cfg);
};

extern CConfig* cConfigManager;
When I try to inject my cheat with aimbot settings enabled - SetupAimbotSettings(); - Cheat is crashing ...

Here is the screen with call stack:
https://ibb.co/1fRgbjs

Please someone help me ... I'll be very grateful ! Thank you very much !!!