Plugin Support

This script supports user-made plugins.

How to create a custom plugin

Basic Preparation

  1. Open the root folder of visn_are, there should be a plugins folder, open it.

  2. Download the sample plugin from our github page.

  3. Drag and drop the folder inside the plugins folder.

  4. Now rename the folder to your custom name.

  5. Open the plugin_test_client.lua and edit the pluginData.

  6. Do the same for plugin_test_server.lua.

  7. Now rename the two files to your custom name, but this format is important:

    1. plugin_NAME_TYPE.lua

    2. 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

Which functions can I use?

Take a look at the API Reference.

Last updated