AMX Mod X (Pawn) Code Style Guide
SkillDev toolsHelps with AMX Mod X (Pawn) coding conventions and best practices.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the AMX Mod X (Pawn) Code Style Guide skill
What this skill tells your AI
The instructions your AI receives, as published by hedgefog/amxx-modding-kit in .agents/skills/amxmodx/SKILL.md and read by ahel’s review.
This document provides an overview of coding conventions for AMX Mod X projects. Each topic is covered in detail in its own file.
Core Conventions
| Category | Description |
|---|---|
| Basics | Syntax, basics |
| Code Style | File structure, formatting, braces, spacing, plugin registration |
| Naming Conventions | Hungarian notation, variable prefixes, naming patterns |
| Constants & Enums | Define constants, enums, TASKID constants |
| Macros | Common macros, IS_PLAYER, patterns to avoid |
| Function Declarations | Return types, @ prefix, static variables |
| Validations | FM_NULLENT, entity checks, player validation, early returns |
API Patterns
| Category | Description |
|---|---|
| Hooks | Ham, FakeMeta, ReAPI, Event, Message hooks and handles |
| Forwards | CreateMultiForward, ExecuteForward, pre/post patterns |
| Natives | Native registration and implementation |
| Callbacks | Tasks, SQL queries, CVar queries |
| Menus | Menu creation, callbacks, and patterns |
| Commands | Client, server, and console commands |
| CVars | CVar creation, binding, and change hooks |
Performance & Data
| Category | Description |
|---|---|
| Optimizations | Native call reduction, dynamic hooks, model path caching |
| Data Structures | Arrays, Tries, entity access, strings |
Quick Reference: Best Practices Summary
Code Style
- Always use
#pragma semicolon 1at file start - Use Hungarian notation for all variable names
- Use K&R brace style (opening brace on same line)
- Pass plugin info directly to
register_plugin()- avoid macros - Group hooks and functions with section comments
Constants & Validation
- Use
FM_NULLENTinstead of-1or0for null entity checks - Always check
FM_NULLENTafter entity creation before processing - Return
FM_NULLENTnot0for failures -0is worldspawn - Return early for invalid conditions
Macros
- Don't redefine macros - use shared definitions from includes
- Never use
MACRO()_Suffixpatterns in code - only in macro definitions
Function Declarations
- Use
@prefix only for OOP-like methods:@{EntityName}_{MethodName} - Never add
publickeyword to@prefixed functions - Use
constprefix for all handle arguments - Use
const &thisfor "this" argument in OOP-like methods - Use static variables in frequently called class methods
- Declare and assign static on same line using semicolon separator
Hooks
- Ham hooks must return
HAM_*constants - FakeMeta hooks must return
FMRES_*constants - ReAPI hooks must return
HC_*constants - Message hooks must return
PLUGIN_*constants - Hook handle variables:
g_pfwham(Ham),g_pfwfm(FakeMeta) - Inline
get_user_msgidwhen only used once inregister_message
Forwards
- Forward names use
LibraryName_OnSomething- notFw_prefix - Multi-forward handle variables use
g_pfwprefix
Natives & Callbacks
- Native implementations use
Native_prefix withconstfor arguments - Task callbacks use
Task_prefix with offset in task ID - SQL callbacks use
Callback_SQLQuery_{Name}prefix
Menus
- Menu callbacks use
Callback_Menu_{Name}prefix - Use enum for menu items to avoid index mistakes
- Destroy dynamic menus in callback with
menu_destroy
Commands & CVars
- Command handlers use
Command_prefix, server commands useServerCommand_ - Use
register_concmdfor admin commands that should work from RCON - Avoid
client_cmd- useengclient_cmdfor server-side execution - Use
create_cvarinstead of deprecatedregister_cvar - Use
bind_pcvar_*instead ofget_pcvar_*for cvar access
Optimizations
- Minimize native calls in hot paths
- Use single global
g_pTrace- never create trace handles per-call - Register high-frequency hooks dynamically
- Use
xs_vec_setinstead ofxs_vec_copyfor vector initialization - Cache model index with static inside function, not in separate global
Naming Conventions
- Sound arrays use
g_rgszprefix withg_i*Numcounter - Message IDs use
gmsgprefix (without underscore) - Player arrays use
g_rg*[MAX_PLAYERS + 1]with type prefix - Don't use
idfor players - usepPlayer - Don't use
indexfor entities - usepEntity
Data Structures
- Always free dynamic handles -
ArrayDestroy,TrieDestroyinplugin_end()
Signals
- GitHub stars
- 32
- Forks
- 4
- Last commit
- Aug 2026
Advanced
- Catalog kind
- skill
- Gateway key
amxmodx-basics- Source
- github.com/hedgefog/amxx-modding-kit