Example Plugin, Lua
The Lua version of the vMenu Enhanced example plugin.
What is it
The Lua version of the example plugin. Resource name vMenu.ExamplePlugin.Lua.
Where do I look
| File | Contains |
|---|---|
client.lua | The menu, translations and gates |
server.lua | Permissions and settings |
vmenu.lua | The plugin API |
fxmanifest.lua | The manifest |
API docs: Lua setup.
Building this example
Nothing to build. Copy this folder into your server's resources folder, rename it to vMenu.ExamplePlugin.Lua and ensure it.
Making your own plugin
- Take
vmenu.luafrom theplugin-apifolder of the vMenu Enhanced zip your server runs, and put it in your resource. - Load it before your own scripts in
fxmanifest.lua:lua54 'yes' shared_script 'vmenu.lua' client_script 'client.lua' server_script 'server.lua' - Use the global
vMenutable in your scripts, for examplelocal plugin = vMenu.CreatePlugin('My Plugin'), thenensurethe resource.
Calls that wait for vMenu (Connect, GetText, Server.Register) must run inside CreateThread or a menu event handler. When you update vMenu, replace vmenu.lua with the one from the new zip.