Type of scripts
🧱 Main script
Every class that extends BaseEntity
registered with the @model(modelName, abstract?) decorator is treated as the main script.
Every main script instance has:
self.id
The uNetId (UtilityNet id) of the current entity
self.obj
The GTA entity handle of the current entity
self.state
The object state bag, read-only (client)
self.plugins
A table with every plugin instance
[scriptName] = instance
self.server
Used to call server-side entity RPC functions
🔌Plugin script
Every class that extend BaseEntity
registered with the @plugin(pluginName) decorator on a main script is treated as a plugin script.
Plugin scripts are useful to modularize code/logic attaching only specific plugins and so making everything more robust and modular.
They are really similar to the main script, the only differences are:
self.plugins
Doesn't exist on plugins
self.isPlugin
on true
self.main
The main script instance
Last updated