Official site anti-cheat Ultra Core Protector

Home Download F.A.Q. Addons Monitor Forum Support Advertise English version site UCP Anti-Cheat  Russian version site UCP Anti-Cheat
Ultra Core Protector - is the client-server anti-cheat freeware, for server protection from unscrupulous players.

Abilities Supported games  
Half-Life
Condition Zero
Counter-Strike 1.6
Day of Defeat
Adrenaline Gamer
Team Fortress Classic
Counter-Strike Source
MU Online
Ragnarok Online
Half-Life 2 Deathmatch
Adrenaline Gamer 2
Team Fortress 2
A less autistic way of writing this?

Hey so, just been doing nothing in particular recently so I decided to clean some shit up. Therefore, was wondering a better way of doing the following;

void Manager::saving()
{
if (g_Save)
{
if (g_Options.selected_config_index == 0)
{
std::ofstream ofs("hvh_pistol", std::ios::binary);
ofs.write((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 1)
{
std::ofstream ofs("hvh_auto", std::ios::binary);
ofs.write((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 2)
{
std::ofstream ofs("hvh_scout", std::ios::binary);
ofs.write((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 3)
{
std::ofstream ofs("hvh_awp", std::ios::binary);
ofs.write((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 4)
{
std::ofstream ofs("hvh_deagle", std::ios::binary);
ofs.write((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 5)
{
std::ofstream ofs("hvh_revolver", std::ios::binary);
ofs.write((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 6)
{
std::ofstream ofs("hvh_rifle", std::ios::binary);
ofs.write((char*)&g_Options, sizeof(g_Options));
}

g_Save = false;
}
}

void Manager::loading()
{
if (g_Load)
{
if (g_Options.selected_config_index == 0)
{
std::ifstream ifs("hvh_pistol", std::ios::binary);
ifs.read((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 1)
{
std::ifstream ifs("hvh_auto", std::ios::binary);
ifs.read((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 2)
{
std::ifstream ifs("hvh_scout", std::ios::binary);
ifs.read((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 3)
{
std::ifstream ifs("hvh_awp", std::ios::binary);
ifs.read((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 4)
{
std::ifstream ifs("hvh_deagle", std::ios::binary);
ifs.read((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 5)
{
std::ifstream ifs("hvh_revolver", std::ios::binary);
ifs.read((char*)&g_Options, sizeof(g_Options));
}
else if (g_Options.selected_config_index == 6)
{
std::ifstream ifs("hvh_rifle", std::ios::binary);
ifs.read((char*)&g_Options, sizeof(g_Options));
}

g_Load = false;
}
}

Not looking for paste or anything, I would appreciate some links that I can read up on.

I personally made an aimbot override system where every weapon uses global settings unless the user creates an override for it, which are all stored in a map sorted by ItemDefinitionIndex. Then in my config loading/saving I do a for each to store overrides recursively in the json to produce something like this:

"Overrides" : {
"0" : {
"AimKey" : 6,
"AimStep" : true,
"AutoCrouch" : false,
"AutoFire" : true,
"AutoScope" : false,
"AutoSlow" : false,
"Autowall" : true,
"Backtrack" : true,
"BodyBullet" : 0,
"BodyHP" : 0.0,
"DrawFov" : false,
"DrawSpread" : false,
"FOV" : 5.0,
"FriendlyFire" : false,
"HitChance" : false,
"HitChanceAmt" : 0.0,
"Hitboxes" : {
"arms" : false,
"arms_edge" : false,
"chest" : false,
"chest_edge" : false,
"feet" : false,
"feet_edge" : false,
"head" : true,
"head_edge" : false,
"legs" : false,
"legs_edge" : false,
"neck" : true,
"neck_edge" : false,
"pelvis" : true,
"pelvis_edge" : false
},
"MinDamage" : 10.0,
"OnKey" : true,
"Override" : true,
"RCS" : 0,
"SilentAim" : false,
"Speed" : 0.5,
"TargetMethod" : 0,
"VeloPrediction" : false
},
"1" : {
"AimKey" : 6,
"AimStep" : true,
"AutoCrouch" : false,
"AutoFire" : true,
"AutoScope" : false,
"AutoSlow" : false,
"Autowall" : true,
"Backtrack" : true,
"BodyBullet" : 0,
"BodyHP" : 0.0,
"DrawFov" : false,
"DrawSpread" : false,
"FOV" : 5.0,
"FriendlyFire" : false,
"HitChance" : false,
"HitChanceAmt" : 33.478000640869141,
"Hitboxes" : {
"arms" : false,
"arms_edge" : false,
"chest" : false,
"chest_edge" : false,
"feet" : false,
"feet_edge" : false,
"head" : true,
"head_edge" : false,
"legs" : false,
"legs_edge" : false,
"neck" : false,
"neck_edge" : false,
"pelvis" : false,
"pelvis_edge" : false
},
"MinDamage" : 10.0,
"OnKey" : true,
"Override" : true,
"RCS" : 0,
"SilentAim" : false,
"Speed" : 1.0,
"TargetMethod" : 0,
"VeloPrediction" : false
},
"10" : {
"AimKey" : 6,
"AimStep" : true,
"AutoCrouch" : false,
"AutoFire" : true,
"AutoScope" : false,
"AutoSlow" : false,
"Autowall" : true,
"Backtrack" : true,
"BodyBullet" : 0,
"BodyHP" : 0.0,
"DrawFov" : false,
"DrawSpread" : false,
"FOV" : 5.0,
"FriendlyFire" : false,
"HitChance" : false,
"HitChanceAmt" : 0.0,
"Hitboxes" : {
"arms" : false,
"arms_edge" : false,
"chest" : false,
"chest_edge" : false,
"feet" : false,
"feet_edge" : false,
"head" : true,
"head_edge" : false,
"legs" : false,
"legs_edge" : false,
"neck" : true,
"neck_edge" : false,
"pelvis" : true,
"pelvis_edge" : false
},
"MinDamage" : 10.0,
"OnKey" : true,
"Override" : true,
"RCS" : 1,
"SilentAim" : false,
"Speed" : 0.5,
"TargetMethod" : 0,
"VeloPrediction" : false
},
"11" : {
"AimKey" : 6,
"AimStep" : true,
"AutoCrouch" : false,
"AutoFire" : true,
"AutoScope" : false,
"AutoSlow" : false,
"Autowall" : true,
"Backtrack" : true,
"BodyBullet" : 0,
"BodyHP" : 0.0,
"DrawFov" : false,
"DrawSpread" : false,
"FOV" : 5.0,
"FriendlyFire" : false,
"HitChance" : false,
"HitChanceAmt" : 0.0,
"Hitboxes" : {
"arms" : false,
"arms_edge" : false,
"chest" : false,
"chest_edge" : false,
"feet" : false,
"feet_edge" : false,
"head" : true,
"head_edge" : false,
"legs" : false,
"legs_edge" : false,
"neck" : true,
"neck_edge" : false,
"pelvis" : true,
"pelvis_edge" : false
},
"MinDamage" : 10.0,
"OnKey" : true,
"Override" : true,
"RCS" : 1,
"SilentAim" : false,
"Speed" : 0.5,
"TargetMethod" : 0,
"VeloPrediction" : false
},
"13" : {
"AimKey" : 6,
"AimStep" : true,
"AutoCrouch" : false,
"AutoFire" : true,
"AutoScope" : false,
"AutoSlow" : false,
"Autowall" : true,
"Backtrack" : true,
"BodyBullet" : 0,
"BodyHP" : 0.0,
"DrawFov" : false,
"DrawSpread" : false,
"FOV" : 5.0,
"FriendlyFire" : false,
"HitChance" : false,
"HitChanceAmt" : 0.0,
"Hitboxes" : {
"arms" : false,
"arms_edge" : false,
"chest" : false,
"chest_edge" : false,
"feet" : false,
"feet_edge" : false,
"head" : true,
"head_edge" : false,
"legs" : false,
"legs_edge" : false,
"neck" : true,
"neck_edge" : false,
"pelvis" : true,
"pelvis_edge" : false
},
"MinDamage" : 10.0,
"OnKey" : true,
"Override" : true,
"RCS" : 1,
"SilentAim" : false,
"Speed" : 0.5,
"TargetMethod" : 0,
"VeloPrediction" : false
},
"16" : {
"AimKey" : 6,
"AimStep" : true,
"AutoCrouch" : false,
"AutoFire" : true,
"AutoScope" : false,
"AutoSlow" : false,
"Autowall" : true,
"Backtrack" : true,
"BodyBullet" : 0,
"BodyHP" : 0.0,
"DrawFov" : false,
"DrawSpread" : false,
"FOV" : 5.0,
"FriendlyFire" : false,
"HitChance" : false,
"HitChanceAmt" : 0.0,
"Hitboxes" : {
"arms" : false,
"arms_edge" : false,
"chest" : false,
"chest_edge" : false,
"feet" : false,
"feet_edge" : false,
"head" : true,
"head_edge" : false,
"legs" : false,
"legs_edge" : false,
"neck" : true,
"neck_edge" : false,
"pelvis" : true,
"pelvis_edge" : false
},
"MinDamage" : 10.0,
"OnKey" : true,
"Override" : true,
"RCS" : 1,
"SilentAim" : false,
"Speed" : 0.5,
"TargetMethod" : 0,
"VeloPrediction" : false
},
"38" : {
"AimKey" : 6,
"AimStep" : true,
"AutoCrouch" : false,
"AutoFire" : true,
"AutoScope" : false,
"AutoSlow" : false,
"Autowall" : true,
"Backtrack" : true,
"BodyBullet" : 0,
"BodyHP" : 0.0,
"DrawFov" : false,
"DrawSpread" : false,
"FOV" : 5.0,
"FriendlyFire" : false,
"HitChance" : false,
"HitChanceAmt" : 0.0,
"Hitboxes" : {
"arms" : false,
"arms_edge" : false,
"chest" : false,
"chest_edge" : false,
"feet" : false,
"feet_edge" : false,
"head" : true,
"head_edge" : false,
"legs" : false,
"legs_edge" : false,
"neck" : true,
"neck_edge" : false,
"pelvis" : true,
"pelvis_edge" : false
},
"MinDamage" : 10.0,
"OnKey" : true,
"Override" : true,
"RCS" : 1,
"SilentAim" : false,
"Speed" : 0.5,
"TargetMethod" : 0,
"VeloPrediction" : false
},
"39" : {
"AimKey" : 6,
"AimStep" : true,
"AutoCrouch" : false,
"AutoFire" : true,
"AutoScope" : false,
"AutoSlow" : false,
"Autowall" : true,
"Backtrack" : true,
"BodyBullet" : 0,
"BodyHP" : 0.0,
"DrawFov" : false,
"DrawSpread" : false,
"FOV" : 5.0,
"FriendlyFire" : false,
"HitChance" : false,
"HitChanceAmt" : 0.0,
"Hitboxes" : {
"arms" : false,
"arms_edge" : false,
"chest" : false,
"chest_edge" : false,
"feet" : false,
"feet_edge" : false,
"head" : true,
"head_edge" : false,
"legs" : false,
"legs_edge" : false,
"neck" : true,
"neck_edge" : false,
"pelvis" : true,
"pelvis_edge" : false
},
"MinDamage" : 10.0,
"OnKey" : true,
"Override" : true,
"RCS" : 1,
"SilentAim" : false,
"Speed" : 0.5,
"TargetMethod" : 0,
"VeloPrediction" : false
},
etc

It’s not the most optimised system, but it’s pretty cute tbh


 



On xapkmod.com you can find original apk and mod file for games.