ZORP Module Quick Reference - zombie-outbreak/ZO-RP-OMP GitHub Wiki
Where To Find Things
Core Configuration & Data
| What You Need | File Location |
|---|---|
| Server name, MySQL settings | modules/core/config.pwn |
| MAX_PLAYERS, MAX_ITEMS, timers | modules/core/constants.pwn |
| Colors (0xRRGGBBAA and {FFFFFF}) | modules/core/colors.pwn |
| MySQL connection handle | modules/core/database.pwn |
| Player data (E_PLAYERS, player[]) | modules/core/player_data.pwn |
Game Systems
| System | File Location | Purpose |
|---|---|---|
| Inventory | modules/systems/inventory.pwn |
Items, loot, scavenging |
| Vehicles | modules/systems/vehicles.pwn |
Vehicle management, fuel |
| Interiors | modules/systems/interiors.pwn |
Properties, buildings |
| Crafting | modules/systems/crafting.pwn |
Recipe system |
| Factions | modules/systems/factions.pwn |
Factions & territories |
Commands
| Commands | File Location |
|---|---|
| Admin commands | modules/commands/admin_cmds.pwn |
| Player commands | modules/commands/player_cmds.pwn |
Utilities
| Utility | File Location | Purpose |
|---|---|---|
| Helper functions | modules/utilities/functions.pwn |
SendPlayerServerMessage, etc. |
| Map parsing | modules/utilities/map.pwn |
MTA map loader, object removal |
| Database setup | modules/utilities/sql.pwn |
SetupDatabase, create tables |
| Timers | modules/utilities/timers.pwn |
Hunger, thirst, disease timers |
| Textdraws | modules/utilities/textdraws.pwn |
HUD creation & management |
| Dialogs | modules/utilities/dialogs.pwn |
Dialog handlers |
Adding a New System Module
- Create file:
modules/systems/your_system.pwn - Use this template:
// ============================================================================
// ZOMBIE OUTBREAK ROLEPLAY - YOUR SYSTEM NAME
// ============================================================================
/*
* MODULE: Your System
* PURPOSE: Brief description
*
* DEPENDENCIES:
* - core/config.pwn
* - core/constants.pwn
* - core/player_data.pwn
*
* PUBLIC FUNCTIONS:
* - YourSystemInitialize()
* - YourSystemDoSomething()
*/
// ============================================================================
// CONFIGURATION
// ============================================================================
#if !defined MODULE_YOUR_SYSTEM_INCLUDED
#define MODULE_YOUR_SYSTEM_INCLUDED
// System-specific defines
#define MAX_YOUR_ITEMS 100
// ============================================================================
// DATA STRUCTURES
// ============================================================================
enum E_YOUR_DATA
{
yourId,
yourValue,
// ...
}
// ============================================================================
// GLOBAL VARIABLES
// ============================================================================
new YourData[MAX_YOUR_ITEMS][E_YOUR_DATA];
new YourSystemCount = 0;
// ============================================================================
// FORWARD DECLARATIONS
// ============================================================================
forward OnYourSystemInit();
// ============================================================================
// PUBLIC API
// ============================================================================
YourSystemInitialize()
{
// Initialization code
}
// ============================================================================
// INTERNAL FUNCTIONS
// ============================================================================
static YourSystemInternalHelper()
{
// Private helper function
}
// ============================================================================
// CALLBACKS
// ============================================================================
public OnYourSystemInit()
{
// System initialization
}
#endif // MODULE_YOUR_SYSTEM_INCLUDED
- Add to
gamemodes/zorp.pwnin the systems section:
// GAME SYSTEMS
#include "modules/systems/inventory.pwn"
#include "modules/systems/vehicles.pwn"
#include "modules/systems/interiors.pwn"
#include "modules/systems/crafting.pwn"
#include "modules/systems/factions.pwn"
#include "modules/systems/your_system.pwn" // <-- Add here
Include Order (IMPORTANT!)
Always maintain this order in zorp.pwn:
- Core modules (config, constants, colors)
- Libraries (open.mp, MySQL, etc.)
- Core data (database, player_data)
- Systems (inventory, vehicles, etc.)
- Utilities (functions, timers, etc.)
- Commands (player_cmds, admin_cmds)
Why? Systems define data structures that utilities need to access.
Common Tasks
Adding a New Constant
Edit: modules/core/constants.pwn
#define MY_NEW_CONSTANT 100
Adding a New Color
Edit: modules/core/colors.pwn
#define COLOR_MYCOLOR 0xFF00FFFF
#define COL_MYCOLOR "{FF00FF}"
Changing MySQL Settings
Edit: modules/core/config.pwn
#define MYSQL_HOST "localhost"
#define MYSQL_USER "root"
// etc...
Adding to Player Data
Edit: modules/core/player_data.pwn
enum E_PLAYERS
{
// ... existing fields
myNewField, // Add your field here
}
Creating a New Command Module
- Create:
modules/commands/your_cmds.pwn - Add commands using
CMD:commandname(playerid, params[]) - Include in
zorp.pwnunder the commands section
Module Dependencies
config.pwn
↓
constants.pwn
↓
colors.pwn
↓
[LIBRARIES]
↓
database.pwn
↓
player_data.pwn
↓
systems/*.pwn (inventory, vehicles, interiors, crafting, factions)
↓
utilities/*.pwn (functions, map, sql, timers, textdraws, dialogs)
↓
commands/*.pwn (player_cmds, admin_cmds)
Best Practices
✅ DO:
- Keep modules focused on a single responsibility
- Document your module headers
- Use
staticfor module-private functions - Group related code in the same module
❌ DON'T:
- Don't put system-specific code in utilities
- Don't create circular dependencies
- Don't use global variables without documentation
- Don't skip the module header template
- Don't mix core configuration with system logic
Git Workflow Tip
When working on a specific feature:
- Create a feature branch
- Only required if making large changes to existing modules or creating a whole new module.
- Work in the relevant module(s)
- Test compilation:
qawno/pawncc.exe gamemodes/zorp.pwn - Test in-game functionality
- Commit with clear message:
factions: add territory alerts - Create pull request
Need Help?
- Check existing modules for examples (crafting.pwn, factions.pwn are great!)
- This reference is just that... a reference. It isn't the perfect example but is a great starting point. As long as you follow the key structure of a module you'll be fine!
- Read the module headers for documentation