Einbinden

bridge.lua, eine schema.lua, ein Aufruf am Ende der Server-Datei.

  1. Bridge kopieren

    cs_config/bridge.lua in dein Script kopieren, etwa als script/cs_config.lua. Es ist in jedem Script dieselbe Datei und liest seinen Resource-Namen selbst.

  2. Laden

    Als shared_script direkt nach deiner config.lua. Deine Config muss auf einer globalen Tabelle mit dem Namen der Resource liegen, cs_shops = {}.

  3. schema.lua schreiben

    Unter script/schema.lua oder im Wurzelordner. Sie gibt deine Seiten, Felder und Orte zurück. In files und in escrow_ignore eintragen, sonst kommt sie verschlüsselt an und das Script fehlt im Menü.

  4. Melden

    CsConfig.Boot am Ende deiner Server-Datei. Siehe Boot.

fxmanifest.lua
shared_scripts {
    'config/config.lua',
    'script/cs_config.lua',      -- the bridge, right after the config
    'script/shared.lua',
}

files {
    'script/schema.lua',
}

escrow_ignore {
    'config/*.lua',
    'script/schema.lua',
}
config/config.lua
my_script = {}
local Config = my_script

Config.Price = 250
Config.Places = {
    { position = vector3(25.7, -1347.3, 29.5) },
}
script/schema.lua
return {
    label = 'My script',

    about = {
        summary = 'One line saying what it is.',
    },

    sections = {
        { id = 'basics', label = 'General', icon = 'csHome',
          summary = 'Prices and the like.' },
        { id = 'places', group = 'places', label = 'Places' },
    },

    fields = {
        { key = 'Price', section = 'basics', type = 'money', apply = 'live',
          label = 'Price', min = 0, max = 100000, setup = 1,
          hint = 'What one visit costs.' },
    },

    places = {
        { key = 'Places', section = 'places', label = 'Places', singular = 'Place',
          fields = {
              { key = 'position', type = 'coords', label = 'Where', required = true },
          } },
    },
}

Ohne cs_config tut die Bridge nichts und deine config.lua gilt. Sie liest nie die Datenbank und entscheidet nie über Rechte.

Alles im Schema wird an jeden Spieler geschickt, weil der Client damit zeichnet. Eine URL oder ein Schlüssel braucht type = 'secret' oder server = true. Siehe Nur für den Server.

Frage offen geblieben?

Schreib uns im Discord. Mit Konsolen-Auszug, Framework und Script-Version ist die erste Antwort meistens schon die Lösung.

Zum Support