Appearance
Add a feature or command
Use these recipes to fit a change into the existing framework. They assume you already know Pawn and your development tools.
Add a module
- Create
gamemodes/yourmodule/header.pwnand a short module comment. - Include dependent files in the header, then include the header from
gamemode.pwnat the right point. - Add state to the correct persistent or temporary structure.
- Hook the lifecycle callbacks needed to initialise/reset it.
- Add a database loader to the appropriate startup path if it persists entities.
- Add help/documentation and verify both enabled and disabled configurations if optional.
Do not keep per-player temporary values without resetting them on logout/disconnect. A reused player ID must not inherit a previous player’s state.
Add a command
pawn
// /frameworkhello - an example command in a module included by the gamemode.
CMD:frameworkhello(playerid, params[]) {
#pragma unused params
return SendServerMessage(playerid, COLOR_BLUE, "Example", "DEDEDE", "Hello from your module.");
}Put commands near their owning system. Validate input and player/target state, enforce permissions inside the handler and reuse existing helpers. Update in-game help. For a privileged action, test an unauthorised caller as well as an administrator.
Do not assume global command prechecks replace feature-specific ownership, range, duty or capability checks. Aliases should call the canonical handler so they inherit its checks.
Add persistent data
Add a reviewed SQL migration and update the clean schema for new installations. Extend the relevant enum, load/cache functions and save/update paths. The account and character layers are separate: choose the intended scope before adding a field.
Use escaped/formatted queries for strings and appropriate asynchronous callbacks. Consider disconnect/reconnect or entity deletion before an asynchronous result returns. Do not confuse a transient array index with a permanent record ID.
Add a job
Read jobs/pizza/header.pwn and the simplified jobs/trucker/header.pwn. Include the job from the jobs header and use the established initialization path. Define start, completion, cancellation, disconnect and vehicle-reset behaviour explicitly.
Reward successful work through logged money helpers. Keep cargo/inventory ownership coherent; the trucker job stores crates in vehicle slots so handover does not duplicate cargo.
Add factions, maps or assets
Use existing faction types/capabilities and keep Pawn/web shared constants aligned. New squads need unique IDs in both codebases. Map objects belong in the map include pattern, with only necessary stock removals.
For custom character skins, reuse the optional registration path rather than scattering unvalidated model IDs. For custom world objects/attachments, register assets and configure downloads before exposing choices to players.
Validate a change
Compile with the pinned settings. Use relevant web/agent tests if those components changed, then exercise the feature in a private game session. Check persistence after reconnect/restart and failure/cancellation paths. Add focused regression tests when they verify meaningful behaviour, not merely the implementation’s shape.