Skip to content

A game mode for SA-MP (San Andreas Multiplayer) created with .NET/C# and SampSharp.net

License

Notifications You must be signed in to change notification settings

MrDave1999/Capture-The-Flag

Repository files navigation

Capture The Flag

SA-MP logo

Capture The Flag is a game mode for SA-MP (San Andreas Multiplayer, a multiplayer mod for GTA San Andreas) created with SampSharp. There are 2 flags on the map, one for each team. Players need to capture the enemy's flag and bring it back to their own one.

Index

Gameplay

The Beta team plays against the Alpha team. The aim is to carry the enemy's flag to the spawn of the own flag. The own flag needs to be at the spawn to score. So you have to conquer the opponent's flag and defend your own team's one at the same time. It's necessary for the whole team to work together tactically to win.

The team which which got more points after 15 minutes wins. If both teams have the same points after the time is up, it's a draw.

Beware! Enemies will see flag carriers on their radar as well!

In this video, you can watch a gameplay demo: https://youtu.be/rsWCZaT4aBE or also see the play list.

Screenshots

sa-mp-000

sa-mp-000

sa-mp-001

sa-mp-001

sa-mp-002

sa-mp-002

sa-mp-003

sa-mp-003

sa-mp-004

sa-mp-004

Technologies used

Programming Languages

Softwares

Frameworks and libraries

Testing

Software Engineering

Software engineering concepts have been applied in this project:

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 or the open.mp launcher to connect to the servers.

Deployment without Docker

  • You must download Visual C++ Redistributable x86 to load plugins such as SampSharp and Streamer.
  • You need to download the ctf-gamemode-windows.zip 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.

Deployment with Docker

  • Clone the repository:
git clone https://github.com/MrDave1999/Capture-The-Flag.git
  • Change directory:
cd Capture-The-Flag
  • Copy the contents of .env.example to .env:
cp .env.example .env
  • Build the image and initiate services:
docker compose up --build -d
  • Check the server logs to see if everything is working properly:
docker compose exec -it app cat server_log.txt
localhost:7777

Credentials

The following table shows the default credentials for authentication from the game mode.

PlayerName Password
Admin_Player 123456
Moderator_Player 123456
VIP_Player 123456
Basic_Player 123456

Note that these credentials are only available if your database provider is in-memory. In your .env file you must indicate it as follows.

DatabaseProvider=InMemory

How to become an admin?

You must add your name and secret key from the .env file:

ServerOwner__Name=MrDave # Your nickname in the game
ServerOwner__SecretKey=1234._%==?! # Specify the secret key to give me admin.

It is necessary to specify your secret key, which you will use when executing the command "/givemeadmin" in the game.

Supported RDBMS

SQLite

  • Download sqlite3 CLI from here (select the file named sqlite-tools-win-x86).
  • Create a file called .env in the root directory:
copy .env.example .env
  • You must specify the name of the database provider from the .env file:
DatabaseProvider=SQLite
  • You must specify the location of the database file:
SQLite__DataSource=C:\Users\mrdave\OneDrive\Desktop\gamemode.db
  • Finally, you must import the database:
sqlite3 gamemode.db < ./scripts/sqlite/gamemode.sql

See the scripts for more information.

MariaDB

  • Install MariaDb Server and set up your username and password.
  • Create a file called .env in the root directory:
copy .env.example .env
  • You must specify the name of the database provider from the .env file:
DatabaseProvider=MariaDB
  • You must specify the connection string in the .env file:
MariaDB__Server=localhost
MariaDB__Port=3306
MariaDB__Database=gamemode
MariaDB__UserName=root
MariaDB__Password=123456789
  • Finally, you must import the database:
mariadb -uroot -p123456789 gamemode < ./scripts/mariadb/gamemode.sql

See the scripts for more information.

Architectural overview

Show diagram

overview

Main components

  • Application Core. Contains all the logic of the game called "Capture The Flag", including the rules and procedures that define how the game is played.
  • Persistence layer. Contains all data access logic. The purpose of this layer is to prevent the filtering of data access logic in the application core.
  • Host Application. Contains everything needed to run the game mode. It represents the entry point of the application. This layer performs other tasks such as:
    • Load application settings from .env file.
    • Select the database provider.
    • Register services to DI Container.
    • Add systems to the services collection.
    • Enable desired ECS system features.

Credits

  • MrDave1999 for creating the "Capture The Flag" game mode.
  • ikkentim for creating the SampSharp framework.
  • Nickk888SAMP for creating NTD (TextDraw Editor).
  • samp-incognito for creating the streamer plugin.
  • IS4Code for maintaining the YSF (Y_Less's Server Fixes) plugin.

Mappers

  • Area66 by DragonZafiro.
  • d_dust5, SA_Hill, de_aztec and de_dust2_small by Elorreli.
  • Compound and cs_rockwar by Amirab.
  • DesertGlory, fy_iceworld2 and de_dust2_x3 by TheYoungCapone.
  • EntryMap and TheConstruction by B4MB1[MC].
  • fy_iceworld by Sleyer.
  • fy_snow by UnuAlex.
  • fy_snow2 by mihaibr.
  • de_dust2 by JamesT85.
  • Aim_Headshot by haubitze.
  • Aim_Headshot2 by Niktia_Ruchkov.
  • de_dust2_x1 by SpikY_.
  • de_dust2_x2 by Amads.
  • WarZone by Samarchai.
  • cs_assault by Ghost-X.
  • GateToHell and TheWild by Zniper.
  • TheBunker by Dr.Pawno.
  • cs_deagle5 by SENiOR.
  • mp_jetdoor by saawan.
  • Simpson by Risq.
  • ZM_Italy - Unknown.
  • zone_paintball by Famous.
  • mp_island by Leo.

Contribution

Any contribution is welcome! Remember that you can contribute not only in the code, but also in the documentation or even improve the tests.

Follow the steps below:

  • Fork it
  • Create your custom branch (git checkout -b my-new-change)
  • Commit your changes (git commit -am 'Add some change')
  • Push to the branch (git push origin my-new-change)
  • Create new Pull Request

License

This project is licensed under the GNU Affero General Public License v3.0