With scripthookv2 it comes with a dinput8.dll file but according to "Unknown Error FFFFFFFF Fix" the requirements for it suggest to use "Ultimate ASI loader" https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases which of the .dll files should I use? Thanks a bunch!
Nevermind, used the one required by Ultimate ASI loader and it works perfectly, no more random lag. Thank you very much!