Jurisdictions
Jurisdictions let you partition your server into geographic zones with different rules, laws, and enforcement. Useful for multi-city servers or servers with distinct roleplay regions.
What Is a Jurisdiction?
A jurisdiction is a named geographic area (a polygon or radius) with associated:
- Laws — what's illegal and the associated penalties
- Enforcement — which job enforces the laws (police, rangers, etc.)
- Tax rates — optional economy modifiers
- Speed limits — optional vehicle limits
Defining a Jurisdiction
lua
-- config.lua
Config.jurisdictions = {
los_santos = {
label = 'City of Los Santos',
enforcer = 'police',
speedLimit = 80,
laws = {
{ id = 'trespassing', label = 'Trespassing', fine = 500 },
{ id = 'assault', label = 'Assault', fine = 2500, jailTime = 300 },
{ id = 'robbery', label = 'Robbery', fine = 5000, jailTime = 600 },
},
zone = {
type = 'polygon',
points = {
{ x = -3000, y = -3000 },
{ x = 3500, y = -3000 },
{ x = 3500, y = 8000 },
{ x = -3000, y = 8000 },
},
},
},
paleto_bay = {
label = 'Paleto Bay',
enforcer = 'sheriff',
speedLimit = 60,
laws = { ... },
zone = {
type = 'radius',
center = { x = -278.0, y = 6324.0 },
radius = 500.0,
},
},
}Getting a Player's Jurisdiction
lua
local jurisdictions = container:make('IJurisdictions')
local zone = jurisdictions:getForPlayer(playerId)
-- zone.id, zone.label, zone.laws, zone.enforcerIssuing a Citation
lua
jurisdictions:cite(officerId, suspectId, 'speeding', {
speed = 130,
limit = 80,
})
-- Deducts the fine from the suspect's bank account
-- Creates a DOJ record