-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Почему не сохраняются cfg в исходниках noir?
Код вроде правильный
Код вроде правильный
Код:
#include "Settings.h"
#include "..\Source\Main.h"
CSettings* vars = new CSettings();
CSettings::CSettings()
{
GetAllVars();
SetImportantVars();
SetAllVars();
}
CSettings::~CSettings()
{
}
float CSettings::GetVarFloat(LPCTSTR lpAppName, LPCTSTR lpKeyName, float flDefault, LPCTSTR lpFileName)
{
char szBuffer[64];
GetPrivateProfileString(lpAppName, lpKeyName, "", szBuffer, 64, lpFileName);
if (strlen(szBuffer) == 0)
return flDefault;
else
return std::stof(szBuffer);
}
void CSettings::SetVarFloat(LPCTSTR lpAppName, LPCTSTR lpKeyName, float flValue, LPCTSTR lpFileName)
{
char szBuffer[64];
sprintf_s(szBuffer, "%.1f", flValue);
WritePrivateProfileString(lpAppName, lpKeyName, szBuffer, lpFileName);
}
void CSettings::GetAllVars(void)
{
for (int i = 1; i <= MAX_VARS; ++i)
{
char szVars[16];
sprintf_s(szVars, "var%i", i);
get[i] = GetVarFloat("NoirCSGO", szVars, 0.f, "C:\\vars.cfg");
}
if (get[misc_wpnset])
{
for (int j = 1; j <= 64; ++j)
{
w[j].aim_active = GetVarFloat(GetWeaponName(j), "aim.active", 0.f, "C:\\wsettings.cfg");
w[j].aim_hitbox = GetVarFloat(GetWeaponName(j), "aim.hitbox", 0.f, "C:\\wsettings.cfg");
w[j].aim_fov = GetVarFloat(GetWeaponName(j), "aim.fov", 0.f, "C:\\wsettings.cfg");
w[j].aim_speed = GetVarFloat(GetWeaponName(j), "aim.speed", 0.f, "C:\\wsettings.cfg");
w[j].aim_time = GetVarFloat(GetWeaponName(j), "aim.time", 0.f, "C:\\wsettings.cfg");
w[j].aim_delay = GetVarFloat(GetWeaponName(j), "aim.delay", 0.f, "C:\\wsettings.cfg");
w[j].aim_rcs = GetVarFloat(GetWeaponName(j), "aim.rcs", 0.f, "C:\\wsettings.cfg");
w[j].aim_rcs_amount = GetVarFloat(GetWeaponName(j), "aim.rcs_amount", 0.f, "C:\\wsettings.cfg");
w[j].aim_rcs_delay = GetVarFloat(GetWeaponName(j), "aim.rcs_delay", 0.f, "C:\\wsettings.cfg");
w[j].aim_smart = GetVarFloat(GetWeaponName(j), "aim.smart", 0.f, "C:\\wsettings.cfg");
w[j].aim_psilent = GetVarFloat(GetWeaponName(j), "aim.psilent", 0.f, "C:\\wsettings.cfg");
w[j].trigger_active = GetVarFloat(GetWeaponName(j), "trigger.active", 0.f, "C:\\wsettings.cfg");
w[j].trigger_spot = GetVarFloat(GetWeaponName(j), "trigger.spot", 0.f, "C:\\wsettings.cfg");
w[j].trigger_burst = GetVarFloat(GetWeaponName(j), "trigger.burst", 0.f, "C:\\wsettings.cfg");
w[j].trigger_delay = GetVarFloat(GetWeaponName(j), "trigger.delay", 0.f, "C:\\wsettings.cfg");
}
}
}
void CSettings::SetAllVars(void)
{
for (int i = 1; i <= MAX_VARS; ++i)
{
char szVars[16];
sprintf_s(szVars, "var%i", i);
SetVarFloat("NoirCSGO", szVars, get[i], "C:\\vars.cfg");
}
if (get[misc_wpnset])
{
for (int j = 1; j <= 64; ++j)
{
SetVarFloat(GetWeaponName(j), "aim.active", w[j].aim_active, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.hitbox", w[j].aim_hitbox, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.fov", w[j].aim_fov, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.speed", w[j].aim_speed, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.time", w[j].aim_time, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.delay", w[j].aim_delay, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.rcs", w[j].aim_rcs, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.rcs_amount", w[j].aim_rcs_amount, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.rcs_delay", w[j].aim_rcs_delay, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.smart", w[j].aim_smart, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "aim.psilent", w[j].aim_psilent, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "trigger.active", w[j].trigger_active, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "trigger.spot", w[j].trigger_spot, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "trigger.burst", w[j].trigger_burst, "C:\\wsettings.cfg");
SetVarFloat(GetWeaponName(j), "trigger.delay", w[j].trigger_delay, "C:\\wsettings.cfg");
}
}
}
void CSettings::SetImportantVars()
{
get[radar_position_x] = 100.f;
get[radar_position_y] = 100.f;
get[radar_transparency] = 100.f;
get[radar_size] = 200.f;
get[menu_outline_color] = 0.f;
get[menu_outline_color + 1] = 0.f;
get[menu_outline_color + 2] = 0.f;
get[menu_text_color] = 255.f;
get[menu_text_color + 1] = 255.f;
get[menu_text_color + 2] = 255.f;
get[menu_active_color] = 155.f;
get[menu_active_color + 1] = 155.f;
get[menu_active_color + 2] = 155.f;
get[menu_inactive_color] = 50.f;
get[menu_inactive_color + 1] = 50.f;
get[menu_inactive_color + 2] = 50.f;
get[esp_ct_vis_color] = 0.f;
get[esp_ct_vis_color + 1] = 255.f;
get[esp_ct_vis_color + 2] = 0.f;
get[esp_ct_invis_color] = 255.f;
get[esp_ct_invis_color + 1] = 255.f;
get[esp_ct_invis_color + 2] = 255.f;
get[esp_t_vis_color] = 0.f;
get[esp_t_vis_color + 1] = 255.f;
get[esp_t_vis_color + 2] = 0.f;
get[esp_t_invis_color] = 255.f;
get[esp_t_invis_color + 1] = 255.f;
get[esp_t_invis_color + 2] = 255.f;
get[chams_ct_vis_color] = 0.f;
get[chams_ct_vis_color + 1] = 255.f;
get[chams_ct_vis_color + 2] = 0.f;
get[chams_ct_invis_color] = 255.f;
get[chams_ct_invis_color + 1] = 255.f;
get[chams_ct_invis_color + 2] = 255.f;
get[chams_t_vis_color] = 20.f;
get[chams_t_vis_color + 1] = 255.f;
get[chams_t_vis_color + 2] = 0.f;
get[chams_t_invis_color] = 255.f;
get[chams_t_invis_color + 1] = 255.f;
get[chams_t_invis_color + 2] = 255.f;
get[aim_key] = 1.f;
get[trigger_key] = 4.f;
get[esp_key] = 3.f;
}
const char* CSettings::GetWeaponName(int iWeaponID)
{
switch (iWeaponID)
{
default:
return "none";
case Source::WEAPON_DEAGLE:
return "deagle";
case Source::WEAPON_DUALS:
return "duals";
case Source::WEAPON_FIVE7:
return "five7";
case Source::WEAPON_GLOCK:
return "glock";
case Source::WEAPON_AK47:
return "ak47";
case Source::WEAPON_AUG:
return "aug";
case Source::WEAPON_AWP:
return "awp";
case Source::WEAPON_FAMAS:
return "famas";
case Source::WEAPON_G3SG1:
return "g3sg1";
case Source::WEAPON_GALIL:
return "galil";
case Source::WEAPON_M249:
return "m249";
case Source::WEAPON_M4A4:
return "m4a4";
case Source::WEAPON_MAC10:
return "mac10";
case Source::WEAPON_P90:
return "p90";
case Source::WEAPON_UMP45:
return "ump45";
case Source::WEAPON_XM1014:
return "xm1014";
case Source::WEAPON_BIZON:
return "bizon";
case Source::WEAPON_MAG7:
return "mag7";
case Source::WEAPON_NEGEV:
return "negev";
case Source::WEAPON_SAWEDOFF:
return "sawedoff";
case Source::WEAPON_TEC9:
return "tec9";
case Source::WEAPON_TASER:
return "taser";
case Source::WEAPON_USPS:
return "usp";
case Source::WEAPON_MP7:
return "mp7";
case Source::WEAPON_MP9:
return "mp9";
case Source::WEAPON_NOVA:
return "nova";
case Source::WEAPON_P250:
return "p250";
case Source::WEAPON_SCAR20:
return "scar20";
case Source::WEAPON_SG553:
return "sg553";
case Source::WEAPON_SCOUT:
return "scout";
case Source::WEAPON_M4A1S:
return "m4a1s";
case Source::WEAPON_P2000:
return "p2000";
case Source::WEAPON_CZ75:
return "cz75";
case Source::WEAPON_REVOLVER:
return "revolver";
}
}