Skip to the content
Docs

Updating

On this page8

How to install a new version without losing your settings, your texts or your data.

Is there a new version?

The script checks at every start and prints one of these two lines in the server console:

Code
[5code-adminpanel] Up to date (1.0.0).
[5code-adminpanel] Update available: X.Y.Z (you have 1.0.0). Get it on Tebex.

The check needs the internet. If no line shows, the check could not be made. Nothing else is affected.

Your own version is also at the bottom of the panel's menu (Version 1.0.0). What changed is in the Changelog.

What is yours

Your data (bans, warnings, tickets, notes, ranks, logs, statistics) is in the database. A new folder does not touch it. One thing is cleaned by the script itself: log lines older than Config.LogKeepDays days. See Old log lines before you update.

Your settings are in four places. Only these files are open, so only these can hold your changes:

FileWhat you may have changed
config.luaEvery setting.
config_server.luaYour FairShield API key and your Discord webhooks.
locales/*.luaChanged texts, or your own language file.
bridge/*.luaOnly if you added your own prison, inventory, weather, notification, ambulance or clothing script.

Everything else in the folder is replaced by an update.

Steps

  1. Download the new version from your Cfx portal (Granted Assets), the same place as the first time.
  2. Read the Changelog. It names the open files a version changed.
  3. Back up. Copy the whole 5code-adminpanel folder to a safe place and export the database tables (Database).
  4. Pick a quiet moment. Stopping the panel ends every running sit. Everybody is put back, and staff read in the ticket: "The admin panel was restarted: the sit was ended and everybody was returned." Admin jail times are kept.
  5. Stop the server.
  6. Replace the folder with the new one. Keep the name 5code-adminpanel.
  7. Put your settings back (see below).
  8. Start the server and read the console (see What happens to the database).
  9. Check it. The menu of the panel shows the new version. The First Test takes five minutes.

Putting your settings back

Do not copy your old file over the new one. A new version can bring new keys, and your old file does not have them.

config.lua and config_server.lua

  1. Start from the new file.
  2. Compare it with your old one (VS Code, WinMerge or any compare tool).
  3. Carry your values over, key by key.
  4. Leave new keys at their default, unless the changelog says something else.

A key that is missing in an old config.lua uses its default. Two keys to know:

KeyWhen it is missing
Config.LogKeepDaysCounts as 90: log lines older than 90 days are deleted. See Old log lines.
Config.ReportCommandCounts as 'report': the command stays /report.

locales/*.lua

Your caseWhat to do
You have your own language file (for example locales/de.lua)Copy it back into the new locales/ folder. New texts show in English until you add them to your file.
You changed texts in locales/en.luaThe update replaces that file. Carry your changes into the new en.lua.

Compare your file with the new en.lua to find new texts. More: Localization.

bridge/*.lua

Never touched the bridge files? Take the new ones.

You added your own script? Take the new file and put only your own part back into the marked place ([[ ADD YOUR … HERE ]]). Do not keep an old bridge file as a whole. See Bridge files.

What happens to the database

Nothing for you to do. At the first start of a new version the script updates the database by itself.

WhatWhat the script doesWhat you see in the console
New tablesCreates them. Tables that exist are not changed.—
New columnsAdds them to your tables, only when they are missing.[5code-adminpanel] database updated: 3 column(s) added. (the number can differ)
Default ranksNothing. They are only written into an empty database, at the very first start. A rank is never overwritten or brought back: what you changed or deleted in the panel stays.—
New permissionsGives them to the default ranks, once (see below).—
Your dataNo table and no column is ever dropped. The script does not delete bans, warnings, tickets, notes or ranks.—
Old log linesDeletes log lines older than Config.LogKeepDays days (default 90). Shortly after the start, then once a day.[5code-adminpanel] logs: 1250 line(s) older than 90 day(s) deleted. (the numbers differ)

When everything is done the console shows [5code-adminpanel] database ready.

Old log lines

You wantDo this before the first start
Keep every log lineAdd Config.LogKeepDays = 0 to config.lua.
Keep more or fewer daysAdd Config.LogKeepDays with your number of days.
The defaultNothing. Lines older than 90 days are deleted.
  • Only log lines are deleted. Bans, warnings and tickets are never deleted.
  • Want the old lines somewhere else first? Export the table adminpanel_logs before you update (Database).
  • All about the setting: General.

New permissions and your ranks

A new version can bring new permissions, for example for a new button.

RankWhat happens
The four default ranks (God, Admin, Moderator, Helper)At the first start of the new version each one gets the new permissions that Config.DefaultRanks in config.lua lists for it. This happens once.
A rank with every permission (*), like GodNeeds nothing. It can already do everything.
Ranks you created yourselfThey are not changed. Tick the new permissions on the Ranks & Staff page.
Super-adminsNeed nothing. They always have every permission.

Good to know:

  • If you untick one of these new permissions later, it stays unticked. The script does not give it again.
  • A default rank you renamed in the panel still counts as that default rank.
  • Every permission always shows as a tick box on the Ranks & Staff page, also with an older config.lua.

Problems after an update

See Troubleshooting or ask on Discord (opens in a new tab).