cmake -B ./build ./
cmake --build ./build
For x86 MTA server:
cmake -A Win32 . -B build
cmake --build build --config Release
for x64 MTA server:
cmake -A x64 . -B build
cmake --build build --config Release
You can get prebuilded packages on GitHub releases page
- 32 bit: Copy 32 bit
ml_package.dll
into theMTA San Andreas\server\mods\deathmatch\modules\
directory. - 64 bit: Copy 64 bit
ml_package.dll
into theMTA San Andreas\server\x64\modules\
directory.
Then, add the following line in mtaserver.conf
:
<module src="ml_package.dll" />
- 32 bit: Copy 32 bit ml_package.so into the
mods/deathmatch/modules/
directory. - 64 bit: Copy 64 bit ml_package.so into the
x64/modules/
directory.
Then, add the following line in mtaserver.conf
:
<module src="ml_package.so" />
-- You can use absolute path for require function
-- The module start searching from 'mods/deathmatch/resources' folder
local module = require "folder1.folder2.resourceName.resourceFile"
-- Relative path is supported too. It starts with ":"
local module = require ":resourceName.resourceFile"
-- You can use "mods/deathmatch/lua/server" folder for shared code
local fooModule = require "mysmalllib"
local barModule = require "mylib.libfile"
LuaRocks has some usefull native modules for Lua. require
supports native modules.
- Install Lua and luarocks
sudo apt install luarocks lua5.1
-
Copy
scripts/luarocks.sh
from this repository to your MTA server forlder. -
Now you can use
luarocks.sh
to build native modules
./luarocks.sh install rapidjson
local rapidjson = require "rapidjson"
-
Install Visual Studio and CMake via Visual Studio Installer
-
Copy
scripts/luarocks.ps1
from this repository to your MTA server forlder. -
Now you can use
luarocks.ps1
to build native modules with using powerschell console
.\luarocks.ps1 install rapidjson