Some code on the console will raise "Illegal call to 'Script.Wait()' outside main loop!"
📦 What modules are you seeing the problem on?
ScriptHookVDotNet.asi (runtime), ScriptHookVDotNet3.dll (v3 SDK/API)
🛠️ SHVDN Version
v3.7.0-nightly.3
🎮 Game Version
3174
🐛 Bug Description
When calling some functions like World.CreateVehicle that use Script.Wait or Script.Yield, it will raise an exception saying that we are not in the main loop.
🔄 Steps To Reproduce
Run a line that internally calls Script.Wait, for example:
World.CreateVehicle("prototipo", Game.Player.Character.Position, 0);
📄 Link To Code Example
No response
⚠️ Current Behavior
It raises "Illegal call to 'Script.Wait()' outside main loop!".
🎯 Expected Behavior
It runs the code as expected.
I'm not closing as not planned right now, because the issue has existed since v3.0.0 iirc. The problem is, whether the behavior described in this issue should be changed so the console will wait for how long time Script.Wait calls in the console, when you would encounter the issue almost always by calling methods that internally call Script.Wait and few people would bother to call it explicitly.