Game pauses/freezes when running the ScriptHook V code block.
I am using ScriptHookV to code out some feature for GTAV. The code waits for a key-press, and when the key-press (F6) is detected it executes a piece of code that takes approx 1s to run. The problem is that when that 1s code executes, the entire game freezes / pauses until the code is executed. Once the execution is finished, the game continues on as before until the next time F6 is pressed.
I would like to keep the game continue on while that code is executed. Is there a way to do this? I tried using the following code, but it does not change anything at all:
Do i need to execute the code after key-press as a separate thread or something?
Either run it in a thread using
_beginthreadex, or add some
WAIT(0)s in your function that takes 1 second.