Package Protocol: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 1: Line 1:
When referencing to other files in client_packages, you use '''package://'''
==Summary==
The root of this protocol is the client_packages folder.
<code>http://package/</code> is the protocol for the root folder of client_packages, so <code>http://package/</code> returns client_packages, makes it easier for you to require files client-side.


For example, a file located in '''client_packages\index.html''' can be referred to with <code>package://index.html</code>   
When referencing to other files in client_packages, you use <pre>http://package/</pre>
A file located in '''client_packages\my-resource\index.html''' can be referred to with <code>package://my-resource/index.html</code>
For example, a file located in '''client_packages\index.html''' can be referred to with <pre>http://package/index.html</pre>   
You can also require json files with it <code>package://my-resource/beasts.json</code>, so it'll be <code>const beasts = require('package://my-resource/beasts.json')</code>  
A file located in '''client_packages\my-resource\index.html''' can be referred to with <pre>http://package/my-resource/index.html</pre>
You can also require json files with it <code>http://package/my-resource/beasts.json</code>, so it'll be <pre>const beasts = require('http://package/my-resource/beasts.json')</pre>  


*'''NOTE''': JSON Require only works in '''CEF'''.
*'''NOTE''': JSON Require only works in '''CEF'''.

Revision as of 03:43, 28 May 2024

Summary

http://package/ is the protocol for the root folder of client_packages, so http://package/ returns client_packages, makes it easier for you to require files client-side.

When referencing to other files in client_packages, you use

http://package/

For example, a file located in client_packages\index.html can be referred to with

http://package/index.html

A file located in client_packages\my-resource\index.html can be referred to with

http://package/my-resource/index.html

You can also require json files with it http://package/my-resource/beasts.json, so it'll be

const beasts = require('http://package/my-resource/beasts.json')
  • NOTE: JSON Require only works in CEF.