Skip to content

[Feature Request] Add a forward that fires after VScriptServerInit #9

@Mikusch

Description

@Mikusch

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions