Resources: Difference between revisions

Jump to navigation Jump to search
1,249 bytes added ,  Friday at 03:58
no edit summary
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 36: Line 36:




== Meta File ==
== Meta.xml File ==
Here is an example for the contents of the meta file:
This is used to provide some basic information and what scripts/files it provides.<br>
{{XMLCode|1=<meta>
'''All resources must have a meta.xml, or the resource won't load!'''
<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 contains who made the script, the type of script and the version of the script.<br>


You would have a script element for each script file you wish to load, each with a "type" attribute that refers to what side the script will run on (server or client), a language attribute that tells the server/client which language the script file uses (see [[ScriptingLanguages|supported scripting languages]]), and a "src" attribute with the file name as a relative path (i.e. "example.js" or "foo/bar.js".
Example
 
Below is a list of all accepted meta.xml nodes.
{{XMLCode|1=<meta>
{{XMLCode|1=<meta>
<info author="" type="" version="" description="" />
<info author="" type="" version="" description="" />
Line 56: Line 48:
<file url="" src="" type=""  />
<file url="" src="" type=""  />
</meta>}}
</meta>}}
Some notes:
* All "src" attributes are a relative path to the file, with the resource's folder as the root.
* The <code>info</code> node contains attributes that indicates who made the resource, it's type (custom description), custom version number, and a description of the resource<br>
* Every script file needs to have a <code><script></code> node, each with a "type" attribute that refers to what side the script will run on (server or client), a language attribute that tells the server/client which language the script file uses (see [[ScriptingLanguages|supported scripting languages]]), and a "src" attribute with the file name as a relative path (i.e. "example.js" or "foo/bar.js".
* Every custom file needs to have a <code><file></code> node, each with a "src" attribute for the file's path, and a "type" attribute indicating whether it's for the client or server.
* Any <code><dependency></code> node, with a "src" attribute with the other resource's name, will require the other resource to be loaded BEFORE this one.


== Client-side Files ==
== Client-side Files ==
Line 61: Line 60:


== Other Notes ==
== Other Notes ==
* The server will ignore any folders named with open and close square brackets, meaning they will not be loaded or cached as resources. This is useful if you want to group resources into subfolders for organization. Example name: [foobar]
* The server will ignore any folders named with open and close square brackets, meaning they will not be loaded or cached as resources. This is useful if you want to group resources into subfolders for organization. Example name: [foobar]<br>
* Resources are completely sandboxed on both server and client, and any file paths are jailed in the resource's folder. All available file-related functions are carefully set up to only allow access to files within the resource. This also applies to client-side resource cache.
* Client side ''scripts'' (provided by a <script> tags in meta.xml) are sent separately to clients using the server's game/sync networking and are NOT saved to the cache. This helps lower the chances of script theft. Only files provided with <file> tags are sent via the HTTP server.
* Scripts and files that are only server-side are not accessible to clients. If your ''server-only'' scripts or files are stolen or leaked, it's not GTA Connected's fault. There is likely a security exploit somewhere on the machine or hosting service that you're running the server on.
2,770

edits

Navigation menu