SAFScriptsDocs

Custom servers

On this page

bridge/server.lua is open in every edition. It holds everything SAF TV asks your framework and inventory, one short function each. You can edit it, but the better place for your changes is custom/: updates never touch it.

Pick by hand

If you renamed your framework or inventory resource, auto detection can miss it. Set them in config:

custom/shared/config.lua
Config.Framework = 'qb'
Config.Inventory = 'ps-inventory'

How custom/ works

Files in custom/ load after config.lua and bridge/, so anything defined there replaces the original.

FolderUse it for
custom/shared/*.luaChanging Config values
custom/client/*.luaClient changes
custom/server/*.luaReplacing any server Bridge.* function

Server hooks

FunctionWhat it does
Bridge.GetIdentity(src)Who the player is: { id, name }, or nil when not loaded. Placed TVs are saved under id, so it must stay the same across sessions
Bridge.IsStaff(src)Who counts as staff
Bridge.ItemCount(src, item)How many of a TV item the player has
Bridge.RemoveItem(src, item)Take one TV item when placing
Bridge.AddItem(src, item)Give one back when picking up
Bridge.CanCarry(src, item)Room in the inventory for the item
Bridge.RegisterUsableItem(item, cb)What happens when a player uses an item
Bridge.Notify(src, msg)A message to the player

Your own framework

custom/server/myframework.lua
function Bridge.GetIdentity(src)
    local p = exports['my-core']:GetPlayer(src)
    if not p then return nil end
    return { id = p.citizenid, name = p.name }
end

Your own staff check

custom/server/staff.lua
local base = Bridge.IsStaff
function Bridge.IsStaff(src)
    if exports['my-admin']:IsAdmin(src) then return true end
    return base(src)
end

Config overrides

custom/shared/config.lua
Config.Placeable.MaxPerPlayer = 5
Config.Os.Network = 'Vinewood Cable'
Config.BlockedHosts = { 'example.com' }
SAF Scripts by San Andreas' Finest StoreDiscordsupprot@safrp.org

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