Getting Started

Revision as of 03:19, 11 January 2021 by Vortrex (talk | contribs)

General Stages

Download the server files on the Downloads page at gtaconnected.com.

Extract the server files to an empty folder.

Change settings in server.xml.

Run Server.exe.

Player Spawning and Camera Fading

The default resource, called "freeroam", includes spawning the player and fading the camera.

If you are not using this default resource, be sure to spawn the player and fade the camera using spawnPlayer and gta.fadeCamera in a logical event such as in the onPlayerJoined event.

Manual

Check the Server Manual page.

Creating a New Resource

Add your resource to server.xml

Open file "server.xml" in a text editor, such as Notepad or Notepad++. The file is found in your server folder.
Scroll down to the "<resources>" tag, which is currently at the bottom of the xml file.
Add a "<resource>" tag inside the "<resources>" tag, and give it an attribute with the name "src" and a value of the name of your new resource.
For example:

<resources> <resource src="freeroam" /> <resource src="my_new_resource" /> </resources>

Create folder for your resource

Open the "resources" folder, which is found in your root server directory.
Create a new folder called "my_new_resource".

Create meta.xml for your resource

Create a file called "meta.xml" inside your "my_new_resource" folder.
Add the following XML text to your meta.xml file:

<meta> <info author="your_username_here" description="Description for your new resource here." />

<script src="my_server_script.js" type="server" language="javascript" /> <script src="my_client_script.js" type="client" language="javascript" /> </meta>

Edit meta.xml for your resource

Fill in the defaults for the <info> tag, which include the author and description attributes.
A resource doesn't need to have both server and client scripts, however this example includes both.

A <script> tag is needed for each script (file) in your resource.
The src attribute for the <script> tag, is the filename of a script, which will be inside your "my_new_resource" folder.
A script can also be in a folder, or a folder in a folder, etc, inside your "my_new_resource" folder.

The type attribute for the <script> tag, can be either "server" or "client".
Server scripts run on the server, client scripts run on the client.
Different scripting functionality is provided for the server and the client.

The language attribute for the <script> tag, can be "javascript", "lua", or "squirrel".
A resource can use multiple languages, if desired.
It is also possible to transfer data between different languages, both in the same resource or in different resources, if desired.