Counter-Strike 2 includes CS_Script (a JavaScript-based scripting system that provides access to game entities, events, and functionality. The s2sdk plugin enables Plugify language modules to integrate with CS_Script by exposing Valve's module resolver, allowing you to use both Plugify plugins and Valve's CS_Script system together.
For more information about Valve's CS_Script system, see:
Instead, use the OnEntityCreated listener to detect when the point_script entity is created, then dynamically import CS_Script modules:
// ✅ This works - import after point_script is created
import("cs_script/point_script").then(point_script => {
const { Instance } = point_script;
// Now you can use CS_Script functionality
});
While full CS_Script integration is JavaScript-specific, other languages can detect when CS_Script becomes available:
c#
python
c++
using Plugify;
using static s2sdk.s2sdk;
public unsafe class Sample : Plugin
{
public void OnPluginStart()
{
OnEntityCreated_Register(OnEntityCreatedCallback);
}
public void OnPluginEnd()
{
OnEntityCreated_Unregister(OnEntityCreatedCallback);
}
private static void OnEntityCreatedCallback(int entityHandle)
{
string className = GetEntityClassname(entityHandle);
if (className == "point_script")
{
PrintToServer("CS_Script system is now available!\n");
// You can now interact with the point_script entity
}
}
}
from plugify.plugin import Plugin
from plugify.pps import s2sdk as s2
class Sample(Plugin):
def plugin_start(self):
s2.OnEntityCreated_Register(self.on_entity_created)
def plugin_end(self):
s2.OnEntityCreated_Unregister(self.on_entity_created)
@staticmethod
def on_entity_created(entity_handle):
class_name = s2.GetEntityClassname(entity_handle)
if class_name == "point_script":
s2.PrintToServer("CS_Script system is now available!\n")
#include <plugify/cpp_plugin.hpp>
#include "s2sdk.hpp"
using namespace s2sdk;
class Sample : public plg::IPluginEntry {
public:
void OnPluginStart() override {
OnEntityCreated_Register(OnEntityCreatedCallback);
}
void OnPluginEnd() override {
OnEntityCreated_Unregister(OnEntityCreatedCallback);
}
private:
static void OnEntityCreatedCallback(int entityHandle) {
auto className = GetEntityClassname(entityHandle);
if (className == "point_script") {
PrintToServer("CS_Script system is now available!\n");
}
}
};