I want to translate cleo into C ++
but its didnt work
if i remove Sleep(55); then the C key will not be pressed (0x24), but the rest are pressed normally
Code:
{$CLEO .cs}
0000: update_script_to_03dl
while true
wait 0
if and
0AB0: key_pressed 0x02
0AB0: key_pressed 0x52
02D8: actor $PLAYER_ACTOR current_weapon == 24
then
0393: actor $PLAYER_ACTOR perform_animation "PYTHON_FIRE" at 1.337 times_normal_rate
0AB1: @FAKE_KEYPRESS 2 _OFFSET_KEY_ 0x22 _STATE_ 255{fire}
wait 55
0AB1: @FAKE_KEYPRESS 2 _OFFSET_KEY_ 0xC _STATE_ 0{aim}
0AB1: @FAKE_KEYPRESS 2 _OFFSET_KEY_ 0x24 _STATE_ 255{crouch}
0393: actor $PLAYER_ACTOR perform_animation "PYTHON_FIRE" at 1.0 times_normal_rate
end
end
:FAKE_KEYPRESS
2@ = 0xB73458
005A: 2@ += 0@ // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0
C++:
void cbug()
{
while (true)
{
if (autoCbug)
{
if (GetAsyncKeyState(0x52))
{
SetGameKeyState(0x22, 255);
Sleep(55);
SetGameKeyState(0xC, 0);
SetGameKeyState(0x24, 255);
}
}
}
}
but its didnt work
if i remove Sleep(55); then the C key will not be pressed (0x24), but the rest are pressed normally
C++:
void SetGameKeyState(BYTE key, BYTE state)
{
*(uint8_t*)(0xB73458 + key) = state;
}