diff --git a/.dockerignore b/.dockerignore index 7f7d2c95..29bb7f48 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,13 +10,17 @@ logs/ scripts/ screenshots/ tests/ +components/ announce.exe samp-server.exe samp-npc.exe announce samp03svr samp-npc +omp-server.exe +omp-server server.cfg server_log.txt +log.txt *.zip *.rar \ No newline at end of file diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index 263cafbc..85cb71d6 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -16,14 +16,14 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} - - name: Download SA-MP Server - run: wget https://github.com/MrDave1999/samp-server/releases/download/sampserver.v1/samp03.zip - - name: Unzip SA-MP Server - run: unzip samp03.zip -d ctf-gamemode-windows - - name: Move contents of samp03 to root directory + - name: Download open.mp Server + run: wget https://github.com/MrDave1999/env.server/releases/download/omp-server/open.mp-win-x86.zip + - name: Unzip open.mp Server + run: unzip open.mp-win-x86.zip -d ctf-gamemode-windows + - name: Move contents of Server to root directory run: | - mv ctf-gamemode-windows/samp03/** ctf-gamemode-windows - rmdir ctf-gamemode-windows/samp03 + mv ctf-gamemode-windows/Server/** ctf-gamemode-windows + rmdir ctf-gamemode-windows/Server - name: Add plugins to server.cfg file run: | echo "" >> ctf-gamemode-windows/server.cfg diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-prod.yml similarity index 74% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-prod.yml index 5b4c6be1..06c8728e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-prod.yml @@ -1,4 +1,4 @@ -name: CTF Deploy +name: CTF Deploy Production on: push: @@ -17,7 +17,8 @@ jobs: key: ${{ secrets.PRIVATE_KEY }} port: 22 script: | - cd Capture-The-Flag + cd ctf-prod git pull origin main git status - sudo docker compose up --build -d \ No newline at end of file + sudo docker compose up --build -d + sudo docker builder prune -f \ No newline at end of file diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml new file mode 100644 index 00000000..d7d20487 --- /dev/null +++ b/.github/workflows/deploy-test.yml @@ -0,0 +1,24 @@ +name: CTF Deploy Test + +on: + push: + branches: + - test + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Deploy using ssh + uses: appleboy/ssh-action@v1.1.0 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.PRIVATE_KEY }} + port: 22 + script: | + cd ctf-test + git pull origin dev + git status + sudo docker compose up --build -d + sudo docker builder prune -f \ No newline at end of file diff --git a/.gitignore b/.gitignore index 404a5378..03df32e1 100644 --- a/.gitignore +++ b/.gitignore @@ -27,10 +27,14 @@ samp-npc.exe announce samp03svr samp-npc +components/ +omp-server.exe +omp-server # logs logs/ server_log.txt +log.txt crashinfo.txt # License @@ -38,9 +42,11 @@ samp-license.txt # Ban list samp.ban +bans.json # IDE files (compiler, includes, etc) pawno/ +qawno/ # User-specific files *.rsuser diff --git a/Directory.Packages.props b/Directory.Packages.props index 89a44ba7..f039c65f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -13,7 +13,7 @@ - + diff --git a/Dockerfile b/Dockerfile index 695dda2e..d277ff8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,17 +23,18 @@ COPY ["src/", "/app/src/"] RUN dotnet publish --framework=net6.0 -c Release -o /app/out --no-restore # -# Download SA-MP server and dotnet linux-x86 +# Download open.mp server and dotnet linux-x86 # -FROM ubuntu:20.04 AS tools +FROM ubuntu:22.04 AS tools RUN apt-get update && apt-get install -y --no-install-recommends wget -WORKDIR /sampserver -RUN wget https://gta-multiplayer.cz/downloads/samp037svr_R2-2-1.tar.gz --no-check-certificate \ - && tar -xf samp037svr_R2-2-1.tar.gz \ - && rm -f samp037svr_R2-2-1.tar.gz -WORKDIR /sampserver/samp03 -RUN rm -rf filterscripts gamemodes include npcmodes scriptfiles server.cfg +WORKDIR /open-mp +ENV OPEN_MP_VERSION="1.3.1.2748" +RUN wget https://github.com/openmultiplayer/open.mp/releases/download/v${OPEN_MP_VERSION}/open.mp-linux-x86.tar.gz --no-check-certificate \ + && tar -xf open.mp-linux-x86.tar.gz \ + && rm -f open.mp-linux-x86.tar.gz +WORKDIR /open-mp/Server +RUN rm -rf filterscripts gamemodes include npcmodes scriptfiles config.json WORKDIR /runtime ENV TARGET_FRAMEWORK="6.0.35" @@ -48,15 +49,13 @@ RUN wget https://github.com/Servarr/dotnet-linux-x86/releases/download/v${VERSIO # # Final stage/image # -FROM ubuntu:20.04 +FROM ubuntu:22.04 WORKDIR /app -EXPOSE 7777/udp - RUN dpkg --add-architecture i386 RUN apt-get update && apt-get install -y --no-install-recommends \ libc6:i386 \ libstdc++6:i386 \ - libssl1.1:i386 \ + libssl3:i386 \ libicu-dev:i386 \ tzdata \ && rm -rf /var/lib/apt/lists/* @@ -67,8 +66,5 @@ COPY ["plugins/*.so", "plugins/"] COPY ["codepages/*.txt", "codepages/"] COPY ["server.cfg.example", "server.cfg"] COPY --from=tools /runtime runtime -COPY --from=tools /sampserver/samp03 . -RUN echo "" >> server.cfg \ - && echo "coreclr runtime" >> server.cfg \ - && echo "gamemode bin/CTF.Host.dll" >> server.cfg +COPY --from=tools /open-mp/Server . COPY --from=build /app/out bin \ No newline at end of file diff --git a/README.md b/README.md index a21f3eb5..897d84e2 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,9 @@ There are 2 flags on the map, one for each team. Players need to capture the ene - [Frameworks and libraries](#frameworks-and-libraries) - [Testing](#testing) - [Software Engineering](#software-engineering) + - [Programming Paradigms](#programming-paradigms) + - [Software Patterns](#software-patterns) + - [Design Principles](#design-principles) - [Requirements to play](#requirements-to-play) - [Deployment without Docker](#deployment-without-docker) - [Deployment with Docker](#deployment-with-docker) @@ -102,7 +105,7 @@ In this video, you can watch a gameplay demo: https://youtu.be/rsWCZaT4aBE or al ### Softwares - [.NET CLI](https://learn.microsoft.com/en-us/dotnet/core/tools) -- [SA-MP Server](https://www.sa-mp.mp/downloads) +- [Open Multiplayer](https://github.com/openmultiplayer) - [CompileApp-FS](https://github.com/MrDave1999/CompileApp-FS) - [Visual Studio 2022](https://visualstudio.microsoft.com) - [vscode](https://github.com/microsoft/vscode) @@ -111,9 +114,10 @@ In this video, you can watch a gameplay demo: https://youtu.be/rsWCZaT4aBE or al - [DB Browser for SQLite](https://sqlitebrowser.org) - [HeidiSQL](https://github.com/HeidiSQL) - [GitHub Actions](https://github.com/actions) -- [Git](https://git-scm.com) +- [Git](https://github.com/git/git) - [draw.io](https://app.diagrams.net) - [Docker](https://github.com/docker) +- [Portainer](https://github.com/portainer/portainer) ### Frameworks and libraries - [.NET SDK 8.0](https://github.com/dotnet/runtime) @@ -140,31 +144,38 @@ In this video, you can watch a gameplay demo: https://youtu.be/rsWCZaT4aBE or al ## Software Engineering -Software engineering concepts have been applied in this project: +These concepts have been applied to this project: + +### Programming Paradigms +- [Object-oriented programming (OOP)](https://en.wikipedia.org/wiki/Object-oriented_programming) +- [Structured programming](https://en.wikipedia.org/wiki/Structured_programming) + +### Software Patterns - [Hexagonal architecture](https://en.wikipedia.org/wiki/Hexagonal_architecture_(software)) - [Entity–component–system (ECS)](https://en.wikipedia.org/wiki/Entity_component_system) -- [Object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming) - [Interface-based programming](https://en.wikipedia.org/wiki/Interface-based_programming) -- [Modular programming](https://en.wikipedia.org/wiki/Modular_programming) - [Dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) +- [Repository Pattern](https://deviq.com/design-patterns/repository-pattern) - [Operation Result Pattern](https://medium.com/@wgyxxbf/result-pattern-a01729f42f8c) -- [Guard Clause](https://deviq.com/design-patterns/guard-clause) -- [Open-closed principle](https://en.wikipedia.org/wiki/Open%E2%80%93closed_principle) -- [Explicit dependencies](https://deviq.com/principles/explicit-dependencies-principle) + +### Design Principles - [Separation of concerns](https://en.wikipedia.org/wiki/Separation_of_concerns) +- [Open-Closed Principle](https://en.wikipedia.org/wiki/Open%E2%80%93closed_principle) +- [Dependency Inversion Principle](https://deviq.com/principles/dependency-inversion-principle) +- [Explicit dependencies](https://deviq.com/principles/explicit-dependencies-principle) ## Requirements to play - You must have **DirectX 9** installed on your local machine. -- You must download **Grand Theft Auto: San Andreas** on your local machine. -- You must download the [SA-MP client](https://www.sa-mp.mp/downloads) or the [open.mp launcher](https://github.com/openmultiplayer/launcher/releases) to connect to the servers. +- You must download [Grand Theft Auto: San Andreas](https://mega.nz/file/yFMjSLZA#8Amh1xyauAKO9Ff1lsbXHZIWHqPC4qEg2McfqhqoHTc) on your local machine. +- You must download [open.mp launcher](https://github.com/openmultiplayer/launcher/releases/latest) to connect to the servers. ## Deployment without Docker - You must download [Visual C++ Redistributable x86](https://www.microsoft.com/en-us/download/details.aspx?id=48145) to load plugins such as SampSharp and Streamer. - You need to download the [ctf-gamemode-windows.zip](https://github.com/MrDave1999/Capture-The-Flag/releases/latest) file that contains the files to run the game mode. - Once downloaded, modify the `.env` file according to your needs. -- Run the `samp-server.exe`. +- Run the `omp-server.exe`. ## Deployment with Docker @@ -186,9 +197,9 @@ docker compose up --build -d ``` - Check the server logs to see if everything is working properly: ```sh -docker compose exec -it app cat server_log.txt +docker compose exec -it app cat log.txt ``` -- Add the server IP in your [SA-MP client](https://www.sa-mp.mp/downloads): +- Add the server IP in your [omp-launcher](https://github.com/openmultiplayer/launcher/releases/latest): ``` localhost:7777 ``` @@ -289,9 +300,11 @@ See the [scripts](https://github.com/MrDave1999/Capture-The-Flag/tree/dev/script ## Credits - [MrDave1999](https://github.com/MrDave1999/Capture-The-Flag) for creating the "Capture The Flag" game mode. +- [Parca_35](https://www.youtube.com/channel/UCQUOz-GEp0jMtmGzUEQWElQ) for helping test the game mode. - [ikkentim](https://github.com/ikkentim/SampSharp) for creating the SampSharp framework. - [Nickk888SAMP](https://github.com/Nickk888SAMP/TextDraw-Editor) for creating NTD (TextDraw Editor). - [samp-incognito](https://github.com/samp-incognito/samp-streamer-plugin) for creating the streamer plugin. +- [Open Multiplayer](https://github.com/openmultiplayer) for creating a multiplayer mod for Grand Theft Auto: San Andreas fully backward compatible with San Andreas Multiplayer (SA-MP). ### Mappers diff --git a/docker-compose.yml b/docker-compose.yml index 5f1e54ec..580b91be 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,15 +6,12 @@ services: command: > bash -c "sed -i 's/lagcompmode 1/lagcompmode ${LagCompMode}/' server.cfg && sed -i 's/maxplayers 30/maxplayers ${MaxPlayers}/' server.cfg - && ./samp03svr" + && sed -i 's/port 7777/port ${Port}/' server.cfg + && ./omp-server" ports: - - ${Port}:7777/udp + - ${Port}:${Port}/udp environment: - TZ=${TZ} volumes: - ./scripts/sqlite:/app/scripts/sqlite - - ./logs:/app/logs - -networks: - default: - name: 'gamemode-ctf' \ No newline at end of file + - ./logs:/app/logs \ No newline at end of file diff --git a/filterscripts/Aim_Headshot.amx b/filterscripts/Aim_Headshot.amx index 4581ffbf..0cc12b71 100644 Binary files a/filterscripts/Aim_Headshot.amx and b/filterscripts/Aim_Headshot.amx differ diff --git a/filterscripts/Aim_Headshot.pwn b/filterscripts/Aim_Headshot.pwn index ac60a81b..9ecd7b89 100644 --- a/filterscripts/Aim_Headshot.pwn +++ b/filterscripts/Aim_Headshot.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "Aim_Headshot" #include "objects" diff --git a/filterscripts/Aim_Headshot2.amx b/filterscripts/Aim_Headshot2.amx index 16a72f5c..2b80d93a 100644 Binary files a/filterscripts/Aim_Headshot2.amx and b/filterscripts/Aim_Headshot2.amx differ diff --git a/filterscripts/Aim_Headshot2.pwn b/filterscripts/Aim_Headshot2.pwn index ae9b7651..a903dbde 100644 --- a/filterscripts/Aim_Headshot2.pwn +++ b/filterscripts/Aim_Headshot2.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "Aim_Headshot2" #include "objects" diff --git a/filterscripts/Area51.amx b/filterscripts/Area51.amx index 3a8bbff3..e2a535a2 100644 Binary files a/filterscripts/Area51.amx and b/filterscripts/Area51.amx differ diff --git a/filterscripts/Area51.pwn b/filterscripts/Area51.pwn index 3a36a5b2..51cd40f7 100644 --- a/filterscripts/Area51.pwn +++ b/filterscripts/Area51.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "Area51" #include "objects" diff --git a/filterscripts/Area66.amx b/filterscripts/Area66.amx index c05de659..dbb5ac72 100644 Binary files a/filterscripts/Area66.amx and b/filterscripts/Area66.amx differ diff --git a/filterscripts/Area66.pwn b/filterscripts/Area66.pwn index 4111dd23..d2609bca 100644 --- a/filterscripts/Area66.pwn +++ b/filterscripts/Area66.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "Area66" #include "objects" diff --git a/filterscripts/Compound.amx b/filterscripts/Compound.amx index fe1ba750..3a236fcc 100644 Binary files a/filterscripts/Compound.amx and b/filterscripts/Compound.amx differ diff --git a/filterscripts/Compound.pwn b/filterscripts/Compound.pwn index 27d7f5b9..c14603dc 100644 --- a/filterscripts/Compound.pwn +++ b/filterscripts/Compound.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "Compound" #include "objects" diff --git a/filterscripts/CrackFactory.amx b/filterscripts/CrackFactory.amx new file mode 100644 index 00000000..f0b84305 Binary files /dev/null and b/filterscripts/CrackFactory.amx differ diff --git a/filterscripts/CrackFactory.pwn b/filterscripts/CrackFactory.pwn new file mode 100644 index 00000000..3ce31b6d --- /dev/null +++ b/filterscripts/CrackFactory.pwn @@ -0,0 +1,8 @@ +#include +#define FILTER_SCRIPT_NAME "CrackFactory" +#include "objects" + +public OnFilterScriptInit() +{ + return 1; +} diff --git a/filterscripts/DesertGlory.amx b/filterscripts/DesertGlory.amx index 203ffc79..3b2904e7 100644 Binary files a/filterscripts/DesertGlory.amx and b/filterscripts/DesertGlory.amx differ diff --git a/filterscripts/DesertGlory.pwn b/filterscripts/DesertGlory.pwn index 1f9d404a..081e98df 100644 --- a/filterscripts/DesertGlory.pwn +++ b/filterscripts/DesertGlory.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "DesertGlory" #include "objects" diff --git a/filterscripts/EntryMap.amx b/filterscripts/EntryMap.amx index 677097e6..476a8a25 100644 Binary files a/filterscripts/EntryMap.amx and b/filterscripts/EntryMap.amx differ diff --git a/filterscripts/EntryMap.pwn b/filterscripts/EntryMap.pwn index 7dfa4020..84bf0e63 100644 --- a/filterscripts/EntryMap.pwn +++ b/filterscripts/EntryMap.pwn @@ -1,4 +1,4 @@ -#include +#include public OnFilterScriptInit() { diff --git a/filterscripts/GateToHell.amx b/filterscripts/GateToHell.amx index e481c231..14a0d034 100644 Binary files a/filterscripts/GateToHell.amx and b/filterscripts/GateToHell.amx differ diff --git a/filterscripts/GateToHell.pwn b/filterscripts/GateToHell.pwn index 6e8ac202..6747ecb5 100644 --- a/filterscripts/GateToHell.pwn +++ b/filterscripts/GateToHell.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "GateToHell" #include "objects" diff --git a/filterscripts/RC_Battlefield.amx b/filterscripts/RC_Battlefield.amx new file mode 100644 index 00000000..b1b3bcb2 Binary files /dev/null and b/filterscripts/RC_Battlefield.amx differ diff --git a/filterscripts/RC_Battlefield.pwn b/filterscripts/RC_Battlefield.pwn new file mode 100644 index 00000000..4a0d9ea4 --- /dev/null +++ b/filterscripts/RC_Battlefield.pwn @@ -0,0 +1,8 @@ +#include +#define FILTER_SCRIPT_NAME "RC_Battlefield" +#include "objects" + +public OnFilterScriptInit() +{ + return 1; +} diff --git a/filterscripts/RemoveBuilding.amx b/filterscripts/RemoveBuilding.amx index 025d61b1..b3849f9f 100644 Binary files a/filterscripts/RemoveBuilding.amx and b/filterscripts/RemoveBuilding.amx differ diff --git a/filterscripts/RemoveBuilding.pwn b/filterscripts/RemoveBuilding.pwn index 4ba8bd40..373df323 100644 --- a/filterscripts/RemoveBuilding.pwn +++ b/filterscripts/RemoveBuilding.pwn @@ -1,4 +1,4 @@ -#include +#include public OnPlayerConnect(playerid) { diff --git a/filterscripts/SA_Hill.amx b/filterscripts/SA_Hill.amx index 97910589..2e059ec7 100644 Binary files a/filterscripts/SA_Hill.amx and b/filterscripts/SA_Hill.amx differ diff --git a/filterscripts/SA_Hill.pwn b/filterscripts/SA_Hill.pwn index 44e4e729..b7ba4330 100644 --- a/filterscripts/SA_Hill.pwn +++ b/filterscripts/SA_Hill.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "SA_Hill" #include "objects" diff --git a/filterscripts/Simpson.amx b/filterscripts/Simpson.amx index 45b4f767..68f26cae 100644 Binary files a/filterscripts/Simpson.amx and b/filterscripts/Simpson.amx differ diff --git a/filterscripts/Simpson.pwn b/filterscripts/Simpson.pwn index cdc1088b..833c290a 100644 --- a/filterscripts/Simpson.pwn +++ b/filterscripts/Simpson.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "Simpson" #include "objects" diff --git a/filterscripts/TheBunker.amx b/filterscripts/TheBunker.amx index 58365a3b..b22540f1 100644 Binary files a/filterscripts/TheBunker.amx and b/filterscripts/TheBunker.amx differ diff --git a/filterscripts/TheBunker.pwn b/filterscripts/TheBunker.pwn index c796adcd..81a502d4 100644 --- a/filterscripts/TheBunker.pwn +++ b/filterscripts/TheBunker.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "TheBunker" #include "objects" diff --git a/filterscripts/TheConstruction.amx b/filterscripts/TheConstruction.amx index 00807b8a..3014d5f6 100644 Binary files a/filterscripts/TheConstruction.amx and b/filterscripts/TheConstruction.amx differ diff --git a/filterscripts/TheConstruction.pwn b/filterscripts/TheConstruction.pwn index 27e04ead..b9d05bdf 100644 --- a/filterscripts/TheConstruction.pwn +++ b/filterscripts/TheConstruction.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "TheConstruction" #include "objects" diff --git a/filterscripts/TheWild.amx b/filterscripts/TheWild.amx index 6b1cda74..4b31125f 100644 Binary files a/filterscripts/TheWild.amx and b/filterscripts/TheWild.amx differ diff --git a/filterscripts/TheWild.pwn b/filterscripts/TheWild.pwn index b2cdfdbf..65523d6f 100644 --- a/filterscripts/TheWild.pwn +++ b/filterscripts/TheWild.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "TheWild" #include "objects" diff --git a/filterscripts/WarZone.amx b/filterscripts/WarZone.amx index b48f6f3d..d5c6579f 100644 Binary files a/filterscripts/WarZone.amx and b/filterscripts/WarZone.amx differ diff --git a/filterscripts/WarZone.pwn b/filterscripts/WarZone.pwn index 88a756d6..59b1002a 100644 --- a/filterscripts/WarZone.pwn +++ b/filterscripts/WarZone.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "WarZone" #include "objects" diff --git a/filterscripts/ZM_Italy.amx b/filterscripts/ZM_Italy.amx index b866b8a0..0f9201b6 100644 Binary files a/filterscripts/ZM_Italy.amx and b/filterscripts/ZM_Italy.amx differ diff --git a/filterscripts/ZM_Italy.pwn b/filterscripts/ZM_Italy.pwn index 4832fac5..56739782 100644 --- a/filterscripts/ZM_Italy.pwn +++ b/filterscripts/ZM_Italy.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "ZM_Italy" #include "objects" diff --git a/filterscripts/cs_assault.amx b/filterscripts/cs_assault.amx index d7e92303..5ac233d0 100644 Binary files a/filterscripts/cs_assault.amx and b/filterscripts/cs_assault.amx differ diff --git a/filterscripts/cs_assault.pwn b/filterscripts/cs_assault.pwn index 323404a4..d1971fb0 100644 --- a/filterscripts/cs_assault.pwn +++ b/filterscripts/cs_assault.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "cs_assault" #include "objects" diff --git a/filterscripts/cs_deagle5.amx b/filterscripts/cs_deagle5.amx index 89ac809f..a0ac0bf8 100644 Binary files a/filterscripts/cs_deagle5.amx and b/filterscripts/cs_deagle5.amx differ diff --git a/filterscripts/cs_deagle5.pwn b/filterscripts/cs_deagle5.pwn index 7cc3e8f7..8698b4ea 100644 --- a/filterscripts/cs_deagle5.pwn +++ b/filterscripts/cs_deagle5.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "cs_deagle5" #include "objects" diff --git a/filterscripts/cs_rockwar.amx b/filterscripts/cs_rockwar.amx index 69504d5f..a8c75d4e 100644 Binary files a/filterscripts/cs_rockwar.amx and b/filterscripts/cs_rockwar.amx differ diff --git a/filterscripts/cs_rockwar.pwn b/filterscripts/cs_rockwar.pwn index bcb6a2cc..e7e67c9e 100644 --- a/filterscripts/cs_rockwar.pwn +++ b/filterscripts/cs_rockwar.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "cs_rockwar" #include "objects" diff --git a/filterscripts/de_aztec.amx b/filterscripts/de_aztec.amx index 895fd5b9..00e53a84 100644 Binary files a/filterscripts/de_aztec.amx and b/filterscripts/de_aztec.amx differ diff --git a/filterscripts/de_aztec.pwn b/filterscripts/de_aztec.pwn index 0c97bf77..e32374b0 100644 --- a/filterscripts/de_aztec.pwn +++ b/filterscripts/de_aztec.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "de_aztec" #include "objects" diff --git a/filterscripts/de_dust2.amx b/filterscripts/de_dust2.amx index b9b8501b..b2382b50 100644 Binary files a/filterscripts/de_dust2.amx and b/filterscripts/de_dust2.amx differ diff --git a/filterscripts/de_dust2.pwn b/filterscripts/de_dust2.pwn index 3faf3b98..e29dd7aa 100644 --- a/filterscripts/de_dust2.pwn +++ b/filterscripts/de_dust2.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "de_dust2" #include "objects" diff --git a/filterscripts/de_dust2_small.amx b/filterscripts/de_dust2_small.amx index 30ef3205..eb976d5a 100644 Binary files a/filterscripts/de_dust2_small.amx and b/filterscripts/de_dust2_small.amx differ diff --git a/filterscripts/de_dust2_small.pwn b/filterscripts/de_dust2_small.pwn index cfeca22a..4da80e50 100644 --- a/filterscripts/de_dust2_small.pwn +++ b/filterscripts/de_dust2_small.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "de_dust2_small" #include "objects" diff --git a/filterscripts/de_dust2_x1.amx b/filterscripts/de_dust2_x1.amx index 28a7861f..d51d58cb 100644 Binary files a/filterscripts/de_dust2_x1.amx and b/filterscripts/de_dust2_x1.amx differ diff --git a/filterscripts/de_dust2_x1.pwn b/filterscripts/de_dust2_x1.pwn index 7bafbb33..2c453c10 100644 --- a/filterscripts/de_dust2_x1.pwn +++ b/filterscripts/de_dust2_x1.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "de_dust2_x1" #include "objects" diff --git a/filterscripts/de_dust2_x2.amx b/filterscripts/de_dust2_x2.amx index 0922a59c..ebbb3a04 100644 Binary files a/filterscripts/de_dust2_x2.amx and b/filterscripts/de_dust2_x2.amx differ diff --git a/filterscripts/de_dust2_x2.pwn b/filterscripts/de_dust2_x2.pwn index d32e3f4e..510f56d9 100644 --- a/filterscripts/de_dust2_x2.pwn +++ b/filterscripts/de_dust2_x2.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "de_dust2_x2" #include "objects" diff --git a/filterscripts/de_dust2_x3.amx b/filterscripts/de_dust2_x3.amx index f12b99ec..53b3abdf 100644 Binary files a/filterscripts/de_dust2_x3.amx and b/filterscripts/de_dust2_x3.amx differ diff --git a/filterscripts/de_dust2_x3.pwn b/filterscripts/de_dust2_x3.pwn index c07e06cd..ffd8686e 100644 --- a/filterscripts/de_dust2_x3.pwn +++ b/filterscripts/de_dust2_x3.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "de_dust2_x3" #include "objects" diff --git a/filterscripts/de_dust5.amx b/filterscripts/de_dust5.amx index c8bb39e8..3266f209 100644 Binary files a/filterscripts/de_dust5.amx and b/filterscripts/de_dust5.amx differ diff --git a/filterscripts/de_dust5.pwn b/filterscripts/de_dust5.pwn index b55765d7..63a64c44 100644 --- a/filterscripts/de_dust5.pwn +++ b/filterscripts/de_dust5.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "de_dust5" #include "objects" diff --git a/filterscripts/empty.amx b/filterscripts/empty.amx index 7a7073cf..a4ae964c 100644 Binary files a/filterscripts/empty.amx and b/filterscripts/empty.amx differ diff --git a/filterscripts/empty.pwn b/filterscripts/empty.pwn index f7326ec4..88ce8194 100644 --- a/filterscripts/empty.pwn +++ b/filterscripts/empty.pwn @@ -1,6 +1,6 @@ //Rcon fix //Returns 0 in OnRconCommand to allow gamemodes to process the commands -#include +#include public OnRconCommand(cmd[]) { return 0; diff --git a/filterscripts/fy_iceworld.amx b/filterscripts/fy_iceworld.amx index a057fd42..157ff895 100644 Binary files a/filterscripts/fy_iceworld.amx and b/filterscripts/fy_iceworld.amx differ diff --git a/filterscripts/fy_iceworld.pwn b/filterscripts/fy_iceworld.pwn index c2dcc658..4b8218ba 100644 --- a/filterscripts/fy_iceworld.pwn +++ b/filterscripts/fy_iceworld.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "fy_iceworld" #include "objects" diff --git a/filterscripts/fy_iceworld2.amx b/filterscripts/fy_iceworld2.amx index ad1c9eef..d5ea981d 100644 Binary files a/filterscripts/fy_iceworld2.amx and b/filterscripts/fy_iceworld2.amx differ diff --git a/filterscripts/fy_iceworld2.pwn b/filterscripts/fy_iceworld2.pwn index 21bf65be..3a9fc419 100644 --- a/filterscripts/fy_iceworld2.pwn +++ b/filterscripts/fy_iceworld2.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "fy_iceworld2" #include "objects" diff --git a/filterscripts/fy_snow.amx b/filterscripts/fy_snow.amx index 2cd85cdc..129142a9 100644 Binary files a/filterscripts/fy_snow.amx and b/filterscripts/fy_snow.amx differ diff --git a/filterscripts/fy_snow.pwn b/filterscripts/fy_snow.pwn index 202c211e..c721b235 100644 --- a/filterscripts/fy_snow.pwn +++ b/filterscripts/fy_snow.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "fy_snow" #include "objects" diff --git a/filterscripts/fy_snow2.amx b/filterscripts/fy_snow2.amx index ee459638..80d82498 100644 Binary files a/filterscripts/fy_snow2.amx and b/filterscripts/fy_snow2.amx differ diff --git a/filterscripts/fy_snow2.pwn b/filterscripts/fy_snow2.pwn index 550a24b1..2b88ec2a 100644 --- a/filterscripts/fy_snow2.pwn +++ b/filterscripts/fy_snow2.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "fy_snow2" #include "objects" diff --git a/filterscripts/mp_island.amx b/filterscripts/mp_island.amx index 7f715d79..013b0c29 100644 Binary files a/filterscripts/mp_island.amx and b/filterscripts/mp_island.amx differ diff --git a/filterscripts/mp_island.pwn b/filterscripts/mp_island.pwn index 4efe9960..70f8f1cc 100644 --- a/filterscripts/mp_island.pwn +++ b/filterscripts/mp_island.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "mp_island" #include "objects" diff --git a/filterscripts/mp_jetdoor.amx b/filterscripts/mp_jetdoor.amx index e7f0a7ec..f14b050b 100644 Binary files a/filterscripts/mp_jetdoor.amx and b/filterscripts/mp_jetdoor.amx differ diff --git a/filterscripts/mp_jetdoor.pwn b/filterscripts/mp_jetdoor.pwn index 22ab83bd..59c73c62 100644 --- a/filterscripts/mp_jetdoor.pwn +++ b/filterscripts/mp_jetdoor.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "mp_jetdoor" #include "objects" diff --git a/filterscripts/zone_paintball.amx b/filterscripts/zone_paintball.amx index 62954b6f..7578aee9 100644 Binary files a/filterscripts/zone_paintball.amx and b/filterscripts/zone_paintball.amx differ diff --git a/filterscripts/zone_paintball.pwn b/filterscripts/zone_paintball.pwn index 446ea63d..5d18e786 100644 --- a/filterscripts/zone_paintball.pwn +++ b/filterscripts/zone_paintball.pwn @@ -1,4 +1,4 @@ -#include +#include #define FILTER_SCRIPT_NAME "zone_paintball" #include "objects" diff --git a/server.cfg.example b/server.cfg.example index dbecbc66..a6d54e69 100644 --- a/server.cfg.example +++ b/server.cfg.example @@ -1,6 +1,7 @@ echo Executing Server Config... -gamemode0 empty -skip_empty_check true +coreclr runtime +gamemode bin/CTF.Host.dll +gamemode0 empty 1 plugins libSampSharp.so streamer.so filterscripts rcon_password password @@ -34,6 +35,4 @@ minconnectiontime 0 connseedtime 300000 db_logging 0 db_log_queries 0 -conncookies 1 -cookielogging 0 -output 1 \ No newline at end of file +cookielogging 0 \ No newline at end of file diff --git a/src/Application/Maps/Services/MapRotationService.cs b/src/Application/Maps/Services/MapRotationService.cs index fbbe4284..5a099132 100644 --- a/src/Application/Maps/Services/MapRotationService.cs +++ b/src/Application/Maps/Services/MapRotationService.cs @@ -78,7 +78,7 @@ private void OnLoadingMap() flagAutoReturnTimer.Stop(Team.Alpha); flagAutoReturnTimer.Stop(Team.Beta); serverService.SendRconCommand($"loadfs {nextMap.Name}"); - serverService.SendRconCommand($"mapname {nextMap.Name}"); + serverService.SendRconCommand($"game.map {nextMap.Name}"); } private void OnLoadedMap() diff --git a/src/Application/Maps/Systems/SetDefaultMapSystem.cs b/src/Application/Maps/Systems/SetDefaultMapSystem.cs index ebeb675a..fd1224ca 100644 --- a/src/Application/Maps/Systems/SetDefaultMapSystem.cs +++ b/src/Application/Maps/Systems/SetDefaultMapSystem.cs @@ -18,7 +18,7 @@ public void OnGameModeInit() mapInfoService.Load(mapResult.Value); } CurrentMap currentMap = mapInfoService.Read(); - serverService.SendRconCommand($"mapname {currentMap.Name}"); + serverService.SendRconCommand($"game.map {currentMap.Name}"); serverService.SendRconCommand($"loadfs {currentMap.Name}"); mapTextDrawRenderer.UpdateMapName(currentMap); diff --git a/src/Application/Players/GeneralCommands/AdminCommands.cs b/src/Application/Players/GeneralCommands/AdminCommands.cs index d97035f5..d8d22e7b 100644 --- a/src/Application/Players/GeneralCommands/AdminCommands.cs +++ b/src/Application/Players/GeneralCommands/AdminCommands.cs @@ -106,20 +106,40 @@ public void ShowBannedIPs(Player currentPlayer) if (currentPlayer.HasLowerRoleThan(RoleId.Admin)) return; - var path = Path.Combine(Directory.GetCurrentDirectory(), "samp.ban"); - var bannedIPs = File.ReadAllLines(path); - if (bannedIPs.Length == 0) + var path = Path.Combine(Directory.GetCurrentDirectory(), "bans.json"); + var content = File.ReadAllText(path); + var options = new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true + }; + var bannedPlayers = JsonSerializer.Deserialize(content, options); + if (bannedPlayers.Length == 0) { currentPlayer.SendClientMessage(Color.Red, Messages.NoMatchFound); return; } - var dialog = new ListDialog(caption: $"Banned IPs: {bannedIPs.Length}", "Close"); - foreach (string bannedIP in bannedIPs) + var dialog = new ListDialog(caption: $"Banned Players: {bannedPlayers.Length}", "Close"); + foreach (BannedPlayer bannedPlayer in bannedPlayers) { - dialog.Add(bannedIP); + dialog.Add(bannedPlayer.ToString()); } dialogService.ShowAsync(currentPlayer, dialog); } + + private class BannedPlayer + { + public string Address { get; set; } = string.Empty; + public string Player { get; set; } = string.Empty; + public string Reason { get; set; } = string.Empty; + public string Time { get; set; } = "2023-12-07T16:05:21-0500"; + public override string ToString() + { + var dt = DateTimeOffset.Parse(Time).DateTime; + var date = dt.ToString("yyyy/MM/dd"); + var time = dt.ToString("HH:mm:ss"); + return $"{Address} [{date} | {time}] {Player} - {Reason}"; + } + } } diff --git a/src/Application/Teams/ClassSelection/ClassSelectionSystem.cs b/src/Application/Teams/ClassSelection/ClassSelectionSystem.cs index 75118e72..07df668a 100644 --- a/src/Application/Teams/ClassSelection/ClassSelectionSystem.cs +++ b/src/Application/Teams/ClassSelection/ClassSelectionSystem.cs @@ -75,7 +75,7 @@ public bool OnPlayerRequestSpawn(Player player) return false; } player.DisableClassSelection(); - player.GameText("_", 1000, 4); + player.HideGameText(style: 3); player.GetInfo().SetTeam(selectedTeam.Id); player.StopAudioStream(); selectedTeam.Members.Add(player); diff --git a/src/Application/Usings.cs b/src/Application/Usings.cs index 812f7993..a8705545 100644 --- a/src/Application/Usings.cs +++ b/src/Application/Usings.cs @@ -1,4 +1,5 @@ -global using System.Collections; +global using System.Text.Json; +global using System.Collections; global using System.Globalization; global using System.Reflection; global using System.Text.RegularExpressions; diff --git a/src/Host/GameModeInit.cs b/src/Host/GameModeInit.cs index 70b21b67..1b405fba 100644 --- a/src/Host/GameModeInit.cs +++ b/src/Host/GameModeInit.cs @@ -14,9 +14,9 @@ public void OnGameModeInit() serverService.SendRconCommand("loadfs EntryMap"); serverService.SendRconCommand("loadfs RemoveBuilding"); - serverService.SendRconCommand($"hostname {serverSettings.HostName}"); + serverService.SendRconCommand($"name {serverSettings.HostName}"); serverService.SendRconCommand($"language {serverSettings.LanguageText}"); - serverService.SendRconCommand($"weburl {serverSettings.WebUrl}"); + serverService.SendRconCommand($"website {serverSettings.WebUrl}"); serverService.SetGameModeText(serverSettings.GameModeText); serverService.UsePlayerPedAnims(); serverService.DisableInteriorEnterExits(); diff --git a/src/Host/Properties/launchSettings.json b/src/Host/Properties/launchSettings.json index c1343411..4690545e 100644 --- a/src/Host/Properties/launchSettings.json +++ b/src/Host/Properties/launchSettings.json @@ -1,8 +1,8 @@ { "profiles": { - "samp-server": { + "omp-server": { "commandName": "Executable", - "executablePath": ".\\samp-server.exe", + "executablePath": ".\\omp-server.exe", "workingDirectory": "..\\..\\" } }