SAFScriptsDocs

Exports & events

On this page

SAF Scenes is mostly self-contained. These are the pieces other resources can use.

Client exports

Lua
exports['saf-scenes']:IsHidden()  -- true while the player has hidden scenes with /scenes

Item event

Using a spray can triggers this client event. ox_inventory calls it from the item definition in install/ox_inventory.txt. You can trigger it yourself to start a spray tag from another script:

Lua
TriggerEvent('saf-scenes:client:spray')
Lua
['spray_can'] = {
    label = 'Spray Can',
    weight = 300,
    stack = false,
    close = true,
    consume = 0,
    client = { event = 'saf-scenes:client:spray' },
},

Database

Scenes are stored in one table, created on first start. Expired scenes are deleted on every start.

SQL
CREATE TABLE IF NOT EXISTS saf_scenes (
    id INT AUTO_INCREMENT PRIMARY KEY,
    owner VARCHAR(50) NOT NULL,
    owner_name VARCHAR(80) NOT NULL,
    data LONGTEXT NOT NULL,
    graffiti TINYINT NOT NULL DEFAULT 0,
    expires BIGINT NULL,
    created BIGINT NOT NULL
)

owner is the id from Bridge.GetIdentity. expires is a Unix time, or NULL for permanent scenes.

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

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