How do I set up a server?
You start and stop the server from the launcher. Add your Lua resources, start the server and publish it on the list so players can join.
- Install the Trilogy Hub launcher and sign in.
- Create a new server in the servers tab.
- Open the server files and put your resources in the
resourcesfolder. - Start the server. In its console you turn resources on and off with the
start,stopandrestartcommands. - Publish the server on the list.
What does a resource look like?
A resource is a folder in resources/ with a meta.xml file, just like in MTA:SA. server scripts stay on the server, client scripts are sent to players, and shared scripts run on both sides.
-- Car on command: RGB colour, headlights, custom plate
addCommandHandler("auto", function(player)
local x, y, z = getElementPosition(player)
local car = createVehicle(536, x + 3, y, z) -- Blade
setVehicleColor(car, 255, 122, 34, 20, 20, 20)
setVehicleHeadLightColor(car, 255, 180, 90)
setVehiclePlateText(car, "GROVE 4L")
warpPedIntoVehicle(player, car)
end)
-- Sunset over Los Santos
setTime(19, 30)
setWeatherBlended(1)
-- Weapon wheel slow motion from Definitive Edition
setSlowMotionEnabled(true, "wheel")
-- UI theme, notification and dialog box
guiSetTheme("sunset")
addEventHandler("onClientResourceStart", resourceRoot, function()
guiNotify("Welcome to Los Santos!", "success", 4000)
end)
bindKey("F2", "down", function()
local box = guiMessageBox("Faction", "Join Grove Street?", { "Yes", "No" })
addEventHandler("onClientGUIAccepted", box, function(label)
if label == "Yes" then triggerServerEvent("faction:join", localPlayer) end
end, false)
end)
<meta>
<info author="You" name="grove" version="1.0" type="gamemode" />
<script src="server.lua" type="server" />
<script src="client.lua" type="client" />
</meta>
- Players download client files once, and on later visits only the files that changed.
- Client scripts and HTML/JS/CSS page files can be stored on the player's machine encrypted (
protected="true"). - Everything a resource creates disappears when you stop it.
How does a server get on the list?
A published server appears on the list in every player's launcher. When you shut it down, it disappears from the list of online servers on its own.
Questions
Will my MTA:SA scripts work?
Partly. The Trilogy Hub API uses a similar model: resources with meta.xml, events, exports and the same names for many functions. A ready-made resource needs reviewing, because not every function has a counterpart.
How do I set up my own server?
You start the server from the launcher. Put your Lua resources in the resources folder, start the server and publish it on the list so others can join.
Can I play with friends?
Yes. You add friends in the launcher, see who is online and chat with them. Pick a server from the list and join with the PLAY button.