Source 2 · C++ · SourcePawn
Direct access
to Source 2.
No compromises.
A plugin platform for Counter-Strike 2 that keeps you at engine level. Schema-based entities, game hooks, KHook detours and native events — in C++ or SourcePawn, on one API, with nothing between your code and the game.
- Language
- C++ & SourcePawn
- Runs on
- MetaMod:Source
- Target
- Counter-Strike 2
- Overhead
- Near-native
01 — Capabilities
Built for engine-level development, not scripting
Every subsystem is a thin, deliberate layer over the engine, and all of them ship in the box. Use the high-level API where it saves you time, and drop straight to memory where it does not.
Hooks & game functions
Typed hook points from the core's gamedata, any other function by name, and calls into the game — on the one KHook engine Metamod runs.
Hook points
TakeDamage, CanAcquire, PostThink, movement, jumps, the frame and client callbacks — hooked by the core from its own gamedata, on every call, one entity or a class. A handler and a context, no signature of your own, and a plugin that survives an engine update with a core update.
Any function
Any function by gamedata entry, address, symbol, vtable slot or pattern, hooked the same way and on the one KHook engine Metamod runs, so the core, every plugin and Metamod itself compose correctly.
Calling game functions
Functions described once in gamedata and called by name from C++ and SourcePawn — Source2Mod's SDKCall, through the same object a hook takes.
Memory & addresses
Raw pointers, module handles, GameConfig signatures and resolved engine functions like spawn, set model and take damage.
Entities & schema
Typed classes generated from the schema the game ships, helpers that live in the core, entity I/O and per-viewer visibility.
Schema system
Entities, offsets and fields resolved through the schema the game itself ships — not through headers that rot on the next update.
Schema helpers
Respawn, ChangeTeam, SwitchTeam, Teleport, PrintToCenterHtml and the rest on the classes themselves — served by the core, so a fix to a helper is a core update, not a plugin rebuild.
Entity I/O
Send inputs as a map would, queue delayed ones, and listen to — or block — outputs for one entity, a designer name or all of them.
Transmit
Per-viewer entity visibility: hide players and entities from some clients and not others, owner-following, and a CheckTransmit hook for the rest.
Tracing
Line and hull traces against the world and entities — what a player is looking at, line of sight, and whether a spot is free.
Players & clients
Who is on the server, what they may do, what they hear and what they keep between visits.
Players & targeting
Players by slot, SteamID or name, kick and auth checks, and command targets like @all, @ct or #userid with immunity — the same calls from C++ and SourcePawn.
Permissions
Admins and groups from permissions.json, permission-gated commands, and permissions granted at runtime from your own code.
Client preferences
Per-player settings that survive reconnects and map changes, kept by the core so every plugin reads them the same way.
Sounds
Sound events sent to exactly the players you pick, stopped or re-parametrised by guid, per-player volume channels, and a hook on every sound the game sends.
Commands, ConVars & events
What players and the console type, what the game reports, and what goes over the wire.
Commands & ConVars
Console and chat commands, listeners on commands the game already owns, typed ConVar refs with change callbacks.
ConVar replication
A ConVar value of a player's own with ReplicateConVar, kept there, and the values a client's own cvars have.
Events & GameEvents
A fully typed game event system on top of engine-level events, hooked pre or post with the usual Action vocabulary.
Network messages
Allocate, send and hook Source 2 net messages by numeric ID or by partial name — protobuf included.
Translations, utilities & services
The plumbing every server plugin needs, shipped with the core instead of vendored into each plugin.
Translations
Phrase files per plugin, and every player reads your messages in their own language — formatted per recipient, from C++ or a script.
Maps & GeoIP
The current and next map, map changes, history and map lists, and a player's country from MaxMind.
Scheduler
Timers, repeats and next-frame tasks on the main thread, cleaned up together with your plugin.
Files, KeyValues & paths
Files and folders, KeyValues trees and a streaming parser, and where configs, gamedata and data live — asked for, not hard-coded.
HTTP, JSON & SQL
Async requests through Steam, a JSON value API, and MySQL or SQLite with typed result sets, so you do not vendor three libraries first.
SourcePawn scripting
The same API as a script: .smx files next to native plugins, compiled with spcomp, the include set mirroring the C++ headers.
C++ and SourcePawn
Two languages, one API. Native plugins and SourcePawn scripts load side by side as .smx files, and the script API mirrors the C++ one name for name.
Entity handles
Entities in scripts are handles, not indexes — a removed entity is never mistaken for a new one, and schema fields are methodmap properties.
Function hooks
Hook points and any function described in gamedata, hooked from a script with the same contexts and actions as in C++.
Coming from SourceMod
What carries over unchanged, what Source2Mod does differently, and SourceMod's free natives mapped to Source2Mod's methodmaps.
C++ ↔ SourcePawn interop
Plugins in either language share code: natives, libraries, forwards and handles, in both directions.
Natives from C++
A C++ plugin hands scripts natives, a library and handle types of its own, exactly as a SourceMod extension does.
Scripts from C++
Call a script's natives and global forwards by name, hook its forwards, follow its libraries — typed calls, refused cleanly when the script is gone.
Natives & forwards
Natives, libraries, optional natives, global and private forwards between scripts — SourceMod's model, where load order does not matter.
02 — Documentation
Pick the part of the engine you are working on
Guides for every subsystem, a reference generated from the SDK headers, and the full schema of the game — each with a sidebar of its own. Below them, every guide sorted into the same groups as the capabilities, and the topics that explain how it all fits together.
By capability
Hooks & game functions
Entities & schema
Commands, ConVars & events
Menus & HUD
Translations, utilities & services
SourcePawn scripting
Topics
How things work, rather than how to do one thing — worth a read before the guides.
- Plugin lifecycleWhen plugins load and unload, and what the core cleans up for you.
- CompatibilityThe stable and raw tiers, interface revisions and the plugin API version.
- GamedataThe gamedata folder, its JSON format and how files are merged.
- Writing handlersContexts, HookReturn, the three actions and calling the original.
- Schema fieldsWhen a change reaches clients on its own, and when it needs NetworkStateChanged.
- Entity handlesWhy a script's entity is a handle, not an index.
- How the C++ API mapsInterfaces, schema classes and hooks as they look from a .sp.
- EventsGame events, listener callbacks, hook points and entity outputs — which is which.
- Net messagesNetwork and user messages in Source 2, by id and by name.
- SDK dependenciesWhere the SDK gets s2sdk, and keeping KHook on the core's commit.
- Coming from CounterStrikeSharpThe same concepts side by side, and a full plugin ported.
- C++ for C# developersPointers and lifetimes, strings, lambdas and collections, explained from C#.
03 — In practice
The same API you would have written yourself
Work like you are inside the engine
Controllers, pawns and schema fields are generated from the game itself. Read and write them exactly like native code — with or without automatic SetStateChanged.
- Schema-based access
- Automatic networking
- Zero wrappers
04 — Quickstart
Three steps to a loaded plugin
- 01
Install MetaMod:Source
Source2Mod loads through MetaMod. Drop it into /game/csgo/ and register it in gameinfo.gi.
Game csgo/addons/metamod - 02
Drop in Source2Mod
Extract the release and copy the /addons directory into your server /game/csgo/ folder.
/game/csgo/addons/source2mod - 03
Verify and build
Restart the server, confirm Source2Mod and your plugins are loaded, then write against the API in C++ or SourcePawn.
s2m list
Stop fighting the engine. Start using it.
Open source, actively developed, and built by people running real servers.