Complete, working examples for extending FivePRS: a callout pack, a plugin, terminal apps and a Lua resource. Copy one as the starting point for your own, then list it on the Assets page when it's ready.
| Example | Type | Shows |
|---|---|---|
callouts/ExampleCallouts |
Callout pack | Four callouts, one per pattern |
plugins/ShiftTracker |
Plugin | FivePRS events, a chat command and a server setting |
apps/ExampleApps |
Terminal apps | A drawn screen app and an app with its own page |
resources/fiveprs_example_hud |
Resource | A duty HUD from getState() and events, in Lua |
Every example is MIT licensed, so you can copy any of it into your own work.
You need the .NET SDK 8 or newer, on Windows, Linux or macOS.
git clone https://github.com/FivePRS/examples
cd examples
dotnet build -c ReleaseThe first build downloads the FivePRS release it compiles against into .fiveprs/. The version is set by FivePRSVersion in build/FivePRS.props. Change it, or pass -p:FivePRSVersion=<version>, to build against another release.
Builds land in dist/fiveprs/, laid out like the resource:
dist/fiveprs/
callouts/ExampleCallouts.net.dll
plugins/ShiftTracker.net.dll
apps/ExampleApps.net.dll
apps/fieldlog/
Copy it over your server's resources/fiveprs folder and restart fiveprs. To have every build copied there for you, set FIVEPRS_RESOURCE to that folder first:
$env:FIVEPRS_RESOURCE = "C:\server\resources\fiveprs" # PowerShellexport FIVEPRS_RESOURCE=~/server/resources/fiveprs # bashresources/fiveprs_example_hud needs no build: copy the folder into resources/ and add ensure fiveprs_example_hud after ensure fiveprs.
ExampleCallouts builds one DLL with four callouts. Read them in this order:
| Callout | Department | Pattern |
|---|---|---|
| Noise Complaint | Police | The basics: a location list, night-only dispatch, spawning when the player is close, talking to a ped with the interact key, and two possible endings |
| Armed Suspect | Police | A search area, waiting until the player can see the suspect, then surrender, foot pursuit or a fight |
| Cardiac Arrest | EMS | Building on the EMS module's PatientCallout: you set up the scene, FivePRS handles treatment and transport. OnUpdate runs every frame |
| Dumpster Fire | Fire | Spawning a prop and using the Fire module's FireScene to start fires and check when they're out |
Every entity and blip goes through TrackEntity or TrackBlip, so FivePRS removes it when the call ends however it ends. Anything else you set up, such as interaction handlers or fires, is cleaned up in OnCleanup.
ShiftTracker counts each shift's length, calls offered and arrests, using the FivePRS:Local:DutyChanged, FivePRS:Local:CalloutReceived and FivePRS:Local:SuspectCuffed events. Players type /shift for their stats and get a summary when they go off duty.
It reminds players to take a break every 120 minutes on shift. Server owners change that in server.cfg with a replicated convar, which plugins can read on the client:
setr shifttracker_reminder_minutes 90 # 0 turns reminders offExampleApps builds one DLL with two apps:
- 10-Codes is a drawn screen: FivePRS renders a search form, group buttons and a list from an
AppScreen, and callsOnActionwhen they're used. - Field Log has its own page. The page sends an action with the SDK, the C# side adds the time and the player's street, and sends the entries back. Its badge shows the number of entries.
Pages live under apps/<name>/ in the resource, which fiveprs already serves.
fiveprs_example_hud is a standalone resource that shows your callsign, status and current call while you're on duty. It reads exports.fiveprs:getState() every second and refreshes straight away when FivePRS:Local:DutyChanged fires. /dutyhud hides it. The same approach works in JavaScript or C#.
For a resource that adds a terminal app, see the official Notes addon.
FiveM runs client DLLs on an old Mono runtime. These examples follow its limits: no System.Text.RegularExpressions, tuples, init accessors, readonly structs or generic constraints in nullable code, and they target net452. See Client code limits.
- Developer docs
- Listing your work on fiveprs.org/assets
- Discord for help