SAFScriptsDocs

Configuration

On this page

Everything is in config.lua. Framework and inventory hooks are in bridge/server.lua, covered in Custom servers.

Framework and inventory

OptionDefaultWhat it does
Config.Framework'auto''auto', 'qbx', 'qb', 'esx', 'nd', 'ox' or 'standalone'
Config.Inventory'auto''auto', 'ox_inventory', 'qb-inventory', 'ps-inventory', 'lj-inventory', 'qs-inventory', 'codem-inventory', 'core_inventory', 'tgiann-inventory', 'jaksam_inventory', 'origen_inventory', 'framework' or 'none'

'framework' uses the framework's own inventory. 'none' means TVs are placed with a command.

Staff

OptionDefaultWhat it does
Config.StaffAce'tv.staff'ACE for staff: pick up anyone's TV, no TV limit
Config.StaffGroupsadmin, god, superadminFramework groups that also count as staff

Placeable TVs

Config.Placeable controls the TV items. Each item places a TV prop that works like any TV in the map.

OptionDefaultWhat it does
EnabledtrueTurn placeable TVs off
Itemsfour TVsItem name to { label, model }. See Installation
Command'placetv'/placetv <item>. With an inventory, only staff can use it
CommandAcefalseAn ACE like 'tv.place' to limit /placetv when there is no inventory
PickupCommand'pickuptv'Pick up a TV, for servers without ox_target or qb-target
MaxPerPlayer3TVs one player can have placed. 0 is no limit
PlaceDistance6.0Metres you can aim when placing
PickupDistance2.5Metres from a TV to pick it up
SavetrueKeep placed TVs across restarts, in placed.json

Control style

OptionDefaultWhat it does
Config.ControlStyle'tv''tv': you use the TV itself, the camera frames the screen and everyone nearby sees the menus. 'remote': the older side panel with a link box, buttons and a recent list

SAF OS

Config.Os sets the home screen.

OptionDefaultWhat it does
Name'SAF OS'Name of the TV system
Network'LSFiber 5G'Shown in the Wi-Fi pill on the home screen
ScreenSaverSeconds90An untouched home screen turns into a slideshow after this long. 0 is never
Clock'game''game' shows the in-game time and date, 'real' the player's own clock
TourKeynilA key like 'o' that runs the showcase tour while using a TV. nil is off
Config.TourCameraDrift1.0How much the camera drifts around the TV during the tour. 0 is still

Apps

Config.Apps lists the home screen apps in order. To add an app, copy a line and give it a new id, label, logo and tile colour.

KeyWhat it does
idUnique id. Rows in Config.HomeRows point at it
kindWhat the app is, see below
labelName on the home screen
logoA file in html/os/logos/ or a full https link
tileColour behind the logo
aboutOne line shown on the home screen
home, searchWeb apps only: start page and search link (%s is the query)
KindWhat it is
'video'YouTube browsing and search
'feed'A channel-style app built from YouTube searches
'web'Web browser
'radio'The live stations in Config.Radio
'link'Play any video, music or stream link, or an IPTV playlist
'settings'Volume, sleep and about
Lua
{ id = 'eyefind', kind = 'web', label = 'Eyefind', logo = 'eyefind.png', tile = '#4a8fc7',
  home = 'https://duckduckgo.com', search = 'https://duckduckgo.com/?q=%s',
  about = 'Browse the web on the big screen.' },

Video rows

Config.HomeRows lists rows of videos. Each row is a YouTube search, refreshed every FeedCacheMinutes.

KeyWhat it does
appWhich app shows the row, in its tabs and on the home screen shelf
titleRow title
queryThe YouTube search
livetrue for live streams only
Lua
{ app = 'vinewood', title = 'Pursuits', query = 'gta 5 police chase cinematic' },
{ app = 'vinewood', title = 'Live now', query = 'gta rp live', live = true },

Radio

Config.Radio lists the stations. Each plays whatever live stream tops its search.

KeyWhat it does
nameStation name
queryThe YouTube search for its live stream
logoA file in html/os/logos/
colorTile colour
aboutOne line under the name

Search and caching

OptionDefaultWhat it does
Config.FeedCacheMinutes30How long search results and rows are kept before asking YouTube again
Config.SearchRateMs1500Minimum time between searches per player

Command and access

OptionDefaultWhat it does
Config.Command'tv'Puts you in front of the nearest TV with the remote open
Config.DefaultKey''Default key for the command. Players can rebind it. '' is no default
Config.AcePermissionfalsefalse lets everyone use TVs. Set an ACE like 'tv.use' to restrict

Ranges

Distances are in metres (15 m is about 50 ft).

OptionDefaultWhat it does
Config.RenderRange15.0TVs this close show the home screen or what's playing
Config.AudioRange15.0Sound fades out over this distance
Config.WebRange8.0Web pages load only this close. A web page's own sound can't be faded by distance
Config.ControlRange4.0How close you must be to use /tv

Timing

OptionDefaultWhat it does
Config.ScanInterval1000Milliseconds between scans for TV props
Config.VolumeInterval250Milliseconds between distance volume updates
Config.SyncInterval2000Milliseconds between position re-syncs. The screen corrects when it is more than 2 s off

Screen page and picture

OptionDefaultWhat it does
Config.ScreenUrl'auto'Where TVs load their home screen. 'auto' hosts it through your cfx.re address. See The TV page
Config.FitCommand'tvfit'Command to line the picture up with a TV model's glass. Saved for everyone in fits.json
Config.FitAce'tv.fit'ACE for /tvfit. The command ACE admins have also works
Config.DrawMode'target''target' draws into the TV's own screen surface for an exact fit. 'glass' draws over the model's front face, sized by screen and /tvfit
Config.SharpWhenControllingtrueWhoever holds the remote sees a full-resolution picture laid over the glass
Config.DuiWidth1920Width of the TV page in pixels
Config.DuiHeight1080Height of the TV page in pixels

Server checks

OptionDefaultWhat it does
Config.MaxUrlLength512Longest link a player can load
Config.RateLimitMs350Minimum time between actions per player
Config.MaxTvStates400Most TVs that can play something at once
Config.BlockedHosts{}Hosts nobody may load. Substring match on the host
Config.AllowPrivateAddressesfalseAllow links to localhost and LAN addresses. Off so a link can't reach players' routers or local apps
Lua
Config.BlockedHosts = { 'example.com' }

TV models

Config.Models lists the base-game TV props and the render target their screen uses. One render target is shared by every prop linked to it, so TVs of the same target in range all show the nearest TV's content. Normally there is only one TV per room.

KeyWhat it does
modelProp model name
targetRender target name, usually 'tvscreen'
screenOptional inset of the screen inside the front face: left, top, right, bottom as 0 to 1 fractions. Used to map the mouse onto web pages
drawOptional 'glass' to override Config.DrawMode for this model
OptionDefaultWhat it does
Config.DefaultScreenInset{ 0.03, 0.05, 0.03, 0.06 }Inset for models without their own screen
Lua
{ model = 'prop_tv_flat_01', target = 'tvscreen', screen = { 0.045, 0.060, 0.046, 0.142 } },

Camera

OptionDefaultWhat it does
Config.CameraFov50.0Field of view while using a TV
Config.CameraFill0.6'remote' style: share of the screen height the TV takes up
Config.CameraShift0.09'remote' style: moves the TV left so the panel doesn't cover it
Config.TvCameraFill0.8'tv' style: share of the screen height the TV takes up
SAF Scripts by San Andreas' Finest StoreDiscordsupprot@safrp.org

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