Plugin Support
This script supports user-made plugins.
How to create a custom plugin
Basic Preparation
Open the root folder of
visn_are
, there should be aplugins
folder, open it.Download the sample plugin from our github page.
Drag and drop the folder inside the plugins folder.
Now rename the folder to your custom name.
Open the
plugin_test_client.lua
and edit thepluginData
.Do the same for
plugin_test_server.lua
.Now rename the two files to your custom name, but this format is important:
plugin_NAME_TYPE.lua
Type can be: 'server' or 'client' -> It will decide if it will execute on client or server.
Let's create our own content!
Let's create a plugin that prints a message when our heart rate is below 80.
Since this will be a client-side-plugin, we will open our client-side plugin file. (In this case plugin_test_client.lua
)
Inside of the RegisterClientPlugin
function we will put our logic.
To permanently print a message when our heart rate is below 80, we need a thread
and a while-loop
.
After we implemented it, we will access the client health buffer and do a check if the heart rate is below 80.
Since everything in the if-statement will only trigger when the heart rate is below 80 we will just print "Low on health!"
inside the statement.
The basic logic is done, but we need to prevent a client-crash so let's implement a Citizen.Wait
-call inside the while-loop
.
We are done!
After the resource has been started (or restarted) the plugin will load.
Now when are ingame and the heart rate is below 80, the console is getting spammed with "Low on health!"
.
Questions
Last updated