mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-07 08:26:34 -08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c7f896189 | ||
|
|
5a354a25e3 | ||
|
|
74ce0d295a | ||
|
|
9c8f25f721 | ||
|
|
4b1a2c427e | ||
|
|
8f59fd5b97 | ||
|
|
cbeac50e4a | ||
|
|
eba7d9c313 |
18
README.md
18
README.md
@@ -1,15 +1,19 @@
|
||||
# CounterStrikeSharp
|
||||
<div align=right>Table of Contents ↗️</div>
|
||||
|
||||
<h1 align=center><code>CounterStrikeSharp</code></h1>
|
||||
|
||||
<div align=center>
|
||||
<a href=https://github.com/roflmuffin/CounterStrikeSharp/releases><img src=https://img.shields.io/github/v/release/roflmuffin/CounterStrikeSharp?style=flat-square&label=latest></a>
|
||||
<a href=https://github.com/roflmuffin/CounterStrikeSharp/releases><img src=https://img.shields.io/github/release-date/roflmuffin/CounterStrikeSharp?style=flat-square&label=last%20release></a>
|
||||
<a href=https://github.com/roflmuffin/CounterStrikeSharp/releases><img src=https://img.shields.io/github/downloads/roflmuffin/CounterStrikeSharp/total.svg?style=flat-square alt=downloads></a>
|
||||
<a href=https://discord.gg/eAZU3guKWU><img src=https://img.shields.io/discord/1160907911501991946?logo=discord&cacheSeconds=3500&style=flat-square alt="chat on discord"></a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
CounterStrikeSharp is a server side modding framework for Counter-Strike 2. This project implements a .NET 8 scripting layer on top of a Metamod Source Plugin, allowing developers to create plugins that interact with the game server in a modern language (C#) to facilitate the creation of maintainable and testable code.
|
||||
|
||||
[Come and join our Discord](https://discord.gg/eAZU3guKWU)
|
||||
|
||||
## History
|
||||
|
||||
This project is an ongoing migration of a previous project (titled [VSP.NET](https://github.com/roflmuffin/vspdotnet)) whereby a scripting layer was added to a Valve Server Plugin for CSGO.
|
||||
|
||||
Due to the architectural changes of CS2, the plugin is being rebuilt on the ground up, to support Linux 64-bit, something which was previously impossible.
|
||||
|
||||
## Install
|
||||
|
||||
Download the latest build from [here](https://github.com/roflmuffin/CounterStrikeSharp/releases). (Download the with runtime version if this is your first time installing).
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
},
|
||||
"CCSPlayerController_ChangeTeam": {
|
||||
"offsets": {
|
||||
"windows": 98,
|
||||
"linux": 97
|
||||
"windows": 100,
|
||||
"linux": 99
|
||||
}
|
||||
},
|
||||
"CCSPlayerController_Respawn": {
|
||||
"offsets": {
|
||||
"windows": 254,
|
||||
"linux": 256
|
||||
"windows": 257,
|
||||
"linux": 259
|
||||
}
|
||||
},
|
||||
"CBasePlayerController_SetPawn": {
|
||||
@@ -71,7 +71,7 @@
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "44 89 4C 24 20 44 88 44 24 18",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 89 D6 41 55 4D 89 C5"
|
||||
"linux": "55 48 89 E5 41 57 41 56 49 89 F6 41 55 4D 89 C5"
|
||||
}
|
||||
},
|
||||
"CBaseModelEntity_SetModel": {
|
||||
@@ -84,26 +84,26 @@
|
||||
"CCSPlayer_WeaponServices_CanUse": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 5C 24 10 48 89 6C 24 18 56 57 41 56 48 83 EC 30 48 8B 01",
|
||||
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 56 48 83 EC 30 48 8B 01",
|
||||
"linux": "55 48 8D 15 ? ? ? ? 48 89 E5 41 55 49 89 FD 41 54 49 89 F4"
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_GiveNamedItem": {
|
||||
"offsets": {
|
||||
"windows": 17,
|
||||
"linux": 18
|
||||
"windows": 19,
|
||||
"linux": 20
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_DropActivePlayerWeapon": {
|
||||
"offsets": {
|
||||
"windows": 18,
|
||||
"linux": 19
|
||||
"windows": 20,
|
||||
"linux": 21
|
||||
}
|
||||
},
|
||||
"CCSPlayer_ItemServices_RemoveWeapons": {
|
||||
"offsets": {
|
||||
"windows": 19,
|
||||
"linux": 20
|
||||
"windows": 21,
|
||||
"linux": 22
|
||||
}
|
||||
},
|
||||
"CGameSceneNode_GetSkeletonInstance": {
|
||||
@@ -115,7 +115,7 @@
|
||||
"CCSGameRules_TerminateRound": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 8B C4 4C 89 48 ? 48 89 48 ? 55 56",
|
||||
"windows": "48 8B C4 4C 89 48 ? 48 89 48 ? 55 41 55",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 81 EC 88 00 00 00 48 8D 05 ? ? ? ?"
|
||||
}
|
||||
},
|
||||
@@ -156,8 +156,8 @@
|
||||
},
|
||||
"CBasePlayerPawn_CommitSuicide": {
|
||||
"offsets": {
|
||||
"windows": 372,
|
||||
"linux": 372
|
||||
"windows": 377,
|
||||
"linux": 377
|
||||
}
|
||||
},
|
||||
"CBasePlayerPawn_RemovePlayerItem": {
|
||||
@@ -169,35 +169,35 @@
|
||||
},
|
||||
"CBaseEntity_Teleport": {
|
||||
"offsets": {
|
||||
"windows": 155,
|
||||
"linux": 154
|
||||
"windows": 157,
|
||||
"linux": 156
|
||||
}
|
||||
},
|
||||
"CBaseEntity_TakeDamageOld": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 89 74 24 20 57 48 83 EC 60 48 8B 41 10",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 83 EC 48 4C 8D 2D ? ? ? ? 49 8B 7D 00 48 85 FF 0F 84 ? ? ? ?"
|
||||
"windows": "48 89 74 24 ? 57 48 81 EC 80 00 00 00 48 8B 41",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 83 EC 58 4C 8D 3D"
|
||||
}
|
||||
},
|
||||
"CBaseTrigger_StartTouch": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "41 56 41 57 48 83 EC 58 48 8B 01",
|
||||
"windows": "40 57 41 57 48 83 EC 28 48 8B 01",
|
||||
"linux": "55 48 89 E5 41 56 49 89 F6 41 55 49 89 FD 41 54 53 BB"
|
||||
}
|
||||
},
|
||||
"CBaseTrigger_EndTouch": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 53 57 41 55 48 83 EC 40",
|
||||
"windows": "40 53 41 55 48 83 EC 28",
|
||||
"linux": "55 BA FF FF FF FF 48 89 E5 41 57 41 56 41 55 49 89 F5 41"
|
||||
}
|
||||
},
|
||||
"StateChanged": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "40 ? 53 56 41 ? 41 ? 48 ? ? ? ? 48 ? ? ? ? ? ? 48 ? ? 45",
|
||||
"windows": "40 55 53 56 41 56 41 57 48 8D 6C 24 ? 48 81 EC 70 01 00 00",
|
||||
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 53 89 D3"
|
||||
}
|
||||
},
|
||||
@@ -230,8 +230,8 @@
|
||||
"IGameSystem_InitAllSystems_pFirst": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"windows": "48 8B 1D ? ? ? ? 48 85 DB 0F 84 ? ? ? ? BE ? ? ? ? 0F 1F 00 48 8B 7B 10",
|
||||
"linux": "4C 8B 35 ? ? ? ? 4D 85 F6 75 2D E9 ? ? ? ? 0F 1F 40 00 48 8B 05"
|
||||
"windows": "48 8B 3D ? ? ? ? 48 85 FF 0F 84 ? ? ? ? BE",
|
||||
"linux": "4C 8B 35 ? ? ? ? 4D 85 F6 75 ? E9"
|
||||
}
|
||||
},
|
||||
"CEntityResourceManifest_AddResource": {
|
||||
|
||||
Submodule libraries/hl2sdk-cs2 updated: f21e0c9d8f...3c7b355da8
@@ -151,27 +151,28 @@ namespace CounterStrikeSharp.API.Core
|
||||
_commandsRegistered = true;
|
||||
}
|
||||
|
||||
if (!File.Exists(_coreConfigPath))
|
||||
if (File.Exists(_coreConfigPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = JsonSerializer.Deserialize<CoreConfigData>(File.ReadAllText(_coreConfigPath),
|
||||
new JsonSerializerOptions() { ReadCommentHandling = JsonCommentHandling.Skip });
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
_coreConfig = data;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to load core configuration, fallback values will be used");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Core configuration could not be found at path \"{CoreConfigPath}\", fallback values will be used.",
|
||||
_coreConfigPath);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var data = JsonSerializer.Deserialize<CoreConfigData>(File.ReadAllText(_coreConfigPath),
|
||||
new JsonSerializerOptions() { ReadCommentHandling = JsonCommentHandling.Skip });
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
_coreConfig = data;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to load core configuration, fallback values will be used");
|
||||
}
|
||||
|
||||
var serverCulture = CultureInfo.GetCultures(CultureTypes.AllCultures)
|
||||
|
||||
@@ -83,6 +83,8 @@ namespace CounterStrikeSharp.API.Core
|
||||
|
||||
internal fxScriptContext m_extContext = new fxScriptContext();
|
||||
|
||||
internal bool isCleanupLocked = false;
|
||||
|
||||
[SecuritySafeCritical]
|
||||
public void Reset()
|
||||
{
|
||||
@@ -101,8 +103,16 @@ namespace CounterStrikeSharp.API.Core
|
||||
[SecuritySafeCritical]
|
||||
public void Invoke()
|
||||
{
|
||||
InvokeNativeInternal();
|
||||
GlobalCleanUp();
|
||||
if (!isCleanupLocked)
|
||||
{
|
||||
isCleanupLocked = true;
|
||||
InvokeNativeInternal();
|
||||
GlobalCleanUp();
|
||||
isCleanupLocked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
InvokeNativeInternal();
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
|
||||
@@ -132,6 +132,7 @@ class UserMessage
|
||||
const CNetMessagePB<google::protobuf::Message>* GetProtobufMessage();
|
||||
INetworkMessageInternal* GetSerializableMessage() { return msgSerializable; }
|
||||
uint64* GetRecipientMask() { return recipientMask; }
|
||||
bool IsManuallyAllocated() { return manuallyAllocated; }
|
||||
|
||||
private:
|
||||
CNetMessagePB<google::protobuf::Message>* msg = nullptr;
|
||||
|
||||
@@ -106,7 +106,7 @@ void VoiceManager::OnClientCommand(CPlayerSlot slot, const CCommand& args)
|
||||
|
||||
if (!pPlayer) return;
|
||||
|
||||
if (args.ArgC() > 1 && stricmp(args.Arg(0), "vban") == 0)
|
||||
if (args.ArgC() > 1 && V_stricmp(args.Arg(0), "vban") == 0)
|
||||
{
|
||||
// clients just refuse to send vban for indexes over 32 and all 4 fields are just the same number, so we only get the first one
|
||||
// for (int i = 1; (i < args.ArgC()) && (i < 3); i++) {
|
||||
|
||||
@@ -620,7 +620,13 @@ static void UserMessageSend(ScriptContext& scriptContext)
|
||||
CRecipientFilter filter{};
|
||||
filter.AddRecipientsFromMask(message->GetRecipientMask() ? *message->GetRecipientMask() : 0);
|
||||
|
||||
globals::gameEventSystem->PostEventAbstract(0, false, &filter, message->GetSerializableMessage(), message->GetProtobufMessage(), 0);
|
||||
// This is for calling send in a UM hook, if calling normal send using the UM instance from the UM hook, it will cause an inifinite loop, then crashing the server
|
||||
static void (IGameEventSystem::*PostEventAbstract)(CSplitScreenSlot, bool, IRecipientFilter*, INetworkMessageInternal*, const CNetMessage*, unsigned long) = &IGameEventSystem::PostEventAbstract;
|
||||
|
||||
if (message->IsManuallyAllocated())
|
||||
globals::gameEventSystem->PostEventAbstract(0, false, &filter, message->GetSerializableMessage(), message->GetProtobufMessage(), 0);
|
||||
else
|
||||
SH_CALL(globals::gameEventSystem, PostEventAbstract)(0, false, &filter, message->GetSerializableMessage(), message->GetProtobufMessage(), 0);
|
||||
}
|
||||
|
||||
static void UserMessageDelete(ScriptContext& scriptContext)
|
||||
|
||||
Reference in New Issue
Block a user