What are Plugins?
The CoD4 Unleashed Server plugin system uses the IceOps Plugin API to provide powerful extensions for your game server. Plugins are shared library files (.so files on Linux) that can hook into server events, add custom commands, and interact with game state.
Plugins are based on the IceOps Plugin API developed by Ninja and TheKelm of the IceOps-Team.
Architecture
The plugin system is built with performance and security in mind:- Maximum of 25 plugins can be loaded simultaneously
- Each plugin can register up to 20 commands
- Each plugin can have up to 36 script functions and 36 script methods
- Plugins can export up to 50 functions for use by other plugins
- Each plugin has isolated memory management with up to 50 malloc allocations tracked
Plugin Structure
Every plugin must implement two core functions:Plugin Events
Plugins can hook into various server events by implementing callback functions. All event callbacks are optional exceptOnInit and OnInfoRequest.
Available Events
| Event | Description | Frequency |
|---|---|---|
OnFrame | Called every server frame | ~20ms |
OnOneSecond | Called every second | 1s |
OnTenSeconds | Called every 10 seconds | 10s |
OnPlayerConnect | Player connects to server | Per connection |
OnPlayerDC | Player disconnects | Per disconnect |
OnClientAuthorized | Client passes authorization | Per client |
OnClientSpawn | Client spawns in game | Per spawn |
OnClientEnterWorld | Client enters game world | Per client |
OnMessageSent | Chat message sent | Per message |
OnExitLevel | Map is changing | Per map change |
OnSpawnServer | Server starts | Once |
OnPreFastRestart | Before fast_restart | Per restart |
OnPostFastRestart | After fast_restart | Per restart |
OnClientUserinfoChanged | Client info updated | Per change |
OnClientMoveCommand | Client movement command | Per frame/client |
OnPlayerWantReservedSlot | Reserved slot check | Per connection |
OnTcpServerPacket | TCP packet received | Per packet |
OnUdpNetEvent | UDP network event | Per event |
OnUdpNetSend | UDP packet send | Per send |
OnFilesystemStarted | Filesystem initialized | Once |
Memory Management
Always use
Plugin_Malloc() and Plugin_Free() instead of standard C malloc() and free().Why Use Plugin Memory Functions?
- Automatic cleanup: Memory is freed when plugin unloads
- Double-free protection: Safe to call
Plugin_Free()multiple times - Tracking: Server monitors memory usage per plugin
Plugin Types
Regular Plugins
Standard plugins that can be loaded and unloaded at runtime:Library Plugins
Plugins that export functions for other plugins cannot be unloaded:Secure Mode
When the server runs in secure mode (com_securemode enabled), only plugins with verified checksums will load. This prevents unauthorized plugins from running on production servers.
Commands
The server provides built-in commands for managing plugins:loadPlugin
Load a plugin from the plugins/ directory
unloadPlugin
Unload a running plugin
plugins
List all loaded plugins
pluginInfo
Show detailed info about a plugin
Next Steps
Installation
Learn how to install plugins
Development
Start developing your own plugins
API Reference
Explore the complete plugin API
Examples
See real plugin examples