Osiris icon indicating copy to clipboard operation
Osiris copied to clipboard

Thirdperson key issue (and how to fix)

Open synvy opened this issue 7 years ago • 1 comments

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;
		}
	}
}
``` #

synvy avatar Jan 23 '19 01:01 synvy

I have implemented this using game's time counter instead of WinApi one.

danielkrupinski avatar Jan 23 '19 21:01 danielkrupinski