Osiris
Osiris copied to clipboard
Thirdperson key issue (and how to fix)
The way you did the third person key is... well it's buggy as shit.
Your code:
static bool isInThirdperson{ true };
if (GetAsyncKeyState(config.visuals.thirdpersonKey))
isInThirdperson = !isInThirdperson;
My code (doesn't spam the key like crazy when trying to press it):
static bool active = false;
static size_t lastTime = 0;
if (g_Vars.Effects.Other.forceThirdPerson) {
if (GetAsyncKeyState(g_Vars.Effects.Other.thirdPersonKey)) {
if (GetTickCount() > lastTime) {
active = !active;
lastTime = GetTickCount() + 650;
}
}
}
``` #
I have implemented this using game's time counter instead of WinApi one.