Package: 7724585
Version: 1.0.0
# Overview
The in-game workshop for C&T Studios scripts. Admins build and manage content right on the server: place people and areas in the world, write texts in English and German, test privately and publish. Players get changes immediately, without touching Lua files or restarting anything.
CT Studio is made of modules, one per script. A module only shows up while its script is running.
Available modules:
- CT Underground: edits missions (jobs) and Relay contacts of ct-underground
# Requirements
- Libraries: ox_lib and oxmysql
- OneSync: required. sv_entityLockdown must not be set to strict
- Scripts: the scripts you want to edit, e.g. ct-underground 1.0 or newer, started before CT Studio
- Internet access for clients: only for the preview images in the model and weapon pickers
- Database: tables are created automatically on first start
# Installation
- Place ct-studio in your resources folder
- Start it after the scripts it edits in your server.cfg (see below)
- Give your admins access (see Access)
- Restart the server. On the first start CT Studio creates its tables and imports the contacts and missions from CT Underground's config.lua and missions.lua as version 1
- From then on, missions are edited in CT Studio. The config files only serve as a template for fresh installs and as the source of default missions
- Modules can be switched off one by one with enabled = false in Config.Modules
Start order in your server.cfg:
```
ensure ox_lib
ensure oxmysql
# your framework, inventory and target
ensure ct-underground
ensure ct-studio
```
# Access
Every action is checked on the server. The client never decides who is an admin. A player gets in with either the ACE permission or a framework group. Set either option to false to turn it off.
- Config.Access.ace: ACE permission, default ctstudio.access
- Config.Access.groups: framework groups that get access
- Qbox: admin, god (checked with ACE, the way qbx_core does it)
- QBCore: admin, god (checked with QBCore.Functions.HasPermission)
- ESX: admin, superadmin (checked with xPlayer.getGroup)
ACE example for your server.cfg:
```
add_ace group.admin ctstudio.access allow
```
Open CT Studio with /ctstudio (Config.Command). With more than one active module, switch between them at the top left.
# From draft to live
How a CT Underground mission goes from idea to players:
- New mission: pick a template (see Mission types), an internal ID and the contact who offers it. The mission starts as a draft, players never see drafts
- Basics: name, short description for your team, contact and a description of the target or package
- Flow: the job step by step, e.g. offer, search, takeover, escort, handover, reward. Each step has its own settings
- Scenes: a scene is one place the job can happen. When the job is offered, one scene is picked at random. You place search areas, the target, guards, vehicles, the handover contact and the handover point, depending on the type
- Place in the world: Edit in the world hides CT Studio and shows the scene around you. Areas are circles on the ground, people, vehicles and packages are see-through ghosts that already play their behaviour
- NPCs: one table with every person of every scene, with model, weapon and behaviour at a glance
- Messages: everything the contact writes, in English and German. Each entry is one message bubble. Placeholders: {area}, {description}, {reward}, {minutes}
- Rewards and rules: money, items, the contact who gets in touch afterwards, the job that has to be done first, time limit, cooldowns, attempts per phone, repeatable or not
- Test run: try the draft privately (see Test runs)
- Publish: lists everything that's missing or wrong, with a link to the field. Errors block publishing, notes like a missing translation don't
Save with the button or Ctrl+S. If someone else saved the same mission in the meantime, your save is rejected instead of overwriting their work.
Vehicles are scenery from a list with pictures. Each one can be locked (just scenery) or open (can be stolen).
# World editor keys
Keys in Edit in the world:
- Tab: next element
- E: select the element you look at
- G: put the selected element where you stand, facing where you face
- Arrow left / right: turn the selected person, vehicle or package
- Arrow up / down: resize the selected area
- H: add one more of the selected kind (guard, vehicle) where you stand
- Del: remove the selected guard or vehicle
- Enter: back to CT Studio
Every element also has Set to my position and Go there in CT Studio.
# Mission types
Templates:
- The Pickup: find a person in a search area, take them along (threatening or talking) and hand them over. Placed: search area, target, guards, vehicles, handover contact, handover point
- Fetch & deliver: get a package from a place, possibly guarded, and bring it to a receiver. Placed: search area (optional), package, guards, vehicles, receiver
- Courier: get a package from someone in person and bring it to a receiver. Placed: giver, vehicles, receiver
- Supply: bring a list of items to a buyer, all at once or bit by bit. Placed: buyer, vehicles
Shared settings:
- Guard behaviour: Just scenery = guards only fight back once one of them gets hurt. Defend = they open fire on anyone within Attack within metres, and as soon as the target or package is taken
- Package: Item = a real inventory item that can be handed on or stolen, whoever delivers it gets paid. In the hands = carried visibly, only the player can deliver it, Vehicles allowed decides whether they may drive with it
- Location (Fetch & deliver): a search area around the package, or a marker right on it
- Time limit (Supply): optional. Supply jobs survive disconnects and restarts, run alongside other jobs and keep what was handed in, also after a failure
- Cancelled: players can cancel a job in Relay. The message for that may stay empty
How each type plays in detail is described in the CT Underground documentation.
# Test runs
Test run starts the current draft (saved or not) for you alone:
- Private: you're moved into a private routing bucket. Only you see the NPCs, other players don't see you. A vehicle you sit in comes along
- Start: the job starts right at the search step of the scene you choose. Contact messages show up as notifications instead of Relay messages
- No side effects: no reward is paid, no contact is unlocked and nothing is written to the database
- End: on success or failure, or with /ctstudio stoptest. You're moved back into the normal world
A test needs a complete world setup (scenes, flow and rules without errors). Missing texts are fine.
# Statuses and versions
Statuses:
- Draft: players don't see it. You can edit, test, publish and delete
- Live: players get the latest published version. You can edit (as a new draft), publish again, disable and archive
- Disabled: no longer offered, runs that already started can be finished. You can enable, publish and archive
- Archived: players don't see it. You can restore and duplicate
How versions work:
- Snapshots: publishing stores an immutable snapshot as a new version (v1, v2, ...)
- Live stays live: editing a live mission only changes its draft. Players keep getting the published version until you publish again. Unpublished changes in the header shows the difference
- Running jobs: every run keeps the version it started with, so publishing, disabling or archiving never changes a run in progress
- History: under Publish, Versions you can view any version in the world or load it back into the draft
- Deleting: only drafts that were never published can be deleted. Everything else is archived, so its history stays
Changes take effect immediately. Nothing needs a restart.
# Contacts
The Contacts tab manages Relay contacts: handle, avatar colour, first messages (English and German) and how long after unlocking they arrive.
- Live on save: contacts are live as soon as they're saved
- Existing phones: first messages are copied onto a phone when the contact appears there, so changes only affect phones that get the contact afterwards
- Archiving: a contact can't be archived while a mission uses it. The starter contact of CT Underground can't be archived at all
# Default missions and updates
The missions in CT Underground's missions.lua are default missions. The first start imports them once and marks them as CT Default.
- Your copy stays yours: an update of CT Underground never changes a mission in CT Studio, neither its draft nor what's live
- New default version: if a default mission changed since it was imported, the list and Publish show New default version
- Default missions list: below the mission list, shows every mission in missions.lua as not imported, up to date or newer version available
- Importing a default: always creates a separate draft, under the same ID if it's free, otherwise e.g. pickup_default. Missing contacts are added, existing ones are kept
Compare the new default with your own version, take over what you like and publish when you're ready. Without CT Studio, CT Underground keeps playing missions.lua directly.
# Export and import
Missions can be saved as JSON files, for backups or to move them to another server. A file contains everything: texts, scenes, NPCs, rules, rewards and the contacts it refers to.
- Export: Publish, Back up & share, Export saves the current state. Every published version can be exported on its own under Versions. The file is written to ct-studio/exports/ and copied to the clipboard
- Import: Import below the mission list. Paste the content of a file, or pick a file from ct-studio/exports/. Check shows what the file contains before anything is written
- New draft: an import always becomes a new draft. If the ID is taken, a free one is suggested (e.g. harbor_job_import). Nothing goes live until you publish
Contacts in imported missions:
- Missing on this server: created from the file, so the mission works right away
- Already there: the mission uses the local contact, which is never overwritten
- Neither here nor in the file: the draft shows an error until a contact is picked
The import detects damaged files, files that aren't from CT Studio, missions for another module, mission types this server can't play and formats from a newer CT Studio. Older formats are upgraded automatically where possible. A file edited after export still imports, but the preview points it out.
# Languages
CT Studio is fully available in English and German (Config.Locale, or the server's ox:locale convar).
- Every text can be entered in both languages
- If one is missing, players see the other one. A raw key or an empty bubble never shows up
- Missing translations are listed as notes before publishing
# Limits
Everything is checked on the server against Config.Modules.underground.limits. Anything outside is clamped or rejected. Defaults:
- Missions / contacts: 250 / 100
- Scenes per mission / guards per scene: 8 / 8
- Messages per list / characters per message: 6 / 400
- Money reward: 0 to 250,000
- Reward items / amount per item: 5 / 100
- Search radius / handover radius: 10 to 300 m / 2 to 25 m
- Time limit: 2 to 120 min
- Cooldowns: up to 7 days
# Safe use
- Models, weapons and vehicles: only from the lists in data/peds.lua, data/weapons.lua and data/vehicles.lua. Add your own (also addon models) through Config.ExtraPeds, Config.ExtraWeapons and Config.ExtraVehicles
- Package props: a fixed list of objects from the game files. How they sit in the hands is set in CT Underground's Config.CarryProps
- Behaviours: GTA scenarios from data/scenarios.lua, or an animation dictionary and clip. The ghost NPCs in the world preview play exactly what will be played in the job
- Rewards: only into the accounts listed in accounts, and only items that exist in your inventory (or those in rewardItems, if set). Both in Config.Modules.underground
- Data only: there's no way to enter Lua, JavaScript, SQL or event names. Unknown fields are dropped before anything is saved
# Data and backups
Tables:
- ct_studio_audit: who did what and when (create, save, publish, disable, archive, restore, delete, test runs, contact changes)
- ct_studio_mission_defs: one row per mission with status, current draft, live version and origin
- ct_studio_mission_versions: one row per published version, the immutable snapshot
- ct_studio_contact_defs: contacts
Back up CT Studio together with CT Underground:
```
mysqldump -u USER -p DATABASE ct_underground_phones ct_underground_contacts ct_underground_missions ct_studio_audit ct_studio_mission_defs ct_studio_mission_versions ct_studio_contact_defs > ct_backup.sql
```
Restore with mysql -u USER -p DATABASE (then the file), and restart both resources.
- Safe writes: every save is one statement and every publish one transaction. A failed write never leaves a half-written mission behind
- Roll back: load an older version into the draft and publish it again
- Second backup: exported missions in ct-studio/exports/ work without database access
- Start over: the config import only runs while the CT Studio tables are empty. Empty ct_studio_mission_defs, ct_studio_mission_versions and ct_studio_contact_defs (not CT Underground's tables) and restart
# Known limits
- Mission types: job types beyond the four templates need a new template
- Preview images: come from docs.fivem.net. Without internet access the pickers show placeholders, everything else works
- CT Studio stopped: CT Underground keeps the last published state until it restarts. After a restart without CT Studio it falls back to its config files
- Test runs: an admin can't start a test run while on a real job, and vice versa
- Sent messages: messages that were already sent keep their wording, edits apply to new messages
# For developers
CT Studio can be extended with new mission types and new modules without changing its core. Templates define the editor, cleanup and checks through a schema, modules register their server side, tables and UI on their own. The full developer reference (file structure, Modules.register, Rpc.register, Studio.registerModule) is in the README that ships with ct-studio.
Docs: CT Studio
Error codes
Got an error in your server console (F8 or server window)? Paste the line or the code (e.g. CTS-001) below.