Skip to main content

pymodcs — PyMod SDK / SDK для PyMod

Write Python plugins for Counter-Strike 1.6 / ReHLDS / ReGameDLL. The distribution is named pymodcs, the Python import is pymod.

python -m pip install pymodcs
from pymod import Plugin, Player, command, Color, Position

class Welcome(Plugin):
    config = {"text": "Hello, {name}!"}          # configs/welcome.json
    player_settings = {"greetings": True}         # saved per player automatically

    @command("hello")
    def hello(self, player: Player):
        if self.player_settings[player].greetings:
            player.message(self.config.text, name=player.name, color=Color.Green())
            player.hud("Welcome!", position=Position.Top, color=Color.HEX("#6EE7C2"))
        self.store["greetings"] = self.store.get("greetings", 0) + 1   # persisted on disk

0.20: plain config values, player_settings, self.store, @shared methods with self.plugin("name"), menus from a dict and @every("setting"). The 0.19 API is unchanged.

from pymod import * is supported too. PyCharm and other type-aware editors can read bundled .pyi files and py.typed; no IDE extension is required. Annotate callback arguments with Player, DamageEvent, etc. for reliable completion in ordinary editors. No PyMod IDE plugin is needed.

Русский

Пакет для разработки плагинов: API текущего ядра, подсказки параметров, типы игроков и 155 хуков, документация методов на русском и английском. Выберите в IDE тот интерпретатор, куда установили pymodcs.

Встроенная документация доступна через Ctrl+Q в PyCharm, help() и команду:

python -m pymod docs Player.hud --lang ru
python -m pymod docs hook_events.DamageEvent --lang en
python -m pymod new Welcome --output welcome.py --lang ru

Цвета, координаты, описания конфигов и ресурсов можно использовать в обычном Python. Игровые действия (чат, игроки, оружие, SQLite плагина, хуки) требуют сервер с нативным ядром PyMod. Вне сервера такие вызовы явно завершаются ServerRequiredError, а не имитируют успешное выполнение.

Скопируйте созданный .py в cstrike/addons/pymod/plugins/ своего сервера. Пакет SDK не содержит сервер CS, DLL/SO, личные плагины, базы и ключи. Не копируйте SDK поверх серверного ядра и не устанавливайте его через серверную команду pip install: ядро уже предоставляет модуль pymod. На сервере используется API 0.20.0 и встроенный Python 3.14 x86; на рабочем компьютере SDK поддерживает Python 3.11+.

Для import pymod используйте отдельное виртуальное окружение: пакет с именем pymod на PyPI принадлежит другому проекту и не должен стоять рядом с pymodcs.

English

This is a development SDK, not a game server or an engine emulator. It includes the current Python API, type information, all 155 hook classes, RU/EN docstrings, and public teaching examples. Use the same interpreter in your editor that you used for installation.

Colors, vectors, configuration descriptors and resource declarations work in regular Python. Engine operations and plugin-owned storage require the native PyMod server runtime. They raise ServerRequiredError outside the server.

from pymod import Color, Position
print(Color.RGB(70, 220, 235).hex)  # #46DCEB
print(Position.percent(x=50, y=10))
help(Color.HEX)  # Russian and English documentation

Create a plugin with python -m pymod new Welcome --output welcome.py --lang en, then copy it to cstrike/addons/pymod/plugins/ on a PyMod server. Match the SDK API version to your server. Do not install this SDK into the server's managed dependencies or overwrite its Python package. Use an isolated virtual environment without the unrelated PyPI distribution named pymod.

Full method signatures remain available in source and stubs. Docstrings show both languages; the command-line reference can select --lang ru or --lang en. Public guides and examples are included as pymod/docs and pymod/examples.

The source is GPL-2.0-or-later with the bundled HL Engine linking exception.

Metadata

Release files for pymodcs 0.28.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymodcs 0.28.0
File Size Uploaded Provenance Actions
pymodcs-0.28.0.tar.gz 453.9 kB Without provenance Details for pymodcs-0.28.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pymodcs 0.28.0
File Interpreter ABI Platform Actions
pymodcs-0.28.0-py3-none-any.whl Python 3 none any Details for pymodcs-0.28.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / pymodcs-0.28.0.tar.gz

Download URL pymodcs-0.28.0.tar.gz
Size 453.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9e2c7e9cd93c85e60dd561ca0fbb42cf044fe64284d5149a8e17c40becb14773
BLAKE2b-256 checksum
How to use checksums
d6e2a3c03424b63e720cae5b1ea6da39f8b93b4d14cdbcb35752618cc5343a3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Release files / pymodcs-0.28.0-py3-none-any.whl

Download URL pymodcs-0.28.0-py3-none-any.whl
Size 689.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0c0f00cd5e4391d39b427e410f2486efd342814c3c9d78a800ed502895c3abf
BLAKE2b-256 checksum
How to use checksums
6b5f225ff0816d63d2ba35bee7e3b073807b0f4a3bb9f9290dd6f147814d019c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Security for pymodcs 0.28.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page