From fff08802348cefa3cb5f17437a4c23d7b0ce989e Mon Sep 17 00:00:00 2001 From: Katsute <58778985+Katsute@users.noreply.github.com> Date: Sun, 21 Apr 2024 13:26:27 -0400 Subject: [PATCH] gamedata --- .github/workflows/ci.yml | 10 +---- .github/workflows/release.yml | 12 ++---- README.md | 2 - TF100.sp | 31 ++++++++++++++-- tf2.100.txt | 70 +++++++++++++++++------------------ 5 files changed, 68 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5edb669..6971688 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,5 @@ name: SourcePawn CI + on: [push] jobs: @@ -16,12 +17,5 @@ jobs: shell: bash run: mkdir -p addons/sourcemod/include - - name: Install SourceScramble - uses: KatsuteTF/Workflows/actions/curl@main - with: - url: https://raw.githubusercontent.com/nosoop/SMExt-SourceScramble/master/scripting/include/sourcescramble.inc - file: addons/sourcemod/include/sourcescramble.inc - - name: Compile Plugin - run: | - spcomp -i addons/sourcemod/include TF100.sp \ No newline at end of file + run: spcomp -i addons/sourcemod/include TF100.sp \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f584bef..7c2abc9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,5 @@ name: Release + on: release: types: [published] @@ -18,18 +19,11 @@ jobs: shell: bash run: mkdir -p addons/sourcemod/include - - name: Install SourceScramble - uses: KatsuteTF/Workflows/actions/curl@main - with: - url: https://raw.githubusercontent.com/nosoop/SMExt-SourceScramble/master/scripting/include/sourcescramble.inc - file: addons/sourcemod/include/sourcescramble.inc - - name: Compile Plugin - run: | - spcomp -i addons/sourcemod/include TF100.sp + run: spcomp -i addons/sourcemod/include TF100.sp - name: Prepare Files - run: | + run: |- mkdir addons/sourcemod/scripting mv TF100.smx addons/sourcemod/scripting mkdir addons/sourcemod/gamedata diff --git a/README.md b/README.md index 38dc6e1..5b1583e 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ 100 player server optimization plugin; removes several map entities and optimizes network configurations -Requires [SourceScramble](https://github.com/nosoop/SMExt-SourceScramble) - Requires [SourceMod](https://www.sourcemod.net/) 1.12 or higher Start using `srcds.exe -console -game tf +randommap -unrestricted_maxplayers 100 +maxplayers 100 -nocrashdialog -timeout 0 -refreshrate 30` diff --git a/TF100.sp b/TF100.sp index 995e233..e2c8b87 100644 --- a/TF100.sp +++ b/TF100.sp @@ -2,9 +2,11 @@ #pragma semicolon 1 +#include #include #include -#include + +ConVar mp_tournament; static const int len = 23; @@ -126,9 +128,22 @@ public void OnPluginStart(){ // Voice Commands AddCommandListener(DisableCommand, "voicemenu"); - // Whitelist Patch + // Whitelist Patch https://forums.alliedmods.net/showthread.php?t=346702 + + mp_tournament = FindConVar("mp_tournament"); + mp_tournament.Flags &= ~FCVAR_NOTIFY; + + Handle gamedata = LoadGameConfigFile("tf2.100"); + + // broken ↓ + Handle hookReload = DHookCreateFromConf(gamedata, "ReloadWhitelist"); + DHookEnableDetour(hookReload, false, TournamentEnable); + DHookEnableDetour(hookReload, true, TournamentDisable); - // todo + // broken ↓ + Handle hookLoadout = DHookCreateFromConf(gamedata, "GetLoadoutItem"); + DHookEnableDetour(hookLoadout, false, TournamentEnable); + DHookEnableDetour(hookLoadout, true, TournamentDisable); } public void OnEntityCreated(int entity, const char[] classname){ @@ -161,4 +176,14 @@ public void DeleteEntities(const char[] classname){ public Action DisableCommand(const int client, const char[] command, const int args){ return Plugin_Stop; +} + +MRESReturn TournamentEnable(int entity, DHookReturn hReturn) { + mp_tournament.SetBool(true, true, false); + return MRES_Ignored; +} + +MRESReturn TournamentDisable(int entity, DHookReturn hReturn) { + mp_tournament.SetBool(false, true, false); + return MRES_Ignored; } \ No newline at end of file diff --git a/tf2.100.txt b/tf2.100.txt index a2fab35..0353074 100644 --- a/tf2.100.txt +++ b/tf2.100.txt @@ -1,41 +1,41 @@ "Games" { - "tf" - { - "Signatures" - { - "GetLoadoutItem" - { - "library" "server" - "windows" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x3C\x8B\x45\x14\x8B\x7D\x08\x8B\x5D\x0C" - "linux" "@_ZN9CTFPlayer14GetLoadoutItemEiib" - } + "tf" + { + "Signatures" + { + "GetLoadoutItem" + { + "library" "server" + "windows" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x3C\x8B\x45\x14\x8B\x7D\x08\x8B\x5D\x0C" + "linux" "@_ZN9CTFPlayer14GetLoadoutItemEiib" + } - "ReloadWhitelist" - { - "library" "server" - "windows" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\xC7\x04\x24\x20\x00\x00\x00\x8B\x75\x08\xE8\x2A\x2A\x2A\x2A\xC7\x44\x24\x04\x2A\x2A\x2A\x2A\x89\x04\x24\x89\xC3" - "linux" "@_ZN15CEconItemSystem15ReloadWhitelistEv" - } - } + "ReloadWhitelist" + { + "library" "server" + "windows" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\xC7\x04\x24\x20\x00\x00\x00\x8B\x75\x08\xE8\x2A\x2A\x2A\x2A\xC7\x44\x24\x04\x2A\x2A\x2A\x2A\x89\x04\x24\x89\xC3" + "linux" "@_ZN15CEconItemSystem15ReloadWhitelistEv" + } + } - "Functions" - { - "GetLoadoutItem" - { - "signature" "GetLoadoutItem" - "callconv" "thiscall" - "this" "entity" - "return" "int" - } + "Functions" + { + "GetLoadoutItem" + { + "signature" "GetLoadoutItem" + "callconv" "thiscall" + "this" "entity" + "return" "int" + } - "ReloadWhitelist" - { - "signature" "ReloadWhitelist" - "callconv" "thiscall" - "this" "ignore" - "return" "void" - } - } - } + "ReloadWhitelist" + { + "signature" "ReloadWhitelist" + "callconv" "thiscall" + "this" "ignore" + "return" "void" + } + } + } } \ No newline at end of file