[Feature Request] Add a forward that fires after VScriptServerInit
In order to fetch VScript functions and use them, the script system needs to be initialized. You can do this in OnMapStart but since this calls every map, it's not ideal.
It would be better to have a OnVScriptServerInitPost (suggested name) forward. It should also be late-called when the plugin first loads and the script system is already initialized. That way plugins using this library have a one-stop function to fetch and initialize everything requiring VScript functions.
public void OnPluginStart()
{
// Script system might not be initialized when this calls e.g. on server start.
}
public void OnVScriptServerInitPost()
{
// Script system is guaranteed to be initialized here.
VScriptFunction hScriptGetSubType = VScript_GetClassFunction("CBaseCombatWeapon", "GetSubType");
if (hScriptGetSubType)
g_hSDKCallGetSubType = hScriptGetSubType.CreateSDKCall();
}
Ideally I'd like to have it still work during OnPluginStart, which I don't think its possible to do so when extension natives aren't bound during pre OnPluginStart. There is OnAllPluginsLoaded forward which should already do what you wanted to do.
It should also be late-called when the plugin first loads and the script system is already initialized.
Don't think there a direct way to detect that from SP? Could've been checked every frame, but not the most ideal solution.