-
Автор темы
- #1
//FIXED:
я спастил в свой хак ambien dt и вот что получилось/I inserted ambien dt into my cheat and this is what happened:
я не особо разбираюсь в tickbase,буду благодарен за помощь
I don't understand tickbase, I will be grateful for your help
фулл код дт/double tap code:
Hooks::init(hooks.cpp):
MH_Initialize();
MH_CreateHook(pattern::find(PE::GetModule(HASH("engine.dll")), XOR("55 8B EC 81 EC ? ? ? ? 53 56 57 8B 3D ? ? ? ? 8A")), &CL_Move, reinterpret_cast<void**>(&o_CLMove));
MH_CreateHook(pattern::find(PE::GetModule(HASH("client.dll")), XOR("57 8B F9 8B 07 8B 80 ? ? ? ? FF D0 84 C0 75 02")), &ShouldSkipAnimationFrame, NULL);
MH_EnableHook(MH_ALL_HOOKS);
lagrecord:
// use prediction curtime for this.
float curtime = game::TICKS_TO_TIME(g_cl.m_local->m_nTickBase() - g_tickshift.m_tick_to_shift);
я спастил в свой хак ambien dt и вот что получилось/I inserted ambien dt into my cheat and this is what happened:
I don't understand tickbase, I will be grateful for your help
фулл код дт/double tap code:
base(shifting.cpp):
void c_tickshift::handle_doubletap() {
bool no_dt = m_double_tap && g_cl.m_weapon_id != REVOLVER;
if (!no_dt && m_charged) {
m_charge_timer = 0;
m_tick_to_shift = g_cl.goalshift;
}
if (!no_dt) return;
bool can_shoot = g_cl.m_weapon_fire || g_cl.m_weapon->m_flNextPrimaryAttack() <= g_csgo.m_globals->m_curtime - game::TICKS_TO_TIME(14);
if (!m_charged) {
if (m_charge_timer > game::TIME_TO_TICKS(.5)) { // .5 seconds after shifting, lets recharge
m_tick_to_recharge = g_cl.goalshift;
}
else {
if (!g_aimbot.m_target) {
m_charge_timer++;
}
if (g_cl.m_cmd->m_buttons & IN_ATTACK && can_shoot && g_cl.m_weapon_type != WEAPONTYPE_GRENADE) {
m_charge_timer = 0;
}
}
}
/*
if (g_input.GetKeyState(g_menu.main.movement.fakewalk.get())) {
m_charge_timer = 0;
m_charged = false;
}
*/
if (g_cl.m_cmd->m_buttons & IN_ATTACK && can_shoot && m_charged && g_cl.m_weapon_type != WEAPONTYPE_GRENADE && g_cl.m_weapon_id != REVOLVER) {
// shot.. lets shift tickbase back so we can dt.
m_charge_timer = 0;
m_tick_to_shift = g_cl.goalshift;
m_shift_cmd = g_cl.m_cmd->m_command_number;
m_shift_tickbase = g_cl.m_local->m_nTickBase();
//g_aimbot.dt_aim = true;
*g_cl.m_packet = false;
}
if (!m_charged) {
m_charged_ticks = 0;
}
}
void CL_Move(float accumulated_extra_samples, bool bFinalTick) {
if (g_tickshift.m_tick_to_recharge > 0) {
g_tickshift.m_tick_to_recharge--;
g_tickshift.m_charged_ticks++;
if (g_tickshift.m_tick_to_recharge == 0) {
g_tickshift.m_charged = true;
g_aimbot.dt_aim = false;
}
return; // increment ticksforprocessing by not creating any usercmd's
}
o_CLMove(accumulated_extra_samples, bFinalTick);
g_tickshift.m_shifted = false;
if (g_tickshift.m_tick_to_shift > 0) {
g_tickshift.m_shifting = true;
for (; g_tickshift.m_tick_to_shift > 0; g_tickshift.m_tick_to_shift--) {
o_CLMove(accumulated_extra_samples, bFinalTick);
g_tickshift.m_charged_ticks--;
}
g_tickshift.m_charged = false; // were just going to assume. not correct.
g_tickshift.m_shifting = false;
g_tickshift.m_shifted = true;
}
}
createmove and writeusercmd(clientmode.cpp):
bool Hooks::CreateMove(float time, CUserCmd* cmd) {
Stack stack;
bool ret;
// let original run first.
ret = g_hooks.m_client_mode.GetOldMethod< CreateMove_t >(IClientMode::CREATEMOVE)(this, time, cmd);
// called from CInput::ExtraMouseSample -> return original.
if (!cmd->m_command_number)
return ret;
// if we arrived here, called from -> CInput::CreateMove
// call EngineClient::SetViewAngles according to what the original returns.
if (ret)
g_csgo.m_engine->SetViewAngles(cmd->m_view_angles);
// random_seed isn't generated in ClientMode::CreateMove yet, we must set generate it ourselves.
cmd->m_random_seed = g_csgo.MD5_PseudoRandom(cmd->m_command_number) & 0x7fffffff;
if (g_gui.m_open) {
// are we IN_ATTACK?
if (cmd->m_buttons & IN_ATTACK)
cmd->m_buttons &= ~IN_ATTACK;
// are we IN_ATTACK2?
if (cmd->m_buttons & IN_ATTACK2)
cmd->m_buttons &= ~IN_ATTACK2;
}
// get bSendPacket off the stack.
g_cl.m_packet = stack.next().local(0x1c).as< bool* >();
// get bFinalTick off the stack.
g_cl.m_final_packet = stack.next().local(0x1b).as< bool* >();
// invoke move function.
g_cl.OnTick(cmd);
return false;
}
void WriteUsercmd(bf_write* buf, CUserCmd* in, CUserCmd* out) {
static auto WriteUsercmdF = pattern::find(g_csgo.m_client_dll, XOR("55 8B EC 83 E4 F8 51 53 56 8B D9 8B 0D"));
__asm
{
mov ecx, buf
mov edx, in
push out
call WriteUsercmdF
add esp, 4
}
}
bool Hooks::WriteUsercmdDeltaToBuffer(int slot, bf_write* buf, int from, int to, bool isnewcommand) {
if (g_cl.m_processing && g_csgo.m_engine->IsConnected() && g_csgo.m_engine->IsInGame()) {
uintptr_t stackbase;
__asm mov stackbase, ebp;
CCLCMsg_Move_t* msg = reinterpret_cast<CCLCMsg_Move_t*>(stackbase + 0xFCC);
if (g_tickshift.m_tick_to_shift_alternate > 0) {
if (from != -1)
return true;
int32_t new_commands = msg->new_commands;
int Next_Command = g_csgo.m_cl->m_last_outgoing_command + g_csgo.m_cl->m_choked_commands + 1;
int CommandsToAdd = std::min(g_tickshift.m_tick_to_shift_alternate, 16);
g_tickshift.m_tick_to_shift_alternate = 0;
msg->new_commands = CommandsToAdd;
msg->backup_commands = 0;
from = -1;
for (to = Next_Command - new_commands + 1; to <= Next_Command; to++) {
if (!g_hooks.m_client.GetOldMethod< WriteUsercmdDeltaToBuffer_t >(23)(this, slot, buf, from, to, isnewcommand))
return false;
from = to;
}
CUserCmd* last_command = g_csgo.m_input->GetUserCmd(slot, from);
CUserCmd nullcmd;
CUserCmd ShiftCommand;
if (last_command)
nullcmd = *last_command;
ShiftCommand = nullcmd;
ShiftCommand.m_command_number++;
ShiftCommand.m_tick += 100;
for (int i = new_commands; i <= CommandsToAdd; i++) {
WriteUsercmd(buf, &ShiftCommand, &nullcmd);
nullcmd = ShiftCommand;
ShiftCommand.m_command_number++;
ShiftCommand.m_tick++;
}
}
}
return g_hooks.m_client.GetOldMethod< WriteUsercmdDeltaToBuffer_t >(23)(this, slot, buf, from, to, isnewcommand);
}
runcommand(prediction.cpp):
void Hooks::RunCommand(Entity* ent, CUserCmd* cmd, IMoveHelper* movehelper) {
if (!ent || ent->index() != g_csgo.m_engine->GetLocalPlayer())
return g_hooks.m_prediction.GetOldMethod< RunCommand_t >(CPrediction::RUNCOMMAND)(this, ent, cmd, movehelper);
if (cmd->m_tick >= (g_cl.m_tick + int(1 / g_csgo.m_globals->m_interval) + 8)) {
cmd->m_predicted = true;
return;
}
// get player pointer.
Player* player = (Player*)ent;
// backup variables.
int backup_tickbase = player->m_nTickBase();
float backup_curtime = g_csgo.m_globals->m_curtime;
// fix tickbase when shifting.
if (cmd->m_command_number == g_tickshift.m_shift_cmd) {
player->m_nTickBase() = game::TIME_TO_TICKS(player->m_flSimulationTime());
++player->m_nTickBase();
g_csgo.m_globals->m_curtime = game::TICKS_TO_TIME(player->m_nTickBase());
}
g_hooks.m_prediction.GetOldMethod< RunCommand_t >(CPrediction::RUNCOMMAND)(this, ent, cmd, movehelper);
// store non compressed netvars.
g_netdata.store();
}
Последнее редактирование: