Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
43cbb55
Update wrapper
ArKaNeMaN Jan 3, 2023
84aec7d
Add docs for utils
ArKaNeMaN Feb 3, 2023
39c8eee
Refactor info srv cmds
ArKaNeMaN Feb 3, 2023
954509f
Add ReadToTrite and abs refs
ArKaNeMaN Feb 5, 2023
12b7567
Fix instant reload for grenades
ArKaNeMaN Mar 27, 2023
9887aef
Fix type warn
ArKaNeMaN Mar 27, 2023
0a9dea4
Fix wrapper free and use in IC
ArKaNeMaN Apr 7, 2023
a98182f
Use JsonUtils for modules
ArKaNeMaN Apr 7, 2023
8ecdacd
Fix instant reload for grenades
ArKaNeMaN Mar 27, 2023
09180d4
Fix type warn
ArKaNeMaN Mar 27, 2023
73622d4
Fix instant reload for grenades
ArKaNeMaN Mar 27, 2023
3f3efe4
Fix type warn
ArKaNeMaN Mar 27, 2023
d10443d
Some fix after rebase
ArKaNeMaN Dec 2, 2023
58523d2
Rewrite limits component
ArKaNeMaN Dec 20, 2023
e7328a9
Complete core rewriting
ArKaNeMaN Mar 23, 2024
ef6f08f
Rewrite items controller
ArKaNeMaN Feb 16, 2025
2d5b14d
Read `Name` param by default (deprecated behaviour)
ArKaNeMaN Feb 17, 2025
5cc2577
Update ic extensions
ArKaNeMaN Feb 17, 2025
a0a74ab
Refactor default item types bundle
ArKaNeMaN Feb 17, 2025
db9bd11
Update ic api usage in vipm modulaes
ArKaNeMaN Feb 17, 2025
00b5ebd
Fix core compile
ArKaNeMaN Feb 17, 2025
0638de3
Impl compat ic api
ArKaNeMaN Feb 17, 2025
0faba10
Impl `CustomWeapon` item type
ArKaNeMaN Feb 21, 2025
9bb2c64
Fix type in file name
ArKaNeMaN Feb 21, 2025
7e473ff
Impl `IC_Item_Free` native
ArKaNeMaN Feb 21, 2025
43f578a
Fix type missmatch
ArKaNeMaN Feb 22, 2025
15061aa
Fix compile warn
ArKaNeMaN Feb 23, 2025
c2df742
Make reunium not required for vipm-l-default
ArKaNeMaN Feb 23, 2025
52101f1
Fix custom weapon item type
ArKaNeMaN Feb 23, 2025
c53a93a
Update item objects (`Type` -> `Item`)
ArKaNeMaN Feb 23, 2025
ee52bb0
Fix misc
ArKaNeMaN Feb 23, 2025
cd22830
Use `PCJson_*` stocks in items controller
ArKaNeMaN Mar 2, 2025
f7100bf
Fix misc
ArKaNeMaN Mar 2, 2025
f9e3ff7
Fox modules limiter
ArKaNeMaN Mar 2, 2025
265da33
Use cached links handle for base objects
ArKaNeMaN Mar 2, 2025
ff1ef64
Remove unused utils
ArKaNeMaN Mar 2, 2025
3226e85
Move logic limits to def bundle
ArKaNeMaN Mar 2, 2025
77eeb1e
Fix `VipM_IC_RegisterTypeEvent` native
ArKaNeMaN Mar 2, 2025
8c52562
Fix links for menus
ArKaNeMaN Mar 16, 2025
5546db2
Fix links for menu items
ArKaNeMaN Mar 16, 2025
0f52374
Fix IsActive native in modules api
ArKaNeMaN Mar 17, 2025
545225e
Update core api
ArKaNeMaN Apr 1, 2025
01cdc03
Use new things instead deprecated
ArKaNeMaN Apr 1, 2025
cc2d1a7
Update requirements
ArKaNeMaN Apr 1, 2025
96b84b5
Fix `CustomWeapon` item
ArKaNeMaN Apr 19, 2025
d17e7b3
Fix ic compat api
ArKaNeMaN Apr 23, 2025
b6469ff
Use PCGet and PCSingle
ArKaNeMaN Jun 14, 2025
1cc6674
Add params for some items types
ArKaNeMaN Jun 14, 2025
616f547
Minor update config impl in modules
ArKaNeMaN Jun 14, 2025
3e954b0
Update
ArKaNeMaN Jun 14, 2025
5a42686
Fix health item
ArKaNeMaN Jun 15, 2025
c936e9b
Fix weapon menus
ArKaNeMaN Jun 15, 2025
cfc9792
Add `Function` item type
ArKaNeMaN Jun 15, 2025
1cb70f4
Update params controller version in readme
ArKaNeMaN Jun 15, 2025
418f78e
Cleanup utils
ArKaNeMaN Jun 15, 2025
b6f46ee
Add param types for limits
ArKaNeMaN Jun 15, 2025
bd56b83
Deprecate old path utils from vipm
ArKaNeMaN Jun 15, 2025
f46b01e
Use params controller for all params lists
ArKaNeMaN Sep 6, 2025
6719a00
Reg params by AddParamsEx in all modules
ArKaNeMaN Sep 6, 2025
24987dc
Move "If" iteom type to core
ArKaNeMaN Sep 7, 2025
5dd882e
Fix vampire module
ArKaNeMaN Sep 7, 2025
0171051
Fix vip's access check
ArKaNeMaN Sep 7, 2025
cd8b189
Use `ChatMessage` param type from new PC version
ArKaNeMaN Sep 14, 2025
b033c33
Move some limits to vipm core
ArKaNeMaN Sep 20, 2025
2e45d6d
Impl `Counter` limit
ArKaNeMaN Oct 11, 2025
8eaa00b
Refactor all limits
ArKaNeMaN Oct 12, 2025
bafabc3
Fix
ArKaNeMaN Oct 12, 2025
a3dd236
Add `WasKilled/Alive` limits
ArKaNeMaN Oct 12, 2025
9e1f82a
Update params usage in limits
ArKaNeMaN Oct 12, 2025
cedc7c8
Remove some utils
ArKaNeMaN Oct 12, 2025
909539a
Fix
ArKaNeMaN Oct 12, 2025
f928f14
Use consts for param types and merge changes from legacy version
ArKaNeMaN Oct 18, 2025
fd4cef2
Some refactor and update ci script
ArKaNeMaN Oct 19, 2025
93d676f
Use counter limit api for weapon menu counters
ArKaNeMaN Jan 4, 2026
9c92c3a
Try to fix CI
ArKaNeMaN Jan 6, 2026
03a5ffb
Some refactors
ArKaNeMaN Jan 6, 2026
1f0b3c7
Fix
ArKaNeMaN Jan 6, 2026
c941e91
Yet another try to fix CI))
ArKaNeMaN Jan 6, 2026
d440a10
Bump params controller version
ArKaNeMaN Jan 6, 2026
c7ab72e
Some refactors
ArKaNeMaN Jan 7, 2026
ba83aae
Bump vipm and ic versions to rc
ArKaNeMaN Feb 10, 2026
b0e3529
Fix json refs usage; Fix `If` item type
ArKaNeMaN Feb 20, 2026
b1dc14a
Bump version
ArKaNeMaN Feb 20, 2026
29adaea
Add `Inc` param to `Counter` limit
ArKaNeMaN Feb 20, 2026
944219b
Fix weapon menus
ArKaNeMaN Feb 21, 2026
f4c4dc1
Fix `Counter` limit
ArKaNeMaN Feb 21, 2026
c314f9f
Bump version
ArKaNeMaN Feb 21, 2026
f5016b2
Update pc dep
ArKaNeMaN Feb 21, 2026
b2be45a
Fix inactive menu item display
ArKaNeMaN Feb 23, 2026
fb83de4
Fix `VipM_Modules_GetParams` for some cases
ArKaNeMaN Feb 24, 2026
78c1f39
Add logs to modules limiter
ArKaNeMaN Feb 26, 2026
5b42784
Add `StayOpen_WhenRestricted` param to WeaponMenu module
ArKaNeMaN Feb 26, 2026
ed8b517
Fix modules limiter
ArKaNeMaN Feb 26, 2026
ad57e27
Try to use separated workflow stage for deps
ArKaNeMaN Feb 26, 2026
163c7a1
Bump version
ArKaNeMaN Feb 26, 2026
bb54b86
Fix pc init order
ArKaNeMaN Mar 4, 2026
f0e260e
Bump version
ArKaNeMaN Mar 4, 2026
eb7fd14
Add docs for claude code
ArKaNeMaN Apr 9, 2026
8a418ea
Use const param type names for all def objs
ArKaNeMaN Apr 9, 2026
0ed63a6
Update map limit
ArKaNeMaN Apr 10, 2026
333670c
Use PCParam style for all params register
ArKaNeMaN Apr 10, 2026
f0b186c
Specify deps install action version (instead master)
ArKaNeMaN Apr 10, 2026
cba5406
Update README.md
ArKaNeMaN Apr 10, 2026
521e22e
Update README.md
ArKaNeMaN Apr 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [master]
branches: [master, feature/**, fix/**]
paths-ignore:
- "**.md"

Expand All @@ -14,8 +14,11 @@ on:
env:
PACKAGE_NAME: VipModular
STORE_README: 0
GENERATE_PLUGINS_INI: 1
PLUGINS_INI_GENERATE: 1
PLUGINS_INI_POSTFIX: vipm
DEPS_LIST: |
AmxxModularEcosystem/ParamsController@1.4.0
AmxxModularEcosystem/CommandAliases@1.0.1

jobs:
build:
Expand Down Expand Up @@ -52,6 +55,7 @@ jobs:
- name: Setup latest ReAPI includes
env:
REPO: "rehlds/ReAPI"
OUTPUT_VAR_NAME: REAPI_INCLUDE_PATH
run: |
mkdir -p dep/reapi
cd dep/reapi
Expand All @@ -64,7 +68,12 @@ jobs:

7z x *.zip

echo "REAPI_INCLUDE_PATH=$(pwd)/addons/amxmodx/scripting/include" >> $GITHUB_ENV
echo "${OUTPUT_VAR_NAME}=$(pwd)/addons/amxmodx/scripting/include" >> $GITHUB_ENV

- uses: AmxxModularEcosystem/install-amxmodx-deps@v1
with:
deps_list: ${{ env.DEPS_LIST }}
output_var_name: DEPS_COMPILER_ARGS

- name: Setup AMXXPawn Compiler
uses: wopox1337/setup-amxxpawn@v1.1.0
Expand All @@ -75,8 +84,9 @@ jobs:
working-directory: amxmodx/scripting/
env:
REAPI_INCLUDE: ${{ env.REAPI_INCLUDE_PATH }}
GENERATE_PLUGINS_INI: ${{ env.GENERATE_PLUGINS_INI }}
PLUGINS_INI_GENERATE: ${{ env.PLUGINS_INI_GENERATE }}
PLUGINS_INI_POSTFIX: ${{ env.PLUGINS_INI_POSTFIX }}
DEPS_COMPILER_ARGS: ${{ env.DEPS_COMPILER_ARGS }}
run: |
compile() {
sourcefile=$1
Expand All @@ -85,13 +95,14 @@ jobs:

mkdir -p $(dirname $output_path)

echo -n "Compiling $sourcefile ... "
echo "Compiling $sourcefile... "
amxxpc $sourcefile -o"$output_path" \
-i"include" \
-i"$REAPI_INCLUDE" \
-i"$PARAMS_CONRTOLLER_INCLUDE"
$DEPS_COMPILER_ARGS \
GITHUB_ACTIONS_USED=1

if [ ! -z "${GENERATE_PLUGINS_INI}" ]; then
if [ ! -z "${PLUGINS_INI_GENERATE}" ]; then
plugin_ini_path="../configs/plugins-${PLUGINS_INI_POSTFIX}.ini"
touch $plugin_ini_path
echo $amxxfile >> $plugin_ini_path
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.zip
.build
plugins-*.ini
.claude
22 changes: 0 additions & 22 deletions .vscode/vipm-src.code-snippets

This file was deleted.

186 changes: 186 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# VipModular — Project Context

Modular VIP/privilege system for **Counter-Strike 1.6** built on **AMX Mod X** (AMXX), written in **Pawn**.
Version: `5.0.0-rc4f1` | Author: ArKaNeMaN

> For deeper detail on each subsystem, see `docs/claude/`.

---

## What it does

Lets server admins define privilege tiers (VIPs) in JSON configs. Each privilege specifies:
- **Conditions** (`Access`) — which players qualify (Limits system)
- **Features** (`Modules`) — what those players get (Modules system)

Modules and limits are fully extensible: third-party plugins register new types at runtime.

---

## Plugin files

| File | Role |
|------|------|
| `VipModular.sma` | Core — init, config loading, player update lifecycle |
| `ItemsController.sma` | Standalone item-effects framework (give weapon/health/etc.) |
| `VipM-Misc.sma` | Reload helper — triggers `VipM_UserUpdate` on spawn/round events |
| `VipM-ModulesLimiter.sma` | Enables/disables modules per-map via `Modules.json` |
| `VipM-M-WeaponMenu.sma` | Module: weapon selection menu |
| `VipM-M-SpawnItems.sma` | Module: give items on spawn |
| `VipM-M-SpawnHealth.sma` | Module: set health/armor on spawn |
| `VipM-M-Vampire.sma` | Module: heal on kill |
| `VipM-M-VipInTab.sma` | Module: VIP label in scoreboard |

---

## Source layout

```
amxmodx/scripting/
├── include/VipModular.inc — public API header (include this in plugins)
├── include/VipM/Modules.inc — module system API
├── include/VipM/Limits.inc — limits system API
├── include/ItemsController.inc — items system API
├── VipM/
│ ├── Core/
│ │ ├── VipsManager.inc — loads Vips.json, manages g_tUserModules[]
│ │ ├── Objects/Modules/Type.inc — module type registry (ArrayMap)
│ │ ├── Objects/Modules/Unit.inc — module instance (params per VIP entry)
│ │ ├── Objects/Limits/Type.inc — limit type registry
│ │ ├── Objects/Limits/Unit.inc — limit instance
│ │ ├── Objects/VipUnit.inc — deserializes one privilege from JSON
│ │ └── API/{Main,Modules,Limits}.inc — native implementations
│ ├── DefaultObjects/
│ │ ├── Limit/*.inc — 24 built-in limit types
│ │ └── Registrar.inc — registers all defaults
│ ├── Forwards.inc — thin macro wrapper over CreateMultiForward
│ ├── ArrayMap.inc — string-keyed array map (used for type registries)
│ └── WeaponMenu/ — WeaponMenu module implementation
└── ItemsController/
├── Objects/Items/{Type,Instance}.inc
├── API/{ItemType,Item,Compat}.inc
└── DefaultObjects/ItemType/ — 18 built-in item types
```

---

## Core data flow

```
plugin_precache
Forwards_RegAndCall("VipM_Modules_OnInited") ← modules register here
Forwards_RegAndCall("VipM_Limits_OnInited") ← limits register here
IC_ItemType_OnInited() ← item types register here
VipsManager_LoadFromFile("Vips.json")
VipsManager_LoadFromFolder("Vips/")
ModuleType_ActivateUsed() ← fires Module_OnActivated
Forwards_RegAndCall("VipM_OnLoaded")

client_putinserver → RequestFrame → VipsManager_UserReload(playerIndex)
for each VipUnit: check Access limits → grant matching Modules
result stored in g_tUserModules[playerIndex]: Trie<moduleName → Trie<params>>
fires VipM_OnUserUpdated(playerIndex)

client_disconnected → VipsManager_UserReset(playerIndex) ← frees all Tries
```

---

## Key patterns

- **Type registries** use `ArrayMap` (string key → index cast to enum type, e.g. `T_ModuleType`, `T_LimitType`)
- **Params** stored in AMXX `Trie` (string key → value); parsed from JSON via ParamsController
- **Forwards** wrapped in `Forwards_Reg` / `Forwards_Call` macros (`VipM/Forwards.inc`)
- **Object handles** are array indices cast to enum type — `Invalid_*` sentinel = `-1`
- **Static limits** store a bitmask instead of calling a forward (faster, no params)

---

## External dependencies

| Library | Min version | Purpose |
|---------|-------------|---------|
| ParamsController | 1.3.2 | JSON parsing, param reading, path utils (`PCPath_*`, `PCJson_*`, `PCGet_*`) |
| CommandAliases | 1.0.1 | Server command aliasing |
| ReAPI | 5.24.0.300 | Game hooks: `RG_CBasePlayer_Spawn`, `RG_CSGameRules_RestartRound`, etc. |

---

## Config files

All under `amxmodx/configs/plugins/VipModular/`:

| File | Purpose |
|------|---------|
| `Vips.json` | Privilege definitions (or `Vips/` folder for multiple files) |
| `Modules.json` | Module enable/disable rules (read by `VipM-ModulesLimiter`) |
| `Items/*.json` | Reusable item definitions |

`"File:WeaponMenu/Premium"` in JSON → resolves to `configs/plugins/VipModular/WeaponMenu/Premium.json`

---

## Local-only docs

Some context is intentionally kept out of the repository (e.g. local tool paths).
Check `.claude/` memory for a `local-env.md` file — if it exists, read it before working with the build system or dependency headers.

---

## Sub-docs

- [`docs/claude/module-system.md`](docs/claude/module-system.md) — registering & using modules
- [`docs/claude/limits-system.md`](docs/claude/limits-system.md) — registering & using limits
- [`docs/claude/items-system.md`](docs/claude/items-system.md) — ItemsController API
- [`docs/claude/config-format.md`](docs/claude/config-format.md) — Vips.json format reference

---

## Working rules for Claude

### Code style

Match the existing style exactly. Key conventions:

**Naming — identifiers**

| Kind | Convention | Example |
|------|-----------|---------|
| Local variables | camelCase | `playerIndex`, `menuIndex`, `params` |
| Global variables | PascalCase (capital first letter) | `UserAutoOpen`, `UserLeftItems`, `Vips` |
| Public functions / API | `Namespace_PascalCase` | `VipsManager_Init`, `ModuleType_Find` |
| Static (private) functions | `Namespace_PascalCase` + `static` keyword | `static LimitType_Get(...)` |
| Internal helpers | `_PascalCase` | `_Cmd_Menu` |
| Native/forward callbacks | `@FullNativeName` | `@RG_CBasePlayer_Spawn`, `@Module_OnActivated` |
| Enum handle types | `T_Name` | `T_ModuleType`, `T_VipUnit` |
| Enum struct layouts | `S_Name` | `S_ModuleType`, `S_WeaponMenu` |
| Enum (actual enumerations) | `E_Name` | `E_ModuleEvent`, `E_LimitEvent` |
| Enum fields | `StructName_FieldName` | `ModuleType_Name`, `VipUnit_Access` |
| Constants / macros | `SCREAMING_SNAKE_CASE` | `MODULE_NAME`, `TASK_OFFSET_AUTO_OPEN` |

**No Hungarian notation anywhere.** Don't add `i`, `s`, `f`, `b`, `g`, `g_` prefixes to variables — not on locals, not on globals. The existing codebase has legacy `g_aVips`, `gUserAutoOpen`, `iRet`, `sName` etc. — don't copy that pattern into new code.

**Formatting**
- 4-space indentation
- Braces on same line for control flow: `if (...) {`
- Single blank line between logical blocks; two blank lines between top-level function definitions
- Long argument lists: one argument per line, aligned to opening paren
- Conditions spanning multiple lines: each sub-condition on its own line, operator at start

**Other**
- Use `PCGet_*` / `PCSingle_*` helpers from ParamsController for reading params from Trie/JSON — don't read Tries directly where a helper exists
- Prefer `Invalid_*` sentinel checks over magic `-1` literals
- Don't add error handling for cases the framework already guards against

---

### Documentation maintenance

**After every code change, update the relevant `docs/claude/*.md` file** to reflect what changed:
- New module → update `docs/claude/module-system.md`
- New/changed limit type → update `docs/claude/limits-system.md`
- New/changed item type → update `docs/claude/items-system.md`
- Config format change → update `docs/claude/config-format.md`
- Structural change affecting multiple systems → update `CLAUDE.md` and the affected sub-docs

If a change doesn't fit any existing sub-doc, create a new one in `docs/claude/` and add it to the sub-docs list above.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Modular Vip System
# Vip Modular

Модульная система привилегий.

## Требования

- [ParamsController](https://github.com/AmxxModularEcosystem/ParamsController) версии [1.4.0](https://github.com/AmxxModularEcosystem/ParamsController/releases/tag/1.4.0) или [выше](https://github.com/AmxxModularEcosystem/ParamsController/releases/latest).
- [CommandAliases](https://github.com/AmxxModularEcosystem/CommandAliases) версии [1.0.1](https://github.com/AmxxModularEcosystem/CommandAliases/releases/tag/1.0.1-fix1) или [выше](https://github.com/AmxxModularEcosystem/CommandAliases/releases/latest).
- [ReAPI](https://github.com/rehlds/ReAPI) версии [5.24.0.300](https://github.com/rehlds/ReAPI/releases/tag/5.24.0.300) или [выше](https://github.com/rehlds/ReAPI/releases/latest).

## Инструкции по настройке

- [Основные настройки](readme/configs.md)
Expand All @@ -15,18 +21,12 @@
| :-------------------------------- | :---------------------------------------------------------- |
| `vipm_update_users` | Обновляет привилегии у всех игроков |
| `vipm_info` | Выводит информацию о системе привилегий |
| | |
| `vipm_modules` | Выводит таблицу модулей и их статусов |
| `vipm_module_params <ModuleName>` | Выводит таблицу параметров указанного модуля |
| | |
| `vipm_limits` | Выводит таблицу типов проверок и некоторую информацию о них |
| `vipm_limit_params <LimitType>` | Выводит таблицу параметров указанного типа проверки |
| | |
| `vipm_ic_types` | Выводит таблицу типов предметов |
| `ic_item_types` | Выводит таблицу типов предметов |

## Идеи

- _\[Configs\]_ Добавить глобальные настройки типа ключ-значение, на которые можно ссылаться из основных конфигов как на файлы, только с префиксом Var:
- _\[Modules\]_ Переработать обьедининение параметров модулей
- _\[ReadMe\]_ Нарисовать схему взаимодействия компонентов системы
- _\[IC\]_ Придумать как норм отвязать IC от ядра и, возможно, вынести его в отдельный репо
- _\[IC\]_ Придумать как норм отвязать IC от ядра и, возможно, вынести его в отдельный репо (WIP)
34 changes: 34 additions & 0 deletions amxmodx/configs/plugins/CommandAliases/VipM-M-WeaponMenu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"Command": "vipm_m_weaponmenu_menu",
"Alias": [
"vm",
"say /vm",
"say_team /vm",
"vipmenu",
"say /vipmenu",
"say_team /vipmenu"
]
},
{
"Command": "vipm_m_weaponmenu_menu_silent",
"Alias": [
"vm_silent",
"vipmenu_silent"
]
},
{
"Command": "vipm_m_weaponmenu_autoopen_toggle",
"Alias": [
"vm_autoopen",
"say /vm_autoopen",
"say_team /vm_autoopen",
"vm_ao",
"say /vm_ao",
"say_team /vm_ao",
"vipmenu_autoopen",
"say /vipmenu_autoopen",
"say_team /vipmenu_autoopen"
]
}
]
Loading