Source2Toolkit
Core api

IToolkitApi

IToolkitAPI

Methods

Log(plugin, msg, )

Logs a formatted message with plugin context.

Parameters
  • plugin IToolkitPlugin* — Plugin instance
  • msg const char* — Format string
  • ...

ConPrint(msg)

Prints message to console.

Parameters
  • msg const char*

ConPrintf(fmt, )

Prints formatted message to console.

Parameters
  • fmt const char*
  • ...

AddListener(plugin, pListener)

Registers a toolkit listener.

Parameters
  • plugin IToolkitPlugin* — Owner plugin
  • pListener IToolkitListener* — Listener instance

void* QueryInterface(fn, iface, min)

Queries interface from factory.

Parameters
  • fn CreateInterfaceFn — Factory function
  • iface const char* — Interface name
  • min int — Minimum version (optional)

void* InterfaceSearch(fn, iface, max, ret)

Searches for interface by iterating versions.

Parameters
  • fn CreateInterfaceFn
  • iface const char*
  • max int
  • ret int*

int FormatIface(, maxlength)

Formats interface name with version.

Parameters
  • char iface[]
  • maxlength size_t

CreateInterfaceFn GetEngineFactory(syn)

Parameters
  • syn bool

CreateInterfaceFn GetPhysicsFactory(syn)

Parameters
  • syn bool

CreateInterfaceFn GetFileSystemFactory(syn)

Parameters
  • syn bool

CreateInterfaceFn GetServerFactory(syn)

Parameters
  • syn bool

void* ToolkitFactory(iface, ret, id)

Toolkit interface factory.

Parameters
  • iface const char*
  • ret int*
  • id PluginId*

void* MetaFactory(iface, ret, id)

Metamod interface factory.

Parameters
  • iface const char*
  • ret int*
  • id PluginId*

IToolkitAddresses* Addresses()

Access address/pattern system.

IToolkitCommands* Commands()

Access command system.

IToolkitConVars* ConVars()

Access ConVar system.

IToolkitCustomHud* CustomHud()

Access custom HUD layout system.

IToolkitEntities* Entities()

Access entities and Entity I/O system.

IToolkitEvents* Events()

Access event system.

IToolkitGameConfig* GameConfig()

Access game configuration system.

IToolkitGameSystems* GameSystems()

Access game system registry.

IToolkitHTTP* HTTP()

Access HTTP system.

IToolkitMenus* Menus()

Access menu system.

IToolkitMySQL* MySQL()

Access mysql system.

IToolkitNetworkMessages* NetworkMessages()

Access network messages system.

IToolkitPaths* Paths()

Where the toolkit keeps things on disk.

IToolkitScheduler* Scheduler()

Access scheduler system.

IToolkitTrace* Trace()

Access tracing system.

IToolkitModule* LoadModule(name)

Creates and initialises a module wrapper by name.

Parameters
  • name const char* — Module name without extension (e.g. "server").

IToolkitModule* LoadModuleFromMemory(ptr)

Creates and initialises a module wrapper from an address inside it.

Parameters
  • ptr uintptr_t — Any address that belongs to the target module.

FreeModule(module)

Releases a module previously obtained from LoadModule() / LoadModuleFromMemory().

Parameters
  • module IToolkitModule*

ISource2Server* GetSource2Server()

ISource2ServerConfig* GetSource2ServerConfig()

ISource2GameClients* GetSource2GameClients()

ISource2GameEntities* GetSource2GameEntities()

IVEngineServer2* GetEngineServer()

ICvar* GetCVar()

CSchemaSystem* GetSchemaSystem()

IGameResourceService* GetGameResourceService()

INetworkServerService* GetNetworkServerService()

INetworkSystem* GetNetworkSystem()

INetworkMessages* GetNetworkMessages()

INetworkStringTableContainer* GetNetworkStringTableServer()

IEngineServiceMgr* GetEngineServiceMgr()

IHostStateMgr* GetHostStateMgr()

ILocalize* GetLocalize()

IFileSystem* GetFileSystem()

IGameEventSystem* GetGameEventSystem()

IGameEventManager2* GetGameEventManager()

CGameEntitySystem* GetEntitySystem()

CGlobalVars* GetGlobalVars()

const char* GetBaseDir()

Returns base directory of the server.

size_t Format(buffer, maxlength, format, )

Formats string into buffer.

Parameters
  • buffer char*
  • maxlength size_t
  • format const char*
  • ...

size_t FormatArgs(buffer, maxlength, format, ap)

Formats string using va_list.

Parameters
  • buffer char*
  • maxlength size_t
  • format const char*
  • ap va_list

On this page

IToolkitAPIMethodsLog(plugin, msg, )ConPrint(msg)ConPrintf(fmt, )AddListener(plugin, pListener)void* QueryInterface(fn, iface, min)void* InterfaceSearch(fn, iface, max, ret)int FormatIface(, maxlength)CreateInterfaceFn GetEngineFactory(syn)CreateInterfaceFn GetPhysicsFactory(syn)CreateInterfaceFn GetFileSystemFactory(syn)CreateInterfaceFn GetServerFactory(syn)void* ToolkitFactory(iface, ret, id)void* MetaFactory(iface, ret, id)IToolkitAddresses* Addresses()IToolkitCommands* Commands()IToolkitConVars* ConVars()IToolkitCustomHud* CustomHud()IToolkitEntities* Entities()IToolkitEvents* Events()IToolkitGameConfig* GameConfig()IToolkitGameSystems* GameSystems()IToolkitHTTP* HTTP()IToolkitMenus* Menus()IToolkitMySQL* MySQL()IToolkitNetworkMessages* NetworkMessages()IToolkitPaths* Paths()IToolkitScheduler* Scheduler()IToolkitTrace* Trace()IToolkitModule* LoadModule(name)IToolkitModule* LoadModuleFromMemory(ptr)FreeModule(module)ISource2Server* GetSource2Server()ISource2ServerConfig* GetSource2ServerConfig()ISource2GameClients* GetSource2GameClients()ISource2GameEntities* GetSource2GameEntities()IVEngineServer2* GetEngineServer()ICvar* GetCVar()CSchemaSystem* GetSchemaSystem()IGameResourceService* GetGameResourceService()INetworkServerService* GetNetworkServerService()INetworkSystem* GetNetworkSystem()INetworkMessages* GetNetworkMessages()INetworkStringTableContainer* GetNetworkStringTableServer()IEngineServiceMgr* GetEngineServiceMgr()IHostStateMgr* GetHostStateMgr()ILocalize* GetLocalize()IFileSystem* GetFileSystem()IGameEventSystem* GetGameEventSystem()IGameEventManager2* GetGameEventManager()CGameEntitySystem* GetEntitySystem()CGlobalVars* GetGlobalVars()const char* GetBaseDir()size_t Format(buffer, maxlength, format, )size_t FormatArgs(buffer, maxlength, format, ap)