For the complete documentation index, see llms.txt. This page is also available as Markdown.

Installation

Install tw-lib once; every Tworst job on your server uses the same copy.


Step 1: Download

Download tw-lib-<version>.zip from GitHub Releases, or take tw-lib from your Cfx.re Granted Assets next to your job.


Step 2: Extract

Put the folder into your resources directory. It must be named exactly tw-lib.

resources/
├── tw-lib/              ← Tworst library
│   └── config.lua       # Admin menu language and who may open it
├── tw-scrapyard/        ← your Tworst jobs
└── ...

Step 3: server.cfg

Start tw-lib after your framework and oxmysql, and before every Tworst job:

If a job starts before tw-lib, tw-lib restarts that job once by itself and prints a warning. Fix the order anyway.


Step 4: Database


Step 5: Start & Check

Start the server and look at the console:

  • The second line shows what tw-lib detected.

  • The last line appears a few seconds later. It lists every Tworst script that uses tw-lib. If one has a new version, it says update available: <script> <yours> -> <new> with a link instead.


Admin Menu Permission

A player can open /twlib in any of three ways, set in tw-lib/config.lua:

Way
How

ACE

Grant tw-lib.admin in server.cfg: add_ace group.admin tw-lib.admin allow

Framework admin

QBCore / QBox players with god or admin, and ESX players in the admin or superadmin group, are allowed automatically (frameworkAdmins = true)

Identifier list

Add anyone else to identifiers, comma separated: license:..., discord:..., fivem:..., steam:... or a QBCore citizenid

Restart tw-lib after editing the file. See Configuration → Config File.


Updating

Replace the tw-lib folder with the new one and restart the server.

Your job settings live in the database, not in the tw-lib folder, so an update never resets them. When tw-lib restarts, the Tworst jobs it had to stop are started again.


Troubleshooting

Could not find dependency tw-lib for resource ...

tw-lib is not installed, not started, or its folder is not named tw-lib.

... needs tw-lib X or newer

Your tw-lib is older than the job needs. Download the latest from GitHub and replace the folder.

Wrong framework / inventory / keys / fuel / clothing detected

Check that the script is started and that its folder has its original name. Otherwise pick it by hand: see Configuration → Choosing a Script by Hand.

database did not answer in 10s

oxmysql did not respond in time. The jobs start with the values in their config files; your saved settings are not lost. Fix the database, then restart the jobs.

settings could not be loaded

The settings table could not be read. The jobs run with their defaults; your saved settings are not lost. Fix the database and restart.

<job>: saved setting ignored (...)

A value you had saved no longer fits the new version of the job (for example, a setting was removed). The job uses the default for it. Nothing else is affected.

/twlib does nothing

The player is not allowed: no tw-lib.admin ace, not a framework admin, and not in the identifiers list of tw-lib/config.lua. The console prints a line with the player's name when this happens. See Admin Menu Permission.


Need Help?

Open a ticket on our Discord with the [tw-lib] ... status line from your console and any red error lines.

Last updated