Modules: Difference between revisions

No edit summary
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
==Summary==
==Summary==
Modules are extensions that provide scripting resources and functionality that isn't provided in the default server. Modules also have the ability to include 3rd party libraries (such as MySQL).
Modules are extensions that provide scripting resources and functionality that isn't provided in the default server. Modules also have the ability to include 3rd party libraries (such as MySQL).


==Module SDK==
==Module SDK==
Line 7: Line 8:


==How to Create==
==How to Create==
First, you'll need to either create the module source yourself or find one that already exists. Grab the sample module download, compile the module source (be sure to include GalacticC as a header!) and if all goes well, you should end up with a DLL file corresponding to the project name in Visual Studio. Rename this DLL file according to the architecture of your server, using an underscore and the architecture identifier (x86 or x64). For example, if you have a module called "MyModule", then the DLL file name should be MyModule_x86.dll for a 32 bit server and MyModule_x64.dll for a 64 bit server.
First, you'll need to either create the module source yourself or find one that already exists. Grab the sample module download, include the files in your project, compile, and if all goes well you should end up with a DLL file (Windows) or an SO file (Linux). See some example modules (some with source) [https://forum.gtaconnected.com/index.php?board=24.0 here]


==Resources==
==Resources==
Once the module is loaded, all namespaces, classes, functions and properties it provides are available to use in scripting resources. Each module will have it's own namespace inside the module namespace. For example, if your module's namespace is "mysql" and you have a "connect" function within that namespace, then the syntax within scripting would be "module.mysql.connect()"
Once the module is loaded, all namespaces, classes, functions and properties it provides are available to use in scripting resources. Each module will have it's own namespace inside the module namespace. For example, if your module's namespace is "mysql" and you have a "connect" function within that namespace, then the syntax within scripting would be "module.mysql.connect()"


==More Help==
==Notes==
For more help and information regarding modules, ask on the forum or the discord!
* For more help and information regarding modules, ask on the forum or the discord!
* '''For security reasons, modules can not be used on the client, and the server does not provide a way to distribute and load them onto clients.'''

Latest revision as of 06:07, 2 August 2025

Summary

Modules are extensions that provide scripting resources and functionality that isn't provided in the default server. Modules also have the ability to include 3rd party libraries (such as MySQL).


Module SDK

The module SDK for GTA Connected is known as "GalacticC" ... It's a C library that provides all the necessary functions to create classes, namespaces, functions, and properties to use in your server resources.

How to Create

First, you'll need to either create the module source yourself or find one that already exists. Grab the sample module download, include the files in your project, compile, and if all goes well you should end up with a DLL file (Windows) or an SO file (Linux). See some example modules (some with source) here

Resources

Once the module is loaded, all namespaces, classes, functions and properties it provides are available to use in scripting resources. Each module will have it's own namespace inside the module namespace. For example, if your module's namespace is "mysql" and you have a "connect" function within that namespace, then the syntax within scripting would be "module.mysql.connect()"

Notes

  • For more help and information regarding modules, ask on the forum or the discord!
  • For security reasons, modules can not be used on the client, and the server does not provide a way to distribute and load them onto clients.