[CRASH] Using physenv on PlayerSpawn/PlayerInitialSpawn/Autorun

I was recently trying to adjust some settings on the physics but it seems that when its used on autorun or anything before the client hasnt really spawned its causing a crash due to a invalid pointer.

Heres what I got from the debugger

client.dll
RVA: 241CE9



62521CE3    8B0D 7C548362   mov ecx, dword ptr ds:[6283547C]
62521CE9    8B01            mov eax, dword ptr ds:[ecx]              ; VTable pointer, ECX = 0
62521CEB    8B80 E8000000   mov eax, dword ptr ds:[eax+E8]           ; Index (E8 / 4)
62521CF1    8D5424 18       lea edx, dword ptr ss:[esp+18]
62521CF5    52              push edx
62521CF6    FFD0            call eax                                 ; Not sure what the function is, didnt bother.


And here the lua code

[lua]
physenv.SetPerformanceSettings( { MaxVelocity = 9999 } )
physenv.SetAirDensity(0.3)
[/lua]

As it seems this is initialized somewhen later, however could be a easy thing to fix.

Edit: Also crashing on the Beta

Edit 2: Found some work around that isnt using PlayerInitialSpawn or any hooks.

[lua]
hook.Add(“Think”, “Test”, function()
physenv.SetPerformanceSettings( { MaxVelocity = 9999 } )
physenv.SetAirDensity(0.3)

print("OMG")
hook.Remove("Think", "Test")

end)
[/lua]

Think is only called when the player is really ingame, so this would be a good start for doing something like this maybe:

[lua]
if CLIENT then

hook.Add(“Think”, “LocalPlayerSpawn”, function()
hook.Call(“LocalPlayerSpawn”, GAMEMODE)
hook.Remove(“Think”, “LocalPlayerSpawn”)
end)

end[/lua]

Shouldn’t this go in lua scripting/binary modules/help & support.

Yea I misplaced it, however theres no option to move it on my own.