Scripting in Liberty Unleashed uses a wide range of Squirrel's object-oriented features. Most internal data types have been exported to Squirrel via classes with their own methods and members which resemble the inner structures of LU and GTA. Events are the way LU discusses with scripts when something happens in the game. Many of these events can be manipulated using different return values.
All functions and events listed here will work with both Liberty Unleashed and Vice Unleashed unless stated otherwise. Some of them might require additional modules which are provided to you with the server package. Server-side scripting can be expanded further using the C/C++ module SDK and third party modules.
Installing the server
Download the corrent server package for your operating system from the homepage http://liberty-unleashed.co.uk/. This package includes the server binary, default Squirrel modules as well as basic configuration files and scripts. 3rd party modules and scripts can be downloaded from the scripting boards. Copyrighted files such as GTA data files are not included with the server.
- Windows server: Make sure that you have Updater.exe in your server root directory if you wish to use automatic updates.
- Linux server: Make sure that the server binary is executable (chmod u+x Server.bin).
Configuring the server
A default file structure for a Liberty Unleashed server would look like this:
server.conf controls the core settings for your server. LU/ is the main content folder for Liberty Unleashed, and content.xml controls the game-specific contents for your server. These are the main config files of your server.
server.conf controls the game-independent configuration options of your server. These include for example the name of your server, the game your server is running, and many network related settings. A more detailed description of the file is available here.
content.xml contains the main game-dependent content (such as vehicles, pickups, scripts). More detailed info about the file and modifying it, click here.
Unleashed Anticheat allows you to add custom file checks for any client-side game data files. These filechecks are controlled by Anticheat.uac, which is located in server content folder (LU/ for Liberty Unleashed). Anticheat.uac is a list of files located within data/ folder, separated by line breaks. If UAC has been enabled, it will read the file list from Anticheat.uac and calculate checksums for the specified files. These checksums are then compared to the ones of every incoming client. This feature allows server owners to run servers for GTAIII / VC mods and total conversions without a fear that any of the clients who connect the server might not be using correct files for the mod.
GTA data files
It is possible to sync some of the core GTA data files (located in data/) for all clients. These files are automatically loaded and shared to all clients when they are placed in LU/data folder:
- carcols.dat - Defines the default colours used by GTA when spawning vehicles and sets allowed random colour IDs for every vehicle model.
- handling.cfg - Vehicle handling settings. Controls many performance and behaviour values for each vehicle model.
- surface.dat - Controls traction values for different surface types.
- weapon.dat - Settings for weapons. Defines weapon properties like caused damage, fire rate etc.
For more information about each file and the values they control, click on the file name. Most data within these files can also be changed run-time via scripts.
You can extend the server-side scripting using official or 3rd party Squirrel modules. These modules should be located within the Modules/ folder. There they can be loaded by individual scripts using the built-in function LoadModule.
A set of custom sounds and images can be loaded on server start for scripts to use. These files will be downloaded by the client upon connect. Custom files, such as modules, are controlled by scripts.
Running the server
After you have configured the server and uploaded scripts and files, as well as made sure Updater.exe exists in the server root directory, just run Server.exe.
After you have configured the server and uploaded scripts and files, as well as made sure the server has correct permissions, just execute Server.bin: ./Server.bin
NOTES: If you are connected to server via SSH, use GNU Screen for run server in the background.
Command line arguments
When launching the server it is possible to pass some optional launch arguments:
- -noinput - Does not print messages to the server console.
- -maxplayers <players> - Forces the max player count. When used the max player count can't be set over this value using the config file or scripting functions.
- -port <port> - Forces the port to listen on the one specified, ignoring the one set in the configuration file.
- -bindip <IP> - Binds the server to the specified IP.
- -appendname <string> - Adds the specified string on the end of the server name. E.g. -appendname "[Host: VRocker-Hosting.co.uk]".
- If there are other arguments than the ones mentioned above, the first one will be the server config file. This allows you to run multiple servers with different configs using the same binary and script files.
You can control your server by typing commands to the server console while it's running. Everything listed in server.conf is a valid console command. In addition, a few extra commands can be used:
- say <message> - Sends an admin message in-game.
- quit - Shuts down the server.
- load_script <script folder> - Loads a script folder located in Scripts/.
- unload_script <script folder> - Unloads a script folder located in Scripts/.
- reload_scripts - Reloads all scripts loaded from content.xml.
- reload_content - Reloads content.xml.
- checkupdates - Checks if there are any updates for the server.