SAFScriptsDocs

Installation

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

On this page

SAF Traffic needs OneSync, which is on by default on current servers. It uses it for the extra jam cars and the props. No database is needed.

Steps

  1. Put the saf-traffic folder in your resources folder.
  2. Add it to server.cfg, after your framework:
    server.cfg
    ensure saf-traffic
  3. Stop other density scripts. SAF Traffic prints a warning in the console when it finds one.
  4. Give your staff access:
    server.cfg
    add_ace group.admin traffic.staff allow
    Framework admins (admin, god, superadmin in Config.StaffGroups) also count.
  5. Start the server and do the first road scan (below).

Other density scripts

Two scripts setting density fight each other every frame. Before you start:

  • qb-smallresources: remove its density loop, or set its values to 1.0. Otherwise it caps traffic every frame.
  • vMenu: leave its density options alone.
  • Any other script that calls the density natives every frame: turn it off.

First time: scan the roads

The map isn't a picture. It is built from GTA's own road network, so it lines up exactly with what the closures and jams do in game. Your server needs to read it once.

  1. Join, open /traffic and press Scan roads.
  2. Your game walks the map in 408 tiles of 512 m and sends each one to the server. It runs in the background, so you can close the panel and keep playing. A progress bar shows the tiles done and the time left. Expect about 5 to 10 minutes on a normal PC.
  3. When it's done the server writes roads.json (a few hundred KB) and every staff member gets the map.

The scan is resumable. If you leave, crash or press Pause, the next Scan roads carries on from the last tile. Only one person can scan at a time.

Postals on the map

Set Config.Postals.Resource to the resource that has your postal file and Config.Postals.File to its path inside it. The file needs a list of { code, x, y }, the format most postal scripts use.

custom/shared/postals.lua
Config.Postals.Resource = 'nearest-postal'
Config.Postals.File = 'new-postals.json'

Files it writes

FileWhat it is
roads.jsonThe scanned road map. Keep it, it saves a rescan
scan.jsonScan progress while a scan is unfinished
state.jsonDensity, schedule and items (with Config.Save.Items on)

Updating

Replace every file except your custom/ folder and the three files above. Keep config changes in custom/shared/ so a new config.lua doesn't undo them.

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

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