SAFScriptsDocs

Configuration

SAF Pursuit is coming soon. These docs describe the build that will ship.

On this page

Everything is in config.lua. Framework hooks (who is police, jobs, vehicles, logs) are in bridge/, covered in Custom servers.

General

OptionDefaultWhat it does
Config.Framework'auto''auto', 'qbx', 'qb', 'esx', 'nd', 'ox' or 'standalone'

Who can use modes

OptionDefaultWhat it does
Config.Ace'pursuit.use'ACE that always allows modes
Config.PoliceJobspolice, sheriff, bcso, sasp, state, trooper, ranger, fibJobs that count as police
Config.PoliceJobTypes{ leo = true }Qbox and QBCore job types that also count
Config.RequireOnDutytruePolice must be on duty

Vehicles

OptionDefaultWhat it does
Config.Vehicles.EmergencyOnlytruefalse lets police switch modes in any vehicle they drive
Config.Vehicles.Classes{ [18] = true }Vehicle classes that take a mode. 18 is Emergency
Config.Vehicles.ModelsemptyExtra spawn codes that count, for unmarked cars and addon packs

Modes

Config.Modes lists the modes in the order the key cycles them, after OFF. Each mode:

KeyWhat it does
idMode letter, shown on the display and used by /pursuit a
nameName shown with the mode
PowerEngine torque multiplier. 1.0 is stock
TopSpeedTop speed boost in percent. 0 is stock
MaxMphHard speed cap in mph. 0 is no cap. Shown on the display
BrakesBrake force multiplier
GripTyre grip multiplier
SuspensionSpring stiffness multiplier
AntiRollAnti-roll bar multiplier. Higher is less body roll in hard corners
PursuitCounts as "in pursuit" for the exports, the PIT helper and auto off
Lua
Config.Modes = {
    { id = 'A', name = 'Patrol',   Power = 1.00, TopSpeed = 0,  MaxMph = 105, Brakes = 1.00, Grip = 1.00, Suspension = 1.00, AntiRoll = 1.00, Pursuit = false },
    { id = 'B', name = 'Response', Power = 1.15, TopSpeed = 6,  MaxMph = 125, Brakes = 1.10, Grip = 1.04, Suspension = 1.05, AntiRoll = 1.15, Pursuit = true },
    { id = 'C', name = 'Pursuit',  Power = 1.30, TopSpeed = 12, MaxMph = 0,   Brakes = 1.20, Grip = 1.08, Suspension = 1.10, AntiRoll = 1.30, Pursuit = true },
}

Per-model overrides

Config.ModelOverrides changes values on top of a mode for one spawn code. Only the values you list change.

Lua
Config.ModelOverrides = {
    police3 = { C = { Power = 1.25, MaxMph = 140 } },
    policeb = { B = { Grip = 1.0 }, C = { Grip = 1.0, AntiRoll = 1.0 } },
}

Switching

OptionDefaultWhat it does
Config.Key'J'Default key that cycles OFF, A, B, C. Players can rebind it
Config.Command'pursuit'/pursuit cycles, /pursuit a, b, c or off picks one
Config.Cooldown1500Milliseconds between switches
Config.SoundNAV_LEFT_RIGHT{ name, set } of a frontend sound on every switch. false is silent
Config.NotifytrueSmall notification on every switch

Auto off

Drops back to OFF after sitting slow, only from modes marked Pursuit.

OptionDefaultWhat it does
Config.AutoOff.EnabledtrueTurn auto off on or off
Config.AutoOff.BelowMph10Counts as slow under this speed
Config.AutoOff.Seconds45Seconds slow before the mode goes off

Unit display

OptionDefaultWhat it does
Config.Hud.EnabledtrueShow the display
Config.Hud.Position'bottom-right''bottom-right', 'bottom-left', 'top-right', 'top-left' or 'bottom-center'
Config.Hud.OffsetX28Pixels from the screen edge, at 1080p
Config.Hud.OffsetY300Pixels from the screen edge, at 1080p
Config.Hud.Scale1.0Size of the display
Config.Hud.ShowWhenOfftrueKeep the small mode strip up while OFF in a police vehicle
Config.Hud.Units'mph''mph' or 'kmh'

PIT helper

In the modes listed here, the display picks the vehicle you're closing on and says which side to PIT and whether speed, angle and contact point are in the window.

OptionDefaultWhat it does
Config.Pit.EnabledtrueTurn the PIT helper on or off
Config.Pit.Modes{ B = true, C = true }Modes that show the helper
Config.Pit.Range30.0Metres ahead a target is picked up
Config.Pit.MinMph15Lowest speed for a PIT
Config.Pit.MaxMph60Above this a PIT is not authorised and the display shows the limit in red
Config.Pit.MaxSpeedDiff15Mph difference allowed between you and the target
Config.Pit.MaxAngle20Degrees allowed between your heading and theirs
Config.Pit.Assist'light''off', 'light' or 'full'. 'off' keeps the helper and the logs, no push
Config.Pit.AssistStrength{ light = 2.0, full = 3.5 }Sideways push at the target's rear, in m/s
Config.Pit.Cooldown8Seconds between assisted PITs per officer
Config.Pit.TargetCooldown6Seconds before the same vehicle can be assisted again
Config.Pit.MaxDistance8.0Server check: most metres between the two vehicles

Logging

OptionDefaultWhat it does
Config.Log.ModestrueLog every mode change
Config.Log.PitstrueLog every assisted PIT

Logs go to the server console through Bridge.Log. Replace it to send them anywhere else.

SAF Scripts by San Andreas' Finest StoreDiscordsupprot@safrp.org

Not affiliated with or endorsed by Rockstar Games, Take-Two Interactive or Cfx.re.