Difference between revisions of "Resources"

From GTA Connected
Jump to navigation Jump to search
 
Line 1: Line 1:
 
== What is a resource? ==
 
== What is a resource? ==
A resource is a folder that contains a file to identify information about the resource and the files associated with the resource, such as the script files. The meta file tells the game how to interpret the resource, such as what scripts the server runs and which scripts the client will have to download and run.  
+
A resource is a folder that contains a file to identify information about the resource and the files associated with the resource, such as the script files. The meta file tells the server how to use the resource, such as what scripts the server runs and which scripts and files the client will have to download and run.  
  
A resource is very similar to an executable. You can start or stop resources, you can have more than 1 resource running at the same time. Resources would usually contain a script for game modes or can also contain other tasks to help control/manage the server, add commands, provide separate content, etc.  
+
You can reload, start, and stop resources, and you can have more than 1 resource running at the same time. Resources would usually contain a script for game modes or can also contain other tasks to help control/manage the server, add commands, provide separate content, etc.  
  
Resources can be created with any of the supported languages: Lua, Squirrel, or JavaScript.
+
Resources can be created with any of the supported languages: Lua, Squirrel, or JavaScript. These can be mixed in the same resource (although in different file types). You can have one file running Lua, another with JavaScript, and another with Squirrel, all working together in the same resource.
  
 
== Creating a resource ==
 
== Creating a resource ==
To create a resource for the server you would simply create a new folder with the name of the resource.
+
To create a resource for the server you would simply create a new folder with the name of the resource.  
Once you created the new folder go inside it.
+
Then to configure it you will need to create a file inside the resource folder named "meta.xml" (without the quotes) and open it in Notepad or your favorite code editor. We recommend [http://notepad-plus-plus.org/ Notepad++].
To configure the resource you will need to create a file named "meta.xml" without the quotes and then open it in Notepad or your favorite code editor. We recommend [http://notepad-plus-plus.org/ Notepad++].
 
  
 
Here is an example for the contents of the meta file:
 
Here is an example for the contents of the meta file:

Latest revision as of 12:59, 21 March 2020

What is a resource?[edit]

A resource is a folder that contains a file to identify information about the resource and the files associated with the resource, such as the script files. The meta file tells the server how to use the resource, such as what scripts the server runs and which scripts and files the client will have to download and run.

You can reload, start, and stop resources, and you can have more than 1 resource running at the same time. Resources would usually contain a script for game modes or can also contain other tasks to help control/manage the server, add commands, provide separate content, etc.

Resources can be created with any of the supported languages: Lua, Squirrel, or JavaScript. These can be mixed in the same resource (although in different file types). You can have one file running Lua, another with JavaScript, and another with Squirrel, all working together in the same resource.

Creating a resource[edit]

To create a resource for the server you would simply create a new folder with the name of the resource. Then to configure it you will need to create a file inside the resource folder named "meta.xml" (without the quotes) and open it in Notepad or your favorite code editor. We recommend Notepad++.

Here is an example for the contents of the meta file:

<meta>
    <info author="jack9267" type="script" version="1.0.0" description="Provides something awesome." />

    <script src="server.lua" type="server" language="lua" />
</meta>

The info element would contain who made the script, the type of script and the version of the script.
You would have a script element for each script file you wish to load.
The type attribute refers to where the script will run, specify "server" for server code or "client" to have the script download and run on the client.
The language attribute tells the server which language to interpret the script.
GTA Connected supports Lua (language="lua"), JavaScript (language="javascript"), and Squirrel (language="squirrel")

Resource Meta File[edit]

Below is a list of all accepted meta.xml nodes.

<meta>
    <info author="" type="" version="" description="" />
    <script src="" type="" language="" />
    <dependency src="" />
    <map src="" type="" />
    <file url="" src="" type=""  />
</meta>


Default resources[edit]

You can check out the default resources for the server here.