A fast-paced C# game mode for open.mp — featuring two teams, two flags, and pure competitive chaos.
Capture The Flag is a game mode for open.mp (Open Multiplayer, a multiplayer mod for GTA San Andreas) created with the SampSharp framework.
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 base.
- Gameplay
- Screenshots
- Technologies used
- Software Engineering
- Requirements to play
- Deployment without Docker
- Deployment with Docker
- Credentials
- How to become an admin?
- Supported RDBMS
- Architectural overview
- Credits
- Contribution
- License
The Beta team plays against the Alpha team. The goal is to steal the enemy team’s flag and bring it back to the spawn of your own flag.
To score, your own flag must be at its base, so teams must attack and defend at the same time. Team coordination and tactical play are essential to win.
The match lasts 15 minutes. The team with the most captures when time runs out wins.
If both teams have the same number of captures, the match ends in a draw.
Beware! Enemies can see flag carriers on their radar.
In this video, you can watch a gameplay demo: https://youtu.be/rsWCZaT4aBE
You can also check the full playlist: https://www.youtube.com/playlist?list=PLBM-9TMXSAJjsWn4zmg1ua7eof9Aj83fS
- Steal the enemy team’s flag and bring it back to your base to score a capture.
- The match does not end when a team reaches a specific number of captures.
- The match only ends when the timer runs out.
Stealing the enemy flag
- A player can steal the enemy flag by picking up the flag pickup at the enemy base, marked by a square icon on the map.
- A player can carry only one flag at a time.
Capturing (scoring a capture)
- To score a capture, all of the following conditions must be met:
- The player is carrying the enemy flag
- The player reaches their own base or capture zone
- The player’s team flag is at its base position
- If the team’s flag has been stolen or is dropped somewhere on the map, a capture cannot be scored.
Flag carrier death
- If a player dies while carrying the enemy flag:
- The flag is dropped on the ground at the player’s current position
- The player stops being the flag carrier
Flag carrier disconnection
- If a player disconnects while carrying the enemy flag:
- The flag is dropped on the ground at the player’s last known position
- The player is removed from the match
Flag carrier inactivity (pause)
- If a flag carrier remains paused or inactive for 30 seconds:
- the enemy flag is automatically returned to its base
- the player stops being the flag carrier
Flag auto-return
- If a flag remains dropped on the map and is not recovered:
- It automatically returns to its base after 120 seconds
- When a player dies:
- Players respawn at their team’s base
- A random spawn position is selected for the player (spawn location is not fixed)
- No additional spawn protection is applied
- If they were carrying a flag, the flag drop rule applies
- The match ends only when the timer reaches zero.
- The team with the highest number of captures wins.
- If both teams have the same number of captures:
- The match ends in a draw
- There is no sudden death
- Every 15 minutes, the current map ends and a new map is loaded.
- During map rotation:
- All connected players are frozen
- Players are switched to spectator mode
- A 10-second "loading map" countdown is displayed before the new round starts.
- Teams are rebalanced based on player performance from the previous round:
- Players are reassigned to teams according to their scores
- Team balance is calculated automatically by the system
- Players are not sent to the class selection screen:
- Respawn is automatic
- The system decides the spawn and team assignment
- .NET CLI
- Open Multiplayer
- CompileApp-FS
- Visual Studio 2022
- vscode
- MariaDB
- SQLite
- DB Browser for SQLite
- HeidiSQL
- GitHub Actions
- Git
- draw.io
- Docker
- Portainer
- .NET SDK 10.0
- SampSharp
- SampSharp.OpenMp.Streamer
- omp-streamer-component
- GameMode.Common
- DotEnv.Core
- YeSql.Net
- seztion-parser
- SmartFormat
- MySqlConnector
- Microsoft.Data.Sqlite
- Microsoft.Extensions.DependencyInjection
- Microsoft.Extensions.Configuration.Binder
- Microsoft.Extensions.Configuration.EnvironmentVariables
- BCrypt.Net-Next
- Serilog.Sinks.Console
- Serilog.Sinks.File
- Serilog.Extensions.Logging
These concepts have been applied to this project:
- Hexagonal architecture
- Entity–component–system (ECS)
- Interface-based programming
- Dependency injection
- Repository Pattern
- Operation Result Pattern
- 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 open.mp launcher to connect to the servers.
- Download the appropriate release package for your operating system:
- Windows (x64): capture-the-flag-win-x64.zip
- Linux (x86_64): capture-the-flag-linux-x86_64.tar.xz
- Extract the package to a directory of your choice.
- Modify the
.envfile according to your needs. - Start the Open Multiplayer server:
- Windows:
omp-server.exe - Linux:
./omp-server
- Windows:
- Clone the repository:
git clone --recursive https://github.com/DevD4v3/Capture-The-Flag.git- Change directory:
cd Capture-The-Flag- Copy the contents of
.env.exampleto.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 log.txt- Add the server IP in your omp-launcher:
localhost:7777
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=InMemoryYou must add your name and secret key from the .env file:
# Your nickname in the game.
ServerOwner__Name=MrDave
# Specify the secret key to give me admin.
ServerOwner__SecretKey=1234._%==?!It is necessary to specify your secret key, which you will use when executing the command "/givemeadmin" in the game.
- Create a file called
.envin 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- The database and its schema will be created automatically during server startup if they do not already exist.
- Install MariaDb Server and set up your username and password.
- Create a file called
.envin 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- The database and its schema will be created automatically during server startup if they do not already exist.
- Application Core. Contains all gameplay logic for the Capture the Flag game mode, including the rules and procedures that define how the game is played. It also defines the outbound ports required to interact with external systems.
- Persistence Adapters. Provide concrete implementations of the outbound ports related to persistence. Each adapter encapsulates the data access logic for a specific storage technology, allowing the application core to remain independent of any specific persistence technology.
- Host Application. Acts as the application's entry point and contains everything required to bootstrap the game mode.
- Load application settings from
.envfile. - Select the database provider.
- Register services in the DI container.
- Register ECS systems.
- Enable desired ECS system features.
- Load application settings from
This project would not have been possible without the following people and projects:
- DevD4v3 — Creator of the original Capture the Flag game mode.
- Parca_35 — Helped test the game mode.
- ikkentim — Creator of the SampSharp framework.
- Nickk888SAMP — Creator of NTD (TextDraw Editor).
- samp-incognito — Creator of the Streamer Plugin.
- Open Multiplayer — Creator of open.mp, a multiplayer modification for Grand Theft Auto: San Andreas that is fully compatible with San Andreas Multiplayer (SA-MP).
- OpenSamp
- Maintainer of omp-streamer-component, the x64 port of Incognito's Streamer Plugin for open.mp.
- Creator of SampSharp.OpenMp.Streamer, providing managed (.NET) bindings for the Streamer Plugin on the SampSharp open.mp x64 host.
- 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_dust2x3 by TheYoungCapone.
- EntryMap and TheConstruction by B4MB1[MC].
- fy_snow by UnuAlex.
- fy_snow2 by mihaibr.
- de_dust2 by JamesT85.
- Aim_Headshot by haubitze.
- Aim_Headshot2 by Niktia_Ruchkov.
- de_dust2x1 by SpikY_.
- de_dust2x2 by Amads.
- de_dust2x4 textured by excamunicado.
- WarZone by Samarchai.
- WarZone2 by iMaster.
- 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.
- Baron's Playground (RC Battlefield V2) by Pyraeus.
- cs_train, cs_opposition, fy_iceworld and de_dust2x5 by denis_32.
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
This project is licensed under the GNU Affero General Public License v3.0












