SAFScriptsDocs

Custom servers

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

On this page

bridge/server.lua and bridge/client.lua hold everything SAF Weather asks your server. They are open in every edition. Keep your changes in custom/ so updates never overwrite them.

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/*.luaReplacing client Bridge.* functions
custom/server/*.luaReplacing server Bridge.* functions

Pick the framework by hand

Config.Framework = 'auto' finds Qbox, QBCore, ESX, ND Core and ox_core on its own. If you renamed your framework resource, set it by hand:

custom/shared/framework.lua
Config.Framework = 'qb'

Config overrides

custom/shared/config.lua
Config.Temperature.Unit = 'C'
Config.Time.DayLength = 96
Config.Commands.PanelKey = 'F9'

Server hooks

FunctionWhat it doesDefault
Bridge.IsStaff(src)Who can use the panel and staff commandsweather.staff ACE, plus groups in Config.StaffGroups
Bridge.GetName(src)Name shown in the console and the panel's change logThe player's FiveM name, console for the server console
Bridge.Log(src, by, text)Where every change is loggedServer console
Bridge.Notify(src, msg, kind)A message to the playerSent to the client's Bridge.Notify

Client hooks

FunctionWhat it doesDefault
Bridge.Notify(msg, kind)How messages reach the playerox_lib, then the framework's own, then the GTA feed

Your own staff system

Wrap the original so the default checks still apply:

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

Send changes to Discord

custom/server/log.lua
local base = Bridge.Log
function Bridge.Log(src, by, text)
    base(src, by, text)
    exports['my-logs']:Send('weather', ('%s: %s'):format(by, text))
end
SAF Scripts by San Andreas' Finest StoreDiscordsupprot@safrp.org

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