docs: add all untracked content
35
Documentation/Mod.md
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
title: Mod Documentation
|
||||
description: This page is for the documentation of the Lua Mod.
|
||||
published: true
|
||||
date: 2022-12-22T09:22:51.567Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2022-12-21T14:01:49.658Z
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
***
|
||||
|
||||
Since the beginning BeamMP has been built on custom messages. This consists of a structure like `<IDENTIFIER>:<SUBIDENTIFIER/PARAMS>:<PARAMS>`
|
||||
|
||||
# Data Documentation
|
||||
## Received Packets
|
||||
|
||||
| Example | Protocol | Identifier | Sub Identifier | Data | Comments |
|
||||
|---------|----------|------------|----------------|------|----------|
|
||||
| | `TCP` | `A` | | | Launcher heartbeat |
|
||||
| | `TCP` | `B` | | | Server List |
|
||||
| | `TCP` | `L` | | | Mods List |
|
||||
| | `TCP` | `M` | | | Map Received, Tell the game to load the map |
|
||||
| | `TCP` | `N` | | | Login Received / Confirmed |
|
||||
| | `TCP` | `U` | `l` \| `p` | | Messages, This U packet is used for all UI related messages |
|
||||
| | `TCP` | `Z` | | | Launcher / Client Version |
|
||||
|
||||
## Sent Packets
|
||||
|
||||
| Example | Protocol | Identifier | Sub Identifier | Data | Comments |
|
||||
|---------|----------|------------|----------------|------|----------|
|
||||
| | `TCP` | `C` | | | Launcher heartbeat |
|
||||
| | `TCP` | `B` | | | Server List |
|
251
Scripting.html
Normal file
@ -0,0 +1,251 @@
|
||||
<!--
|
||||
title: Scripting in BeamMP
|
||||
description: This will briefly introduce you to the concept of scripting for BeamMP.
|
||||
published: true
|
||||
date: 2022-12-22T09:22:38.585Z
|
||||
tags: scripting
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-17T19:31:24.640Z
|
||||
-->
|
||||
|
||||
<p>BeamMP allows server-owners to extend the functionality of their server via custom <a href="lua.org">lua</a> scripts/plugins.</p>
|
||||
<h1>Plugin Folder</h1>
|
||||
<p>all lua files live inside of their respective plugin folder, the plugin folder should look like this: <u>Resources\Server\<pluginName></u> every lua file within a plugin folder has its own dedicated lua environment; under normal circumstances, separate lua files cannot interact with each-other beyond triggering events.</p>
|
||||
<h1>Events</h1>
|
||||
<p> in BeamMP, events must be registered using <u>RegisterEvent(<EventName>,<functionName>)</u> otherwise they will not be triggered, the 'EventName' parameter is the title of the desired event to be registered as a string, 'FunctionName' is the name of the <strong>global</strong> function as a <strong>string</strong> that you want to be called when the event is triggered. </p>
|
||||
<h2>Vanilla BeamMP events</h2>
|
||||
<p>Vanilla BeamMP servers ship with various pre-existing events which correspond to various in-game actions. can be cancelled by returning 1 in the function.</p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Event Name</th>
|
||||
<th>Parameters</th>
|
||||
<th>When is it triggered?</th>
|
||||
<th>When cancelled</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>onInit</td>
|
||||
<td>nothing</td>
|
||||
<td>When the lua file is loaded</td>
|
||||
<td>Does nothing</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onPlayerConnecting</td>
|
||||
<td>PlayerID</td>
|
||||
<td>When the player presses 'Connect'</td>
|
||||
<td>Not recomended, use DropPlayer(PlayerID, reason)</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onPlayerJoining</td>
|
||||
<td>PlayerID</td>
|
||||
<td>When the player begins loading</td>
|
||||
<td>Not recomended, use DropPlayer(PlayerID, reason)</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onPlayerJoin</td>
|
||||
<td>PlayerID</td>
|
||||
<td>When the player is done loading</td>
|
||||
<td>Not recomended, use DropPlayer(PlayerID, reason)</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onPlayerDisconnect</td>
|
||||
<td>PlayerID</td>
|
||||
<td>When the player leaves the server</td>
|
||||
<td>Does Nothing</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onChatMessage</td>
|
||||
<td>PlayerID, name, message</td>
|
||||
<td>When a player sends a chat message</td>
|
||||
<td>Message does not display in chatbox</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onVehicleSpawn</td>
|
||||
<td>PlayerID, vehicleID, data</td>
|
||||
<td>When a player spawns a vehicle</td>
|
||||
<td>Deletes vehicle, does not trigger onVehicleDeleted</td>
|
||||
<td>data is raw JSON</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onVehicleEdited</td>
|
||||
<td>PlayerID, vehicleID, data</td>
|
||||
<td>When a player applies their edits to the server</td>
|
||||
<td>Deletes vehicle, does not trigger onVehicleDeleted</td>
|
||||
<td>data is raw JSON</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onVehicleDeleted</td>
|
||||
<td>PlayerID, vehicleID</td>
|
||||
<td>When a player deletes their vehicle</td>
|
||||
<td>Does Nothing</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<h2>User-defined events</h2>
|
||||
<p>Users may also define their own Events beyond the pre-existing BeamMP events, they are registered the same way as normal events, the difference being that user-defined events are not tied to a specific event on the server and instead have to be triggered manually.</p>
|
||||
<p>User-defined events can be triggered using two functions, <u>TriggerLocalEvent(<EventName>, ...)</u> or <u>TriggerGlobalEvent(<EventName>, ...)</u> String, EventName is the name that users will register their events under, any parameters after EventName, will be passed to the function the event points to. <u>TriggerLocalEvent(<EventName>, ...)</u> will execute any registered instances of EventName within the <strong>plugin folder</strong>, whereas <u>TriggerGlobalEvent(<EventName>, ...)</u> will execute <strong>any</strong> registered instance of EventName regardless of plugin folder.</p>
|
||||
<p>Under normal circumstances, user-defined events are the only way that separate lua files will be able to communicate with each other.</p>
|
||||
<h1>Functions</h1>
|
||||
<p>BeamMP also has a set of predefined global functions you may use.</p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Description</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>GetPlayerName(<serverID>)</td>
|
||||
<td>Returns the players discord name as a string</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GetPlayerDiscordID(<serverID>)</td>
|
||||
<td>Deprecated, for compatibility, currently returns the player's name as a string.</td>
|
||||
<td>Deprecated, do not use this.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GetPlayerHWID(<serverID>)</td>
|
||||
<td>Returns the players hardware id as a string.</td>
|
||||
<td>hardware ID is not<br>implemented yet.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GetPlayerVehicles(<serverID>)</td>
|
||||
<td>Returns the players vehicles as a table of IDs and Data (nil if no cars were found)</td>
|
||||
<td>Doesn't work/inconsistent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DropPlayer(<serverID>, <Reason>)</td>
|
||||
<td>Drops the connection for a specific player. Essentially Kicking them</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SendChatMessage(<serverID>,<Message>)</td>
|
||||
<td>Sends a message over the network as the server to a player use -1 to broadcast</td>
|
||||
<td>use -1 to broadcast</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RegisterEvent(<EventName>,<functionName>)</td>
|
||||
<td>Register a function to be triggered by EventName. <br>functionName is a string representing a global function.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TriggerLocalEvent(<EventName>, ...)</td>
|
||||
<td>Trigger any Event registered under <EventName> within the plugin folder.<br>Any further args after <EventName> will be passed through as args.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TriggerGlobalEvent(<EventName>, ...)</td>
|
||||
<td>Trigger any Event registered under <EventName> regardless of the plugin folder.<br>Any further args after <EventName> will be passed through as args.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CreateThread(<funcName>, <times per sec>)</td>
|
||||
<td>funcName is a string representing the global name of a function.<br>A new thread will be created, on which, function is called x times per sec</td>
|
||||
<td>cannot pass args<br>use this instead of infinite loops<br>times/sec is between 1 and 500</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>StopThread()</td>
|
||||
<td>Will stop trying to call the thread function of the current script</td>
|
||||
<td>if there is no thread, <br>nothing happens</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GetPlayerCount()</td>
|
||||
<td>Returns the number of players on the server.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sleep(<millisecs>)</td>
|
||||
<td>pauses <strong>ALL</strong> operations for milliseconds. It is recommended that you only use Sleep inside of a thread.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RemoveVehicle(<serverID>,<VehicleID>)</td>
|
||||
<td>Deletes a player's vehicle.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GetPlayers()</td>
|
||||
<td>Returns a table of serverID's and their names. </td>
|
||||
<td>nil if there is no players connected</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TriggerClientEvent(<serverID>,<function name>,<Data>)</td>
|
||||
<td>Will send a trigger request to the client lua.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Set(<configID>, <new value>)</td>
|
||||
<td>Will change the running-config of the server depending on the ID.</td>
|
||||
<td>
|
||||
<p>0 for the debug config,</p>
|
||||
<p>1 for the private config,</p>
|
||||
<p>2 for the CarCount Config,</p>
|
||||
<p>3 for the MaxPlayers config,</p>
|
||||
<p>4 for the Map,</p>
|
||||
<p>5 for the Name,</p>
|
||||
<p>6 for the Description,</p>
|
||||
<p>any other ID will result in a console warning.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>exit</td>
|
||||
<td>will close the server.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<h1>Players</h1>
|
||||
<p>When a player connects to your server, they are assigned a serverID starting from 0 and counting upwards. serverIDs are reused; if a player leaves and re-joins they will not be assigned a new serverID, they will simply get another available one. When the server restarts, serverIDs will be reset.</p>
|
||||
<h2>Static Identifiers</h2>
|
||||
<p>Players in BeamMP have 3 static identifiers which can be obtained from their serverID being their name, discordID, and their hardwareID or HWID. (though the latter of the aforementioned isn't implemented, we will act as if it is) Each of the three ID types has their own origins and strength's/weaknesses to using them for player identification.</p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID TYPE</th>
|
||||
<th>PROS</th>
|
||||
<th>CONS</th>
|
||||
<th>FUNCTION TO OBTAIN</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td>easy to obtain, straightforward</td>
|
||||
<td>not secure</td>
|
||||
<td>GetPlayerName(<serverID>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>discordID</td>
|
||||
<td>fairly secure</td>
|
||||
<td>inconvenient</td>
|
||||
<td>GetPlayerDiscordID(<serverID>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HWID</td>
|
||||
<td>extremely secure</td>
|
||||
<td>hard to obtain</td>
|
||||
<td>GetPlayerHWID(<serverID>)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<h1>Vehicles</h1>
|
||||
<p>Vehicles in beamMP have 3 attributes that the server pays attention to, the owner's serverID, the vehicles vehicleID and it's data. The the Owner's serverID is straight forward, it is the serverID, every vehicle also has an ID, vehicle IDs are not unique to the vehicle; two vehicles may have the same ID, assuming they're from different owners. Unlike serverIDs, vehicleIDs <strong>are reused</strong>, for example, if I have 4 vehicles, their IDs are 0, 1, 2 and, 3 if I delete the vehicle in vehicleID 2, I will have 0, 1 and, 3, when I spawn a new vehicle, the new vehicle will slot into ID 2. Lastly, the last attribute vehicles have is data, data contains a vehicle, name, parts, and other data; as the name implies. data is stored as a raw JSON string, so you will need a <a href="https://gist.github.com/tylerneylon/59f4bcf316be525b30ab">JSON library</a> alternatively, you can manually step through the string and dig out the information you need.</p>
|
14
Scripting/client-scripting.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!--
|
||||
title: Client Scripting in BeamMP
|
||||
description: This will briefly introduce you to the concept of scripting for BeamMP on client side.
|
||||
published: true
|
||||
date: 2022-12-22T09:22:55.124Z
|
||||
tags: scripting, client, server, lua, coding, communication
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-08-28T19:06:03.744Z
|
||||
-->
|
||||
|
||||
<p>BeamMP allows you to create your own client side plugins as well. We have provided a few functions that you can use to communicate with other multiplayer mods, and other players through the server.</p>
|
||||
<p>You can create an event your custom functions can hook onto. For example to parse the chat use the <span style="font-family:'Courier New', Courier, monospace;">ChatMessageReceived </span>event as such:</p>
|
||||
<p><span style="font-family:'Courier New', Courier, monospace;">local function chatReceived(msg) -- Receive event with parameters</span><br><span style="font-family:'Courier New', Courier, monospace;"> print("chat received: "..msg)</span><br><span style="font-family:'Courier New', Courier, monospace;"> local i = string.find(s, ":") -- Find where our first ':' is, used to separate the sender and message</span><br><span style="font-family:'Courier New', Courier, monospace;"> if i == nil then</span><br><span style="font-family:'Courier New', Courier, monospace;"> print("error parsing message: separator could not be found!")</span><br><span style="font-family:'Courier New', Courier, monospace;"> return -- Could not find separator, cancel function</span><br><span style="font-family:'Courier New', Courier, monospace;"> end</span><br><br><span style="font-family:'Courier New', Courier, monospace;"> print("index of separator: "..tostring(i))</span><br><br><span style="font-family:'Courier New', Courier, monospace;"> local sender = string.sub(msg, 1, i-1) -- Substring our input to separate its 2 parts</span><br><span style="font-family:'Courier New', Courier, monospace;"> local message = string.sub(msg, i+1, -1)</span><br><span style="font-family:'Courier New', Courier, monospace;"> -- Do whatever you want to with the message</span><br><span style="font-family:'Courier New', Courier, monospace;"> print("sender: " .. sender)</span><br><span style="font-family:'Courier New', Courier, monospace;"> print("message: ".. message)</span><br><span style="font-family:'Courier New', Courier, monospace;">end</span></p>
|
||||
<p><span style="font-family:'Courier New', Courier, monospace;">AddEventHandler("ChatMessageReceived", chatReceived)</span><br><span style="font-family:'Courier New', Courier, monospace;">TriggerServerEvent("ServerEventName", "Data")</span><br><span style="font-family:'Courier New', Courier, monospace;">AddEventHandler("EventNameToBeCalled", Function())</span></p>
|
47
Scripting/client_scripting.md
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
title: Client Side Scripting
|
||||
description: Client Side Scripting
|
||||
published: true
|
||||
date: 2022-12-22T09:22:58.542Z
|
||||
tags: scripting, client, lua, coding, communication
|
||||
editor: markdown
|
||||
dateCreated: 2021-01-12T00:34:24.843Z
|
||||
---
|
||||
|
||||
# Client Side Scripting
|
||||
|
||||
BeamMP allows you to create your own client side plugins as well. We have provided a few functions that you can use to communicate with other multiplayer mods, and other players through the server.
|
||||
|
||||
|
||||
# Functions
|
||||
> List of available events for scripting:
|
||||
{.is-info}
|
||||
|
||||
|Function|Notes|
|
||||
|---|---|
|
||||
|`TriggerServerEvent("eventName", "data")`|Triggers an event in the server lua environment, both parameters are strings|
|
||||
|`TriggerClientEvent("eventName", "data")`|Triggers an event in the local lua environment, both parameters are strings. Good for communication between plugins|
|
||||
|`AddEventHandler("eventName", Function)`|Adds the 2nd parameter to the table to be called when eventName is received (either locally or from the server), Function will get 1 parameter, a string containing the event data|
|
||||
|
||||
|
||||
|
||||
> For example to parse the chat use the included `ChatMessageReceived` event as such:
|
||||
{.is-info}
|
||||
```lua
|
||||
local function chatReceived(msg) -- Receive event with parameters
|
||||
print("chat received: "..msg)
|
||||
local i = string.find(s, ":") -- Find where our first ':' is, used to separate the sender and message
|
||||
if i == nil then
|
||||
print("error parsing message: separator could not be found!")
|
||||
return -- Could not find separator, cancel function
|
||||
end
|
||||
print("index of separator: "..tostring(i))
|
||||
local sender = string.sub(msg, 1, i-1) -- Substring our input to separate its 2 parts
|
||||
local message = string.sub(msg, i+1, -1) -- Do whatever you want to with the message
|
||||
print("sender: " .. sender)
|
||||
print("message: ".. message)
|
||||
end
|
||||
|
||||
AddEventHandler("ChatMessageReceived", chatReceived) -- Add our event handler to the list managed by BeamMP
|
||||
```
|
||||
|
329
Scripting/functions.md
Normal file
@ -0,0 +1,329 @@
|
||||
---
|
||||
title: Functions & Events
|
||||
description: Functions & Events All the Functions & Events available for BeamMP scripting
|
||||
published: true
|
||||
date: 2022-12-22T09:23:02.343Z
|
||||
tags: scripting, lua, programming, plugins, plugin, resource, resources
|
||||
editor: markdown
|
||||
dateCreated: 2020-06-18T17:03:00.676Z
|
||||
---
|
||||
|
||||
> This is 2.x scripting. Only refer to this if your server is old/outdated (version 2.x.x). For the reference for 3.x scripting and beyond, see [this page on 3.x scripting](https://wiki.beammp.com/en/Scripting/new-lua-scripting).
|
||||
{.is-warning}
|
||||
|
||||
# Notes
|
||||
|
||||
To get the output of a function in the server console you have to wrap it in a `print()` statement.
|
||||
For example:
|
||||
`print(GetPlayerName(0))` will return the name of your server's first player.
|
||||
|
||||
`<PlayersServerID>` starts at 0.
|
||||
|
||||
# List of available functions for scripting
|
||||
|
||||
## GetPlayerName(playersServerID)
|
||||
Returns the player's discord name as a string
|
||||
```lua
|
||||
function onPlayerJoin(playerID)
|
||||
local name = GetPlayerName(playerID)
|
||||
-- Do something
|
||||
end
|
||||
```
|
||||
|
||||
## GetPlayerDiscordID(playersServerID)
|
||||
Returns the player's discord name as a string
|
||||
```lua
|
||||
function onPlayerJoin(playerID)
|
||||
local name = GetPlayerDiscordID(playerID)
|
||||
-- Do something
|
||||
end
|
||||
```
|
||||
|
||||
## GetPlayerHWID(playersServerID)
|
||||
Returns the player's discord ID as a string
|
||||
```lua
|
||||
function onPlayerJoin(playerID)
|
||||
local name = GetPlayerHWID(playerID)
|
||||
-- Do something
|
||||
end
|
||||
```
|
||||
|
||||
## GetPlayerVehicles(playersServerID)
|
||||
Returns the player's vehicles as an object/array
|
||||
```lua
|
||||
function onChatMessage(playerID, senderName, message)
|
||||
local vehicleList = GetPlayerVehicles(playerID)
|
||||
for vehicleID, vehicleData in pairs(vehicleList) do
|
||||
-- Do something
|
||||
-- Could also be used to check how many vehicles a player have
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
## DropPlayer(playersServerID)
|
||||
Drops the connection for a specific player. Essentially Kicking them
|
||||
```lua
|
||||
function onVehicleSpawn(playerID, vehicleID, vehicleData)
|
||||
-- Do something
|
||||
DropPlayer(playerID)
|
||||
end
|
||||
```
|
||||
|
||||
## SendChatMessage(playersServerID, message)
|
||||
Sends a message over the network to the specified user. Use -1 for everyone
|
||||
```lua
|
||||
function onPlayerJoin(playerID)
|
||||
SendChatMessage(-1, "Someone just joined!")
|
||||
end
|
||||
```
|
||||
|
||||
## CancelEvent() -- DEPRECIATED
|
||||
Cancels the event from happening. This might be going soon. Use `return 1` to cancel the event.
|
||||
|
||||
## onInit()
|
||||
If declared in a lua file, it will be called once C++ successfully finished loading the current lua file
|
||||
```lua
|
||||
function onInit()
|
||||
print("Server ready")
|
||||
end
|
||||
```
|
||||
|
||||
## exit()
|
||||
Will close the server
|
||||
```lua
|
||||
function onInit()
|
||||
print("Server Ready. But who needs a server which is running")
|
||||
exit() -- Stops the server
|
||||
end
|
||||
```
|
||||
|
||||
## CreateThread(functionName, callInterval)
|
||||
Will execute the function on a dedicated thread and it will run callInterval times a second.
|
||||
1 = It will run every second.
|
||||
|
||||
```lua
|
||||
function yourFunction()
|
||||
for i = 1,10 do
|
||||
SendChatMessage(-1, "Countdown: "..i)
|
||||
Sleep(1000)
|
||||
end
|
||||
end
|
||||
CreateThread("yourFunction", 30)
|
||||
```
|
||||
|
||||
DEPRECIATED EXAMPLE
|
||||
Will execute the function on a dedicated thread
|
||||
```lua
|
||||
function yourFunction()
|
||||
for i = 1,10 do
|
||||
SendChatMessage(-1, "Countdown: "..i)
|
||||
Sleep(1000)
|
||||
end
|
||||
end
|
||||
CreateThread("yourFunction", 30)
|
||||
```
|
||||
|
||||
## StopThread(functionName)
|
||||
Will stop trying to call the thread function of the current script
|
||||
```lua
|
||||
function yourFunction()
|
||||
delayExpired = false
|
||||
Sleep(10000)
|
||||
delayExpired = true
|
||||
end
|
||||
CreateThread("yourFunction", 30)
|
||||
-- Do something
|
||||
if not delayExpired then
|
||||
StopThread("yourFunction")
|
||||
else
|
||||
-- Do something
|
||||
end
|
||||
|
||||
```
|
||||
|
||||
## Sleep(millisecs) - DEPRECIATED
|
||||
Will pause execution for the amount of time specified (warning doing so will pause the entire server if you didn't create a thread)
|
||||
```lua
|
||||
function countdown()
|
||||
for i = 1,10 do
|
||||
SendChatMessage(-1, "Countdown: "..i)
|
||||
Sleep(1000)
|
||||
end
|
||||
end
|
||||
CreateThread("countdown", 10)
|
||||
```
|
||||
|
||||
## GetPlayerCount()
|
||||
Will return how many players are connected
|
||||
```lua
|
||||
function onPlayerJoin(playerID)
|
||||
SendChatMessage(playerID, "You are the "..GetPlayerCount().."th player!"
|
||||
end
|
||||
```
|
||||
|
||||
## RemoveVehicle(playerServerID, VehicleID)
|
||||
Will despawn a vehicle
|
||||
```lua
|
||||
function onVehicleSpawn(playerID, vehicleID, vehicleData)
|
||||
if --[[ Vehicle data equal something it shouldn't be ]] then
|
||||
RemoveVehicle(playerID, vehicleIID)
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
## GetPlayers()
|
||||
Will return a table of IDs with Names
|
||||
```lua
|
||||
local function onPlayerJoin(joinedPlayerID)
|
||||
local players = GetPlayers()
|
||||
for playerID, playerName in pairs(players) do
|
||||
if playerID == joinedPlayerID then
|
||||
-- Do something
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
## RegisterEvent(eventName, functionName)
|
||||
Will register that function to the event specified. Both must be strings
|
||||
```lua
|
||||
function anyEvent()
|
||||
-- Do something
|
||||
end
|
||||
RegisterEvent("onAnyEventHappen", "anyEvent")
|
||||
-- Do something
|
||||
TriggerLocalEvent("onAnyEventHappen")
|
||||
```
|
||||
|
||||
## TriggerLocalEvent(eventName)
|
||||
Will call every registered function in the same plugin folder.
|
||||
```lua
|
||||
function anyEvent()
|
||||
-- Do something
|
||||
end
|
||||
RegisterEvent("onAnyEventHappen", "anyEvent")
|
||||
-- Do something
|
||||
TriggerLocalEvent("onAnyEventHappen")
|
||||
```
|
||||
|
||||
## TriggerGlobalEvent(eventName)
|
||||
Will call every registered function with this event name.
|
||||
```lua
|
||||
-- File A
|
||||
function anyEvent()
|
||||
-- Do something
|
||||
end
|
||||
RegisterEvent("onAnyEventHappen", "anyEvent")
|
||||
```
|
||||
```lua
|
||||
-- File B
|
||||
TriggerGlobalEvent("onAnyEventHappen")
|
||||
```
|
||||
|
||||
## TriggerClientEvent(playerServerID, eventName, data)
|
||||
Will call that event with the given data on the specified client (-1 for broadcast)
|
||||
```lua
|
||||
function onPlayerJoin(playerServerID)
|
||||
TriggerClientEvent(playerServerID, "anyEvent", "You just joined the server")
|
||||
end
|
||||
RegisterEvent("onAnyEventHappen", "anyEvent")
|
||||
```
|
||||
|
||||
## Set(configID, newValue)
|
||||
will set a config setting to the new specified value table below|
|
||||
```lua
|
||||
function onChatMessage(playerID, senderName, message)
|
||||
if playerID == adminPlayer then
|
||||
if message == --[[ anything ]] then
|
||||
Set(3, 10)
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
### List of available config settings for the `Set()` command
|
||||
> Note that these will not save to the config file.
|
||||
|
||||
|Config ID|Name|Will only accept|
|
||||
|---|---|---|
|
||||
|`0`|Debug setting|true or false|
|
||||
|`1`|Private setting|true or false|
|
||||
|`2`|Max car per player|number|
|
||||
|`3`|Max players|number|
|
||||
|`4`|Map|string|
|
||||
|`5`|Name|string|
|
||||
|`6`|Description|string|
|
||||
|any other ID will result in a console warning|
|
||||
|
||||
# List of available events for scripting
|
||||
## Default Events
|
||||
Example of how to use an event:
|
||||
```lua
|
||||
function onInit()
|
||||
RegisterEvent("onPlayerJoin", "onPlayerJoin")
|
||||
end
|
||||
|
||||
function onPlayerJoin(playerServerID)
|
||||
-- Do something
|
||||
end
|
||||
```
|
||||
|
||||
If you dont want guests on your server:
|
||||
```lua
|
||||
function onInit()
|
||||
print("noGuests Ready")
|
||||
RegisterEvent("onPlayerAuth","onPlayerAuth")
|
||||
end
|
||||
|
||||
function onPlayerAuth(name, role, isGuest)
|
||||
if isGuest then
|
||||
return "You must be signed in to join this server!"
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
|Event|Parameters|Description|
|
||||
|---|---|---|
|
||||
|`onPlayerAuth`|The player's name, forum role, guest account (bool)|A player has authenticated and is requesting to join|
|
||||
|`onPlayerConnecting`|The player's ID|A player is loading in (Before loading the map)|
|
||||
|`onPlayerJoining`|The player's ID|A player is loading the map and will be joined soon|
|
||||
|`onPlayerJoin`|The player's ID|A player has joined and loaded in|
|
||||
|`onPlayerDisconnect`|The player's ID|A player has disconnected|
|
||||
|`onChatMessage`|The sender's ID, name, and the chat message|A chat message was sent. This would be good for making a commands system|
|
||||
|`onVehicleSpawn`|The player's ID, the vehicle ID, and the vehicle data|This is called when someone spawns a vehicle|
|
||||
|`onVehicleEdited`|The player's ID, the vehicle ID, and the vehicle data|This is called when someone edits a vehicle, or replaces their existing one|
|
||||
|`onVehicleDeleted`|The player's ID and the vehicle ID|This is called when someone deletes a vehicle they own|
|
||||
|
||||
## Custom Events
|
||||
Custom events can also be created for your own use. This is done very much the same to how the default ones are done.
|
||||
|
||||
Example of how to use a custom event:
|
||||
```lua
|
||||
function onInit()
|
||||
RegisterEvent("myCustomEvent", "myCustomEvent")
|
||||
end
|
||||
|
||||
function myCustomEvent(playerServerID, customData)
|
||||
-- Do something
|
||||
end
|
||||
```
|
||||
|
||||
This can then be called either from client side or serverside using the respective functions.
|
||||
|
||||
# Players
|
||||
|
||||
When a player connects to your server, they are assigned a serverID starting from 0 and counting upwards. serverIDs are reused; if a player leaves and re-joins they will not be assigned a new serverID, they will simply get another available one. When the server restarts, serverIDs will be reset.
|
||||
|
||||
## Static Identifiers
|
||||
|
||||
Players in BeamMP have 3 static identifiers which can be obtained from their serverID being their name, discordID, and their hardwareID or HWID. (though the latter of the aforementioned isn't implemented, we will act as if it is) Each of the three ID types has their own origins and strength's/weaknesses to using them for player identification.
|
||||
|
||||
| ID TYPE | PROS | CONS | FUNCTION TO OBTAIN |
|
||||
|-----------|---------------------------------|----------------|:--------------------:|
|
||||
| name | easy to obtain, straightforward | not secure | GetPlayerName() |
|
||||
| discordID | fairly secure | inconvenient | GetPlayerDiscordID() |
|
||||
| HWID | extremely secure | hard to obtain | GetPlayerHWID() |
|
||||
|
||||
# Vehicles
|
||||
|
||||
Vehicles in beamMP have 3 attributes that the server pays attention to, the owner's serverID, the vehicles vehicleID and it's data. The Owner's serverID is straight forward, it is the serverID, every vehicle also has an ID, vehicle IDs are not unique to the vehicle; two vehicles may have the same ID, assuming they're from different owners. Unlike serverIDs, vehicleIDs are reused, for example, if I have 4 vehicles, their IDs are 0, 1, 2 and, 3 if I delete the vehicle in vehicleID 2, I will have 0, 1 and, 3, when I spawn a new vehicle, the new vehicle will slot into ID 2. Lastly, the last attribute vehicles have is data, data contains a vehicle, name, parts, and other data; as the name implies. data is stored as a raw JSON string, so you will need a JSON library alternatively, you can manually step through the string and dig out the information you need.
|
978
Scripting/new-lua-scripting.md
Normal file
@ -0,0 +1,978 @@
|
||||
---
|
||||
title: Server-Side Lua Scripting
|
||||
description:
|
||||
published: true
|
||||
date: 2022-12-22T09:23:06.621Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-11-27T11:59:46.370Z
|
||||
---
|
||||
|
||||
**To BeamMP Staff: Do __NOT__ edit this wiki. It's still heavily WIP.**
|
||||
|
||||
# Introduction
|
||||
|
||||
BeamMP-Server release v3.0.0 does some drastic changes to the way the Lua plugin system works. There is no way to use the old lua with a new server, so you'll have to migrate.
|
||||
|
||||
The Server's Plugin system uses [Lua 5.3](https://www.lua.org/manual/5.3/). This section details how to get started writing plugins, teaches some basic concepts and gets you started with your first plugin. **It is recommended you read this section even if you know the pre-v3.0.0 system, as a few things changed drastically**.
|
||||
|
||||
For a migration guide from pre-v3.0.0 lua, go to the section ["Migrating from old Lua"](#migrating-from-old-lua).
|
||||
|
||||
|
||||
## Directory Structure
|
||||
|
||||
Server plugins, unlike mods, are situated (by default) in `Resources/Server`, while mods, which are written for BeamNG.drive and are sent to the clients are in `Resources/Client`. Each plugin must have it's own subfolder in `Resources/Server`, for example for a plugin called "MyPlugin", the structure would be:
|
||||
|
||||
```
|
||||
Resources
|
||||
└── Server
|
||||
├── MyPlugin
|
||||
│ └── main.lua
|
||||
└── SomeOtherPlugin
|
||||
└── ...
|
||||
```
|
||||
|
||||
Here we also display another plugin called "SomeOtherPlugin", to illustrate how your `Resources/Server` folder can have multiple different plugin folders. We will keep using this directory structure as an example throughout this guide.
|
||||
|
||||
You also notice the `main.lua`. You can have as many Lua `.lua` files as you like. All Lua files in your plugin's main directory are loaded in *alphabetical order* (so `aaa.lua` is run before `bbb.lua`).
|
||||
|
||||
|
||||
## Lua Files
|
||||
|
||||
Each Lua `.lua` file in the plugin's folder is loaded on server startup. This means that statements outside of functions are evaluated ("run") immediately.
|
||||
|
||||
Lua files in subfolders are ignored, but can be `require()`-ed.
|
||||
|
||||
For example, our `main.lua` looks like this:
|
||||
|
||||
```lua
|
||||
function PrintMyName()
|
||||
print("I'm 'My Plugin'!")
|
||||
end
|
||||
|
||||
print("What's up!")
|
||||
```
|
||||
|
||||
When the server starts and the `main.lua` is loaded, it will run `print("What's up!")` *immediately*, but will **NOT** *call* the `PrintMyName` function yet (because it wasn't called)!
|
||||
|
||||
## Events
|
||||
|
||||
An event is something like "a player is joining", "a player sent a chat message", "a player spawned a vehicle".
|
||||
|
||||
You can cancel events (if they are cancellable) by returning `1` from the handler.
|
||||
|
||||
In Lua, you usually want to react to some of these. For this, you can register a "Handler". This is a function which is called when an event happens, and gets passed some arguments.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
function MyChatMessageHandler(sender_id, sender_name, message)
|
||||
-- censoring only the exact message 'darn'
|
||||
if message == "darn" then
|
||||
-- cancel the event by returning 1
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
MP.RegisterEvent("onChatMessage", "MyChatMessageHandler")
|
||||
```
|
||||
|
||||
This will effectively make sure that any message that is exactly equal to "darn" will not be sent and won't show in chat (note that for a real profanity filter you'd want to see if the message *contains* "darn", not *is* "darn"). Cancelling an event causes it to not happen, for example a chat message not to be shown to anyone else, a vehicle not to be spawned, etc.
|
||||
|
||||
## Custom Events
|
||||
|
||||
You can register to any event you like, for example:
|
||||
|
||||
```lua
|
||||
MP.RegisterEvent("MyCoolCustomEvent", "MyHandler")
|
||||
```
|
||||
|
||||
You can then trigger those custom events:
|
||||
|
||||
```lua
|
||||
-- call all event handlers to this in ALL plugins
|
||||
MP.TriggerGlobalEvent("MyCoolCustomEvent")
|
||||
-- call all event handlers to this in THIS plugin
|
||||
MP.TriggerLocalEvent("MyCoolCustomEvent")
|
||||
```
|
||||
|
||||
You can do a lot more with events, but those possibilities will be covered in detail below in the API reference.
|
||||
|
||||
## Event Timers ("Threads")
|
||||
|
||||
Pre-v3.0.0 Lua had a concept of "threads" which run X times per second. This naming was slightly misleading, as they were synchronous.
|
||||
|
||||
v3.0.0 Lua instead has "Event Timers". These are timers which run inside the server, and once they run out, they trigger an event (globally). This is also synchronous. Please be aware that the second argument is an interval in milliseconds.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local seconds = 0
|
||||
|
||||
function CountSeconds()
|
||||
seconds = seconds + 1
|
||||
end
|
||||
|
||||
-- create a custom event called 'EverySecond'
|
||||
-- and register the handler function 'CountSeconds' to it
|
||||
MP.RegisterEvent("EverySecond", "CountSeconds")
|
||||
|
||||
-- create a timer for this event, which will fire every 1000ms (1s)
|
||||
MP.CreateEventTimer("EverySecond", 1000)
|
||||
```
|
||||
|
||||
This will cause "CountSeconds" to be called every second. You can also cancel event timers with `MP.CancelEventTimer` (see API reference).
|
||||
|
||||
From the server's console, you can run `status` to see how many event timers are currently running, as well as info about event handlers that are waiting. This command will show more information in the future.
|
||||
|
||||
## Debugging
|
||||
|
||||
Lua is difficult to debug. An industry-grade debugger like `gdb` sadly doesn't exist for embedded Lua.
|
||||
|
||||
Generally, you can of course simple `print()` the values you want to inspect at any time.
|
||||
|
||||
In v3.0.0, the server provides a way for you to inject an interpreter into a plugin and subsequently run Lua inside it in realtime. This is the closest we have to a debugger.
|
||||
|
||||
Assuming you have the plugin from above which we called `MyPlugin`, you can enter into its Lua state like so:
|
||||
|
||||
```
|
||||
> lua MyPlugin
|
||||
```
|
||||
|
||||
Capitalisation matters here, so be careful its entered correctly.
|
||||
The output is something like
|
||||
```
|
||||
lua @MyPlugin>
|
||||
```
|
||||
As you can see, we switched into the Lua state for `MyPlugin`. From now on until we enter `exit()` (as of v3.1.0 `:exit`), we will be in `MyPlugin` and can execute Lua there.
|
||||
|
||||
For example, if we have a global called `MyValue`, we can print that value like so:
|
||||
|
||||
```
|
||||
lua @MyPlugin> print(MyValue)
|
||||
```
|
||||
|
||||
You can call functions here and do anything you expect to be able to do.
|
||||
|
||||
Since v3.1.0: You can press TAB to autocomplete functions and variables.
|
||||
|
||||
WARNING: Sadly, if the Lua state is currently busy executing other code (like a `while` loop), this can fully hang the console until it finishes that work, so be very careful switching to states which may be waiting for something to happen.
|
||||
|
||||
Additionally, you can run `status` in the regular console (`> `), which will show you some statistics about Lua, among other things.
|
||||
|
||||
## Custom Commands
|
||||
|
||||
In order to implement custom commands for the server console, the event `onConsoleInput` can be used.
|
||||
This can be useful when you want to add a way for the server owner to signal something to your plugin, or to display internal state in a custom way.
|
||||
|
||||
Here's an example:
|
||||
|
||||
```lua
|
||||
function handleConsoleInput(cmd)
|
||||
local delim = cmd:find(' ')
|
||||
if delim then
|
||||
local message = cmd:sub(delim+1)
|
||||
if cmd:sub(1, delim-1) == "print" then
|
||||
return message
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MP.RegisterEvent("onConsoleInput", "handleConsoleInput")
|
||||
```
|
||||
|
||||
This will enable you to do the following in the server's console:
|
||||
|
||||
```
|
||||
> print hello, world
|
||||
hello, world
|
||||
```
|
||||
|
||||
We implemented our own `print`. As an exercise, try to build a function like `say`, which sends a chat message to all players, or even a specific player (with `MP.SendChatMessage`).
|
||||
|
||||
**Caution:** For your own plugins, it's generally recommended to "namespace" them. Our `print` example, in a plugin called `mystuff`, could be called `mystuff.print` or `ms.print` or similar.
|
||||
|
||||
# API Reference
|
||||
|
||||
Documentation format: `function_name(arg_name: arg_type, arg_name: arg_type) -> return_types`
|
||||
|
||||
# Builtin Functions
|
||||
|
||||
## `print(...)`, `printRaw(...)`
|
||||
|
||||
Prints the message to the server console, prefixed with `[DATE TIME] [LUA]`. If you don't want this prefix, you can use `printRaw(...)`.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local name = "John Doe"
|
||||
print("Hello, I'm", name, "and I'm", 32)
|
||||
```
|
||||
|
||||
It can take as many arguments of arbitrary types as you like. It will also happily dump tables!
|
||||
|
||||
This behaves like the lua interpreter's `print`, so it will put tabs between arguments.
|
||||
|
||||
## `exit()`
|
||||
|
||||
Shuts down the server gracefully. Causes the `onShutdown` event to be triggered.
|
||||
|
||||
# MP Functions
|
||||
|
||||
## `MP.CreateTimer() -> Timer`
|
||||
|
||||
Creates a timer object, which can be used to keep track of how long something took / how much time elapsed. It starts once created, and can be reset/restarted with `mytimer:Start()`.
|
||||
|
||||
You can get the current elapsed time in seconds with `mytimer:GetCurrent()`.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local mytimer = MP.CreateTimer()
|
||||
-- do stuff here that needs to be timed
|
||||
print(mytimer:GetCurrent()) -- print how much time elapsed
|
||||
```
|
||||
|
||||
Timers do not need to be stopped (and can't be stopped), they have no overhead.
|
||||
|
||||
## `MP.GetOSName() -> string`
|
||||
|
||||
Returns the name of the current OS, either `Windows`, `Linux` or `Other`.
|
||||
|
||||
## `MP.GetServerVersion() -> number,number,number`
|
||||
|
||||
Returns the current server version in major, minor, patch format. For example, the v3.0.0 version would return `3, 0, 0`.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local major, minor, patch = MP.GetServerVersion()
|
||||
print(major, minor, patch)
|
||||
```
|
||||
Output:
|
||||
```
|
||||
2 4 0
|
||||
```
|
||||
|
||||
## `MP.RegisterEvent(event_name: string, function_name: string)`
|
||||
|
||||
Remembers the function with name `Function Name` as an event handler to event with name `Event Name`.
|
||||
|
||||
You can register as many handlers to an event as you like.
|
||||
|
||||
For a list of events the server provides, see here (TODO link).
|
||||
|
||||
If the event with that name doesn't exist, it's created, and thus RegisterEvent cannot fail. This can be used to create custom events.
|
||||
|
||||
## `MP.CreateEventTimer(event_name: string, interval_ms: number, [strategy: number (since v3.0.2)])`
|
||||
|
||||
Starts a timer inside the server which triggers the event `event_name` every `interval_ms` milliseconds.
|
||||
|
||||
Event timers can be cancelled with `MP.CancelEventTimer`.
|
||||
|
||||
Intervals <25 ms are not encouraged, as multiple such intervals will likely not be served in time reliably. While multiple timers can be started on the same event, it's encouraged to create as few event timers as possible. For example, if you need one event that runs every half second, and one which runs every second, consider just making the half-second one and running the every-second-functiosecond trigger.
|
||||
|
||||
You may also use `MP.CreateTimer` to make a timer and measure time passed since the last event call, in order to minimize event timers, though this is not necessarily recommended as it increases the code complexity significantly.
|
||||
|
||||
**Since 3.0.2:**
|
||||
|
||||
An optional `CallStrategy` may be supplied as the third argument. This can be either:
|
||||
|
||||
- `MP.CallStrategy.BestEffort` (default): Will try to get your event to trigger at the specified interval, but will refuse to queue handlers if a handler takes too long.
|
||||
- `MP.CallStrategy.Precise`: Will enqueue event handlers at the exact interval specified. Can lead to the queue filling up if the handler takes longer than the interval. Only use if you NEED the exact interval.
|
||||
|
||||
## `MP.CancelEventTimer(event_name: string)`
|
||||
|
||||
Cancels all timers on the event with the name `event_name` On some occasions, the timer might go off one more time before being cancelled, due to the nature of asynchronous programming.
|
||||
|
||||
## `MP.TriggerLocalEvent(event_name: string, ...) -> table`
|
||||
|
||||
Plugin-local synchronous event trigger.
|
||||
|
||||
Triggers an event locally, which causes all handlers to that event *in the current lua state* (usually the current plugin, unless state was shared via PluginConfig.toml) to be called.
|
||||
|
||||
You can pass arguments to this function (`...`) which are copied and sent to all handlers as function arguments.
|
||||
|
||||
This call is synchronous and will return once all event handlers finished.
|
||||
|
||||
The returned value is a table of all results. If a handler returned a value, it will be in this table, unannotated and unnamed. This can be used to "collect" things, or register sub-handlers for events that can be cancelled. This is practically an array.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local Results = MP.TriggerLocalEvent("MyEvent")
|
||||
print(Results)
|
||||
```
|
||||
|
||||
## `MP.TriggerGlobalEvent(event_name: string, ...) -> table`
|
||||
|
||||
Global asynchronous event trigger.
|
||||
|
||||
Triggers an event globally, which causes all handlers to that event *in all plugins* (including *this* plugin) to be called.
|
||||
|
||||
You can pass arguments to this function (`...`) which are copied and sent to all handlers as function arguments.
|
||||
|
||||
This call is asynchronous and returns a future-like object. Local handlers (handlers in the same plugin as the caller) run synchronously and immediately.
|
||||
|
||||
The table returned has two functions:
|
||||
|
||||
- `IsDone() -> boolean` tells you whether all handlers have finished. You can wait until this is true by checking it and `MP.Sleep`-ing for a little bit in a loop.
|
||||
- `GetResults() -> table` returns an unannotated unnamed table with all return values of all handlers. This is practically an array.
|
||||
|
||||
Make sure to call these with `Obj:Function()` syntax (`:`, NOT `.`).
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local Future = MP.TriggerGlobalEvent("MyEvent")
|
||||
-- wait until handlers finished
|
||||
while not Future:IsDone() do
|
||||
MP.Sleep(100) -- sleep 100 ms
|
||||
end
|
||||
local Results = Future:GetResults()
|
||||
print(Results)
|
||||
```
|
||||
|
||||
Be aware that a handler registering to "MyEvent" here and never returning could lock up your plugin. You likely want to keep track of how long you have waited and stop waiting after a few seconds.
|
||||
|
||||
## `MP.Sleep(time_ms: number)`
|
||||
|
||||
Waits for an amount of time, specified in milliseconds.
|
||||
|
||||
This does not yield the execution of the lua state and nothing will execute in the state while asleep.
|
||||
|
||||
WARNING: Do NOT sleep for >500 ms if you have event handlers registered, unless you know *exactly* what you are doing. This is intended to be used to sleep for 1-100 ms, in order to wait for results or similar. A locked up (sleeping) lua state can slow the entire server down drastically if not careful.
|
||||
|
||||
## `MP.SendChatMessage(player_id: number, message: string)`
|
||||
|
||||
Sends a chat message that only the specified player can see (or everyone if the ID is `-1`).
|
||||
In the game, this will not appear as a directed message.
|
||||
|
||||
You can use this, for example, to tell a player *why* you cancelled their vehicle spawn, chat message, or similar, or to display some information about your server.
|
||||
|
||||
## `MP.TriggerClientEvent(player_id: number, event_name: string, data: string) -> boolean`
|
||||
*until v3.1.0*
|
||||
|
||||
## `MP.TriggerClientEvent(player_id: number, event_name: string, data: string) -> boolean,string`
|
||||
*since v3.1.0*
|
||||
|
||||
## `MP.TriggerClientEventJson(player_id: number, event_name: string, data: table) -> boolean,string`
|
||||
*since v3.1.0*
|
||||
|
||||
Will call the given event with the given data on the specified client (-1 for broadcast). This event can then be handled in a clientside lua mod, see the "Client Scripting" documentation for this.
|
||||
|
||||
Will return `true` if it was able to send the message (for `id = -1`, so broadcasts, its always `true`), and `false` if the player with that ID doesn't exist or is disconnected but still has an ID (this is a known issue).
|
||||
|
||||
If `false` is returned, it makes no sense to retry this event, and a response (if any was expected) shouldn't be expected.
|
||||
|
||||
Since v3.1.0, the second return value contains an error message if the function failed. Also since this version, the `*Json` version of the function takes a table as the data argument, and converts it to json. This is simply a shorthand for `MP.TriggerClientEvent(..., Util.JsonEncode(mytable))`.
|
||||
|
||||
## `MP.GetPlayerCount() -> number`
|
||||
|
||||
Returns the amount of players currently in the server.
|
||||
|
||||
## `MP.GetPositionRaw(pid: number, vid: number) -> table,string`
|
||||
|
||||
Returns the current position of the vehicle `vid` (vehicle id) of player `pid` (player id), and an error string if an error occurred.
|
||||
|
||||
The table is decoded from a position packet, so it has a variety of data (that's why this function is postfixed "Raw").
|
||||
|
||||
TODO: Document fields. For now, users need to print() the result.
|
||||
|
||||
## `MP.IsPlayerConnected(player_id: number) -> boolean`
|
||||
|
||||
// TODO Documentation incomplete
|
||||
|
||||
Whether the player is connected.
|
||||
|
||||
## `MP.GetPlayerName(player_id: number) -> string`
|
||||
|
||||
Gets the display-name of the player.
|
||||
|
||||
## `MP.RemoveVehicle(player_id: number, vehicle_id: number)`
|
||||
|
||||
Removes the specified vehicle for the specified player.
|
||||
|
||||
## `MP.GetPlayerVehicles(player_id: number) -> table`
|
||||
|
||||
Returns a table of all vehicles the player currently has. Each entry in the table is a mapping from vehicle ID to vehicle data (which is currently a raw json string).
|
||||
|
||||
## `MP.GetPlayers() -> table`
|
||||
|
||||
Returns a table of all connected players. This table maps IDs to Names, like so:
|
||||
```json
|
||||
{
|
||||
0: "LionKor",
|
||||
1: "JohnDoe"
|
||||
}
|
||||
```
|
||||
|
||||
## `MP.IsPlayerGuest(player_id: number) -> boolean`
|
||||
|
||||
Whether the player is a guest. A guest is someone who didn't log in, and instead chose to play as a guest. Their name is usually `guest` followed by a long number.
|
||||
|
||||
As guests aren't logged in, you might want to disallow them from joining, for example when running a serious racing server or similar.
|
||||
|
||||
## `MP.DropPlayer(player_id: number, [reason: string])`
|
||||
|
||||
Kicks the player with the specified ID. The reason parameter is optional.
|
||||
|
||||
## `MP.GetStateMemoryUsage() -> number`
|
||||
|
||||
Returns the memory usage of the current Lua state in bytes.
|
||||
|
||||
## `MP.GetLuaMemoryUsage() -> number`
|
||||
|
||||
Returns the memory usage of all lua states combined, in bytes.
|
||||
|
||||
## `MP.GetPlayerIdentifiers(player_id: number) -> table`
|
||||
|
||||
Returns a table with information about the player, such as beammp forum ID and IP address.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
ip: "1.2.3.4",
|
||||
beammp: "1234"
|
||||
}
|
||||
```
|
||||
|
||||
*Until v3.1.0 the `ip` field is incorrect and will not work as intended. Fixed in v3.1.0.*
|
||||
|
||||
## `MP.Set(setting: number, ...)`
|
||||
|
||||
Sets a ServerConfig setting temporarily. For this, the `MP.Settings` table is useful.
|
||||
|
||||
Example:
|
||||
|
||||
Turning on Debug mode
|
||||
```lua
|
||||
MP.Set(MP.Settings.Debug, true)
|
||||
```
|
||||
|
||||
### `MP.Settings`
|
||||
|
||||
You can see an up-to-date list of these by printing them, like so:
|
||||
```lua
|
||||
print(MP.Settings)
|
||||
```
|
||||
|
||||
# Util Functions
|
||||
|
||||
## `Util.Json*`
|
||||
|
||||
Since BeamMP-Server `v3.1.0`.
|
||||
|
||||
This is a builtin JSON library, which is usually much faster than any Lua JSON library. Behind the scenes, C++'s `nlohmann::json` library is used, which is JSON compliant, full-coverage unit tested and continuously being fuzzed.
|
||||
|
||||
### `Util.JsonEncode(table: table) -> string`
|
||||
|
||||
Encodes a Lua table into a JSON string, recursively (tables inside tables inside tables ... work as expected). All primitive types are respected, functions, userdata and similar are ignored.
|
||||
|
||||
The resulting JSON is minified and can be pretty-printed by using `Util.JsonPrettify` to prettify it.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local player = {
|
||||
name = "Lion",
|
||||
age = 69,
|
||||
skills = { "skill A", "skill B" }
|
||||
}
|
||||
local json = Util.JsonEncode(player)
|
||||
```
|
||||
|
||||
Results in:
|
||||
```json
|
||||
{"name":"Lion","age":69,"skills":["skill A","skill B"]}
|
||||
```
|
||||
|
||||
### `Util.JsonDecode(json: string) -> table`
|
||||
|
||||
Decodes JSON into a Lua table. Will return `nil` if this failed, and print an error.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local json = "{\"message\":\"OK\",\"code\":200}"
|
||||
local tbl = Util.JsonDecode(json)
|
||||
```
|
||||
|
||||
Results in:
|
||||
```lua
|
||||
{
|
||||
message = "OK",
|
||||
code = 200,
|
||||
}
|
||||
```
|
||||
|
||||
### `Util.JsonPrettify(json: string) -> string`
|
||||
|
||||
Add indentation and newlines to the json to make it more readable for humans.
|
||||
|
||||
Example:
|
||||
```
|
||||
local myjson = Util.JsonEncode({ name="Lion", age = 69, skills = { "skill A", "skill B" } })
|
||||
|
||||
print(Util.JsonPrettify(myjson))
|
||||
```
|
||||
|
||||
Results in:
|
||||
```json
|
||||
{
|
||||
"age": 69.0,
|
||||
"name": "Lion",
|
||||
"skills": [
|
||||
"skill A",
|
||||
"skill B"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `Util.JsonMinify(json: string) -> string`
|
||||
|
||||
Removes indentation, newlines and any other whitespace. Not necessary unless you called `Util.JsonPrettify`, as all output from `Util.Json*` is already minified.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local pretty = Util.JsonPrettify(Util.JsonEncode({ name="Lion", age = 69, skills = { "skill A", "skill B" } }))
|
||||
|
||||
print(Util.JsonMinify(pretty))
|
||||
```
|
||||
|
||||
Results in:
|
||||
```json
|
||||
{"age":69.0,"name":"Lion","skills":["skill A","skill B"]}
|
||||
```
|
||||
|
||||
### `Util.JsonFlatten(json: string) -> string`
|
||||
|
||||
Creates a JSON object whose key are flattened to JSON pointers, according to RFC 6901. You can restore the original with `Util.JsonUnflatten()`. For this to work, all values need to be primitives.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local json = Util.JsonEncode({ name="Lion", age = 69, skills = { "skill A", "skill B" } })
|
||||
print("normal: " ..json)
|
||||
print("flattened: " .. Util.JsonFlatten(json))
|
||||
print("flattened pretty: " .. Util.JsonPrettify(Util.JsonFlatten(json)))
|
||||
|
||||
```
|
||||
|
||||
Results in:
|
||||
```json
|
||||
normal: {"age":69.0,"name":"Lion","skills":["skill A","skill B"]}
|
||||
flattened: {"/age":69.0,"/name":"Lion","/skills/0":"skill A","/skills/1":"skill B"}
|
||||
flattened pretty: {
|
||||
"/age": 69.0,
|
||||
"/name": "Lion",
|
||||
"/skills/0": "skill A",
|
||||
"/skills/1": "skill B"
|
||||
}
|
||||
```
|
||||
|
||||
### `Util.JsonUnflatten(json: string) -> string`
|
||||
|
||||
Restores the arbitrary nesting of a JSON value that has been flattened before using the `Util.JsonFlatten()` function.
|
||||
|
||||
### `Util.JsonDiff(a: string, b: string) -> string`
|
||||
|
||||
Creates a JSON diff according to RFC 6902 (http://jsonpatch.com/). This diff can then be applied as a patch via `Util.JsonDiffApply()`. Returns the diff.
|
||||
|
||||
### `Util.JsonDiffApply(base: string, diff: string) -> string`
|
||||
|
||||
Applies the JSON `diff` to `base` as a JSON patch (RFC 6902, http://jsonpatch.com/). Returns the result.
|
||||
|
||||
## `Util.Random*`
|
||||
|
||||
Since BeamMP-Server `v3.1.0`.
|
||||
|
||||
### `Util.Random() -> float`
|
||||
|
||||
Returns a float between 0 and 1.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local rand = Util.Random()
|
||||
print("rand: " .. rand)
|
||||
```
|
||||
|
||||
Results in:
|
||||
```lua
|
||||
rand: 0.135477
|
||||
```
|
||||
|
||||
### `Util.RandomIntRange(min: int, max: int) -> int`
|
||||
|
||||
Returns an integer between min and max.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local randInt = Util.RandomIntRange(1, 100)
|
||||
print("randInt: " .. randInt)
|
||||
```
|
||||
|
||||
Results in:
|
||||
```lua
|
||||
randInt: 69
|
||||
```
|
||||
|
||||
### `Util.RandomRange(min: number, max: number) -> float`
|
||||
|
||||
Returns a float between min and max.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local randFloat = Util.RandomRange(1, 1000)
|
||||
print("randFloat: " .. randFloat)
|
||||
```
|
||||
|
||||
Results in:
|
||||
```lua
|
||||
randFloat: 420.6969
|
||||
```
|
||||
|
||||
# FS Functions
|
||||
|
||||
`FS` functions are **f**ile**s**ystem functions, which aim to be better than the default Lua capabilities.
|
||||
|
||||
Please always use `/` as a separator when specifying paths, as this is cross-platform (windows, linux, macos, ...).
|
||||
|
||||
## `FS.CreateDirectory(path: string) -> bool,string`
|
||||
|
||||
|
||||
Creates the specified directory, and any parent directories if they don't exist. Behavior is roughly equivalent to the common linux command `mkdir -p`.
|
||||
|
||||
Returns whether the operation had an error, and, if it *did*, an error message. This means that, if `true` is returned, an error occurred.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local error, error_message = FS.CreateDirectory("data/mystuff/somefolder")
|
||||
|
||||
if error then
|
||||
print("failed to create directory: " .. error_message)
|
||||
else
|
||||
-- do something with the directory
|
||||
end
|
||||
```
|
||||
|
||||
## `FS.Remove(path: string) -> bool,string`
|
||||
|
||||
Removes the specified file or folder.
|
||||
|
||||
Returns `true` if an error occured, with an error message in the second return value.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
local error, error_message = FS.Remove("myfile.txt")
|
||||
|
||||
if error then
|
||||
print("failed to delete myfile: " .. error_message)
|
||||
end
|
||||
```
|
||||
|
||||
## `FS.Rename(pathA: string, pathB: string) -> bool,string`
|
||||
|
||||
Renames (or moves) `pathA` to `pathB`.
|
||||
|
||||
Returns `true` if an error occured, with an error message in the second return value.
|
||||
|
||||
## `FS.Copy(pathA: string, pathB: string) -> bool,string`
|
||||
|
||||
Copies `pathA` to `pathB`.
|
||||
|
||||
Returns `true` if an error occured, with an error message in the second return value.
|
||||
|
||||
## `FS.GetFilename(path: string) -> string`
|
||||
|
||||
Returns the last part of a path, which is usually the filename.
|
||||
Here are some example inputs + outputs:
|
||||
|
||||
```lua
|
||||
input -> output
|
||||
|
||||
"my/path/a.txt" -> "a.txt"
|
||||
"somefile.txt" -> "somefile.txt"
|
||||
"/awesome/path" -> "path"
|
||||
```
|
||||
|
||||
## `FS.GetExtension(path: string) -> string`
|
||||
|
||||
|
||||
Returns the extension of the file, or an empty string if no extension exists.
|
||||
Here are some example inputs + outputs
|
||||
|
||||
```lua
|
||||
input -> output
|
||||
|
||||
"myfile.txt" -> ".txt"
|
||||
"somefile." -> "."
|
||||
"/awesome/path" -> ""
|
||||
"/awesome/path/file.zip.txt" -> ".txt"
|
||||
"myexe.exe" -> ".exe"
|
||||
```
|
||||
|
||||
|
||||
## `FS.GetParentFolder(path: string) -> string`
|
||||
|
||||
Returns the path to the parent directory, i.e. the folder a file or folder is contained in.
|
||||
Here are some example inputs + outputs:
|
||||
|
||||
```lua
|
||||
input -> output
|
||||
|
||||
"/var/tmp/example.txt" -> "/var/tmp"
|
||||
"/" -> "/"
|
||||
"mydir/a/b/c.txt" -> "mydir/a/b"
|
||||
```
|
||||
|
||||
|
||||
## `FS.Exists(path: string) -> bool`
|
||||
|
||||
Returns `true` if the path exists, `false` if it doesn't.
|
||||
|
||||
## `FS.IsDirectory(path: string) -> bool`
|
||||
|
||||
Returns `true` if the specified path is a directory, `false` if it's not. Note that `false` does NOT imply that the path is a file (see `FS.IsFile()`).
|
||||
|
||||
## `FS.IsFile(path: string) -> bool`
|
||||
|
||||
Returns `true` if the specified path is a regular file (not a symlink, hardlink, block device, etc.), `false` if it's not. Note taht `false` does NOT imply that the path is a directory (see `FS.IsDirectory()`).
|
||||
|
||||
## `FS.ListDirectories(path: string) -> table`
|
||||
|
||||
Returns a table of all the directories in the given path.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
print(FS.ListDirectories("Resources"))
|
||||
```
|
||||
Results in:
|
||||
```lua
|
||||
{
|
||||
1: "Client",
|
||||
2: "Server"
|
||||
}
|
||||
```
|
||||
|
||||
## `FS.ListFiles(path: string) -> table`
|
||||
|
||||
Returns a table of all the files in the given path.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
print(FS.ListFiles("Resources/Server/examplePlugin"))
|
||||
```
|
||||
Results in:
|
||||
```lua
|
||||
{
|
||||
1: "example.json",
|
||||
2: "example.lua"
|
||||
}
|
||||
```
|
||||
|
||||
## `FS.ConcatPaths(...) -> string`
|
||||
|
||||
Adds together (concatenates) all arguments with the system's preferred path separator.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
FS.ConcatPaths("a", "b", "/c/d/e/", "/f/", "g", "h.txt")
|
||||
```
|
||||
results in
|
||||
```
|
||||
a/b/c/d/e/f/g/h.txt
|
||||
```
|
||||
|
||||
Also resolves `..`, if that exists in the path at any point. This function is safer than concatenating strings in lua, and respects the platform's separators.
|
||||
|
||||
Please always use `/` as a separator when specifying paths, as this is cross-platform (windows, linux, macos, ...).
|
||||
|
||||
# Events
|
||||
|
||||
## Explanation
|
||||
|
||||
- Arguments: List of arguments given to handlers of this event
|
||||
- Cancellable: Whether the event can be cancelled. If it can be cancelled, a handler can do so by returning `1`, like `return 1`.
|
||||
|
||||
## Summary of events
|
||||
|
||||
A player join triggers the following events in the given order:
|
||||
|
||||
1. `onPlayerAuth`
|
||||
2. `onPlayerConnecting`
|
||||
3. `onPlayerJoining`
|
||||
4. `onPlayerJoin`
|
||||
|
||||
## System Events
|
||||
|
||||
### `onInit`
|
||||
|
||||
Arguments: NONE
|
||||
Cancellable: NO
|
||||
|
||||
Triggered right after all files in the plugin were initialized.
|
||||
|
||||
### `onShutdown`
|
||||
|
||||
Arguments: NONE
|
||||
Cancellable: NO
|
||||
|
||||
Triggered when the server shuts down. Currently happens after all players were kicked.
|
||||
|
||||
## Game-Related Events
|
||||
|
||||
### `onPlayerAuth`
|
||||
|
||||
Arguments: `player_name: string`, `player_role: string`, `is_guest: bool`
|
||||
Cancellable: YES
|
||||
|
||||
First event that gets triggered when a player wants to join.
|
||||
|
||||
### `onPlayerConnecting`
|
||||
|
||||
Arguments: `player_id: number`
|
||||
Cancellable: NO
|
||||
|
||||
Triggered when a player first starts connecting, after `onPlayerAuth`.
|
||||
|
||||
### `onPlayerJoining`
|
||||
|
||||
Arguments: `player_id: number`
|
||||
Cancellable: NO
|
||||
|
||||
Triggered when a player has finished loading all mods, after `onPlayerConnecting`.
|
||||
|
||||
### `onPlayerDisconnect`
|
||||
|
||||
Arguments: `player_id: number`
|
||||
Cancellable: NO
|
||||
|
||||
Triggered when a player disconnects.
|
||||
|
||||
### `onChatMessage`
|
||||
|
||||
Arguments: `player_id: number`, `player_name: string`, `message: string`
|
||||
Cancellable: YES
|
||||
|
||||
Triggered when a player sends a chat message. When cancelled, it will not show the chat message to anyone, not even the player who sent it.
|
||||
|
||||
### `onVehicleSpawn`
|
||||
|
||||
Arguments: `player_id: number`, `vehicle_id: number`, `data: string`
|
||||
Cancellable: YES
|
||||
|
||||
Triggered when a player spawns a new vehicle. The `data` argument contains the car's config as json. When cancelled, the car is not spawned.
|
||||
|
||||
### `onVehicleEdited`
|
||||
|
||||
Arguments: `player_id: number`, `vehicle_id: number`, `data: string`
|
||||
Cancellable: YES
|
||||
|
||||
Triggered when a player edits their vehicle and applies the edit. The `data` argument contains the car's change config as json. When cancelled, the edit is not applied.
|
||||
|
||||
### `onVehicleDeleted`
|
||||
Lua, among other things.
|
||||
|
||||
Custom Commands
|
||||
In order to implement custom commands for the server console, the event onConsoleInput can be used. This can be useful when you want to add a way for the server owner to signal something to your plugin, or to display internal state in a custom way.
|
||||
|
||||
Here’s an example:
|
||||
|
||||
function handleConsoleInput(cmd)
|
||||
local delim = cmd:find(' ')
|
||||
if delim then
|
||||
local message = cmd:sub(delim+1)
|
||||
if cmd:sub(1, delim-1) == "print" then
|
||||
return message
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Arguments: `player_id: number`, `vehicle_id: number`
|
||||
Cancellable: NO
|
||||
|
||||
Triggered when a player deletes their vehicle.
|
||||
|
||||
### `onVehicleReset`
|
||||
|
||||
Arguments: `player_id: number`, `vehicle_id: number`, `data: string`
|
||||
Cancellable: NO
|
||||
|
||||
Triggered when a player resets their vehicle. `data` is the car's data as json.
|
||||
|
||||
### `onFileChanged`
|
||||
|
||||
*since v3.1.0*
|
||||
|
||||
Arguments: `path: string`
|
||||
Cancellable: NO
|
||||
|
||||
Triggered if a file changes in the `Resources/Server` directory *or any subdirectory of it*.
|
||||
|
||||
Any file change in the `Resources/Server/<plugin>` directory (not in a subfolder of it) will trigger a Lua state reload, and an `onFileChanged` event.
|
||||
|
||||
Any file in subfolders of `Resources/Server/<plugin>`, such as `Resources/Server/<plugin>/lua/stuff.lua`, will not trigger a state reload and will only trigger an `onFileChanged` event. This way, you can reload it yourself in the correct way (or not reload it).
|
||||
|
||||
This applies to all files, not just `.lua` files.
|
||||
|
||||
The `path` is relative to the root of the server, for example `Resources/Server/myplugin/myfile.txt`. You can do further processing on this string with the `FS.*` family of functions, such as extracting the name or extension (`FS.GetExtension(...)`, `FS.GetFilename(...)`, ...).
|
||||
|
||||
Note: Files added after the server is started are *not* tracked as of v3.1.0.
|
||||
|
||||
# Migrating from old Lua
|
||||
|
||||
This is a short run-down of the basic steps to take to migrate from old to new lua.
|
||||
|
||||
## Understand how the new lua works
|
||||
|
||||
For this, please read through the section ["Introduction"](#how-to-start-writing-a-plugin) and all its subsections carefully.
|
||||
It's necessary to do the next steps properly.
|
||||
|
||||
## Search & Replace
|
||||
|
||||
First, you should search and replace all MP functions. The substitution should add an `MP.` infront of all MP functions, except `print()`.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
local players = GetPlayers()
|
||||
print(#players)
|
||||
```
|
||||
becomes
|
||||
|
||||
```lua
|
||||
local players = MP.GetPlayers()
|
||||
print(#players) -- note how print() doesn't change
|
||||
```
|
||||
|
||||
## Goodbye Threads, Hello Event Timers!
|
||||
|
||||
As discussed in the introduction, threads are event timers. For any calls to `CreateThread`, replace it with a call to `CreateEventTimer`. Carefully inspect the timing your old CreateThread had (the number was X per second), and think about what the event timer timeout value is for this (which is in milliseconds). Also keep in mind that instead of a function name, it takes an event name, so you will have to register an event as well.
|
||||
|
||||
Example:
|
||||
|
||||
```lua
|
||||
CreateThread("myFunction", 2) -- calls "myFunction" twice per second
|
||||
```
|
||||
becomes
|
||||
|
||||
```lua
|
||||
MP.RegisterEvent("myEvent", "myFunction") -- registering our event for the timer
|
||||
MP.CreateEventTimer("myEvent", 500) -- 500 milliseconds = 2 times per second
|
||||
```
|
||||
|
||||
If you have many event timers, it makes sense to see if you can combine them, e.g. by creating a "every minute" event and registering multiple functions to it which need to be called every minute, instead of having multiple event timers. Each event timer costs the server a little bit of time to trigger.
|
||||
|
||||
## No more implicit event calling
|
||||
|
||||
You need to register all your events. You cannot rely on function names. In the old lua, this was unclear, but in the new lua this is usually enforced. A good pattern is:
|
||||
|
||||
```lua
|
||||
MP.RegisterEvent("onChatMessage", "chatMessageHandler")
|
||||
-- or
|
||||
MP.RegisterEvent("onChatMessage", "handleChatMessage")
|
||||
```
|
||||
|
||||
This is a better pattern than calling the handler the same as the event, which is misleading and confusing.
|
||||
|
41
Scripting/server-scripting.html
Normal file
@ -0,0 +1,41 @@
|
||||
<!--
|
||||
title: Server Side Scripting
|
||||
description:
|
||||
published: true
|
||||
date: 2022-12-22T09:23:10.870Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-17T19:32:59.868Z
|
||||
-->
|
||||
|
||||
<p>GetPlayerName(<PlayersServerID>) -- Returns the players discord name as a string</p>
|
||||
<p>GetPlayerDiscordID(<PlayersServerID>) -- Returns the players discord id as a string</p>
|
||||
<p>GetPlayerHWID(<PlayersServerID>) -- Returns the players hardware id as a string. This is a generated string by us.</p>
|
||||
<p>GetPlayerVehicles(<PlayersServerID>) -- Returns the players vehicles as a object/array</p>
|
||||
<p>DropPlayer(<PlayersServerID>, <Reason>) -- Drops the connection for a specific player. Essentially Kicking them</p>
|
||||
<p>SendChatMessage(<Message>) -- Sends a message over the network as the server.</p>
|
||||
<p>CancelEvent() -- Cancels the event from happening</p>
|
||||
<p> </p>
|
||||
<p>"onPlayerJoin" -- Returns the players ID -- A player has joined and loaded in</p>
|
||||
<p>"onPlayerConnecting" -- Returns the players ID -- A player is loading in (Before loading the map)</p>
|
||||
<p>"onPlayerJoining" -- Returns the players ID -- A player is loading the map and will be joined soon</p>
|
||||
<p>"onChatMessage" -- Returns the players ID that sent it + the senders name + the chat message -- A chat message was sent. This would be good for making a commands system</p>
|
||||
<p>"onVehicleSpawn" -- Returns the players ID, the vehicle ID and the vehicle data -- This is called when someone spawns a vehicle.</p>
|
||||
<p> </p>
|
||||
<p>RegisterEvent(<EventName>,<functionName>) -- will register that function to the event specified both must be a string</p>
|
||||
<p>TriggerLocalEvent(<EventName>) -- will call every registered function in the same plugin folder</p>
|
||||
<p>TriggerGlobalEvent(<EventName>) -- will call every registered function in any plugin folder</p>
|
||||
<p>function onInit() -- if declared in a lua file it will be called once C++ successfully finished loading the current lua file</p>
|
||||
<p> </p>
|
||||
<p>CreateThread(<functionName>) -- will execute the function on a dedicated thread</p>
|
||||
<p>GetPlayerCount() -- will return how many players are connected</p>
|
||||
<p>Sleep(<millisecs>) -- will pause execution for the amount of time specified (warning doing so will pause the entire server if you didn't create a thread)</p>
|
||||
<p> </p>
|
||||
<p>GetPlayers() -- will return a table of IDs with Names</p>
|
||||
<p>example : </p>
|
||||
<p>if GetPlayers() ~= nil then</p>
|
||||
<p> for ID,Name in pairs(GetPlayers()) do</p>
|
||||
<p> print(ID)</p>
|
||||
<p> print(Name)</p>
|
||||
<p> end</p>
|
||||
<p>end</p>
|
BIN
_daily/wiki-01.tar.gz
Normal file
BIN
_daily/wiki-02.tar.gz
Normal file
BIN
_daily/wiki-03.tar.gz
Normal file
BIN
_daily/wiki-04.tar.gz
Normal file
BIN
_daily/wiki-05.tar.gz
Normal file
BIN
_daily/wiki-06.tar.gz
Normal file
BIN
_daily/wiki-07.tar.gz
Normal file
BIN
_daily/wiki-08.tar.gz
Normal file
BIN
_daily/wiki-09.tar.gz
Normal file
BIN
_daily/wiki-10.tar.gz
Normal file
BIN
_daily/wiki-11.tar.gz
Normal file
BIN
_daily/wiki-12.tar.gz
Normal file
BIN
_daily/wiki-13.tar.gz
Normal file
BIN
_daily/wiki-14.tar.gz
Normal file
BIN
_daily/wiki-15.tar.gz
Normal file
BIN
_daily/wiki-16.tar.gz
Normal file
BIN
_daily/wiki-17.tar.gz
Normal file
BIN
_daily/wiki-18.tar.gz
Normal file
BIN
_daily/wiki-19.tar.gz
Normal file
BIN
_daily/wiki-20.tar.gz
Normal file
BIN
_daily/wiki-21.tar.gz
Normal file
BIN
_daily/wiki-22.tar.gz
Normal file
BIN
_daily/wiki-23.tar.gz
Normal file
BIN
_daily/wiki-24.tar.gz
Normal file
BIN
_daily/wiki-25.tar.gz
Normal file
BIN
_daily/wiki-26.tar.gz
Normal file
BIN
_daily/wiki-27.tar.gz
Normal file
BIN
_daily/wiki-28.tar.gz
Normal file
BIN
_daily/wiki-29.tar.gz
Normal file
BIN
_daily/wiki-30.tar.gz
Normal file
BIN
_daily/wiki-31.tar.gz
Normal file
BIN
_manual/wiki-20210425-163828.tar.gz
Normal file
BIN
_manual/wiki-20221222-084256.tar.gz
Normal file
BIN
after-running-once.png
Normal file
After Width: | Height: | Size: 15 KiB |
91
error-codes.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
title: Error Codes & Meanings
|
||||
description: This page is for the error codes that exist within our application. We will likely have the meaning and a possible solution to your issue.
|
||||
published: true
|
||||
date: 2022-12-22T09:22:42.738Z
|
||||
tags: error, code
|
||||
editor: markdown
|
||||
dateCreated: 2020-07-18T12:17:43.280Z
|
||||
---
|
||||
|
||||
> For any other issues not on this list, you can refer to https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 if you know a bit about how networks / sockets work.
|
||||
{.is-warning}
|
||||
|
||||
# Launcher Error Codes
|
||||
Below is a list of all the Launcher Error Codes, what they mean & how to solve them in most cases.
|
||||
If the launcher starts but encounters random errors they should be reported
|
||||
|
||||
> Note: If the launcher closes immediately check the log you will find startup error codes
|
||||
{.is-info}
|
||||
|
||||
> If the launcher gets stuck updating that means it requires administrator privileges or you need to update manually, sometimes the antivirus may block downloads as well
|
||||
{.is-info}
|
||||
|
||||
|
||||
`Logger file init failed`
|
||||
- The launcher doesn't have the ability to create files, Launching as admin could fix the issue
|
||||
|
||||
`Sorry Backend System Outage! Don't worry it will back on soon!`
|
||||
- The Backend did not respond could be the firewall or ISP
|
||||
|
||||
`Primary Servers Offline! sorry for the inconvenience!`
|
||||
- The Launcher failed to check for an update firewall or ISP
|
||||
|
||||
`Launcher Update failed!`
|
||||
- The launcher failed to download the new version
|
||||
|
||||
|
||||
`Please close the game and try again`
|
||||
- This error will happen if the game is already running under the same profile / launcher was unable clear the multiplayer/mods folder
|
||||
|
||||
`Please launch the game at least once`
|
||||
- This will happen when the launcher tries to modify the game's profile directory and fails. Launching the game should fix it
|
||||
|
||||
`Failed to Launch the game! launcher closing soon`
|
||||
- Launcher failed to start the game launching the game once before retrying could fix it
|
||||
|
||||
`Game Closed! launcher closing soon`
|
||||
- This will happen after the launcher was able to start the game and shouldn't happen unless the game failed to start or closed
|
||||
|
||||
`Failed to find the game please launch it. Report this if the issue persists`
|
||||
- Code 3 means that the launcher was unable to find the game's info (game directory, profile directory, version ect...) in the registry entry. Potential fix is to just run the game at least once so the registry values get created
|
||||
- Code 4 means the same except the launcher was unable to read the registry values
|
||||
|
||||
|
||||
|
||||
# Other Error Codes (Server and Launcher)
|
||||
Below is a list of all the Server Error Codes, what they mean & how to solve them in most cases.
|
||||
|
||||
> Note: If the server closes immediately check the log you will find startup error codes
|
||||
{.is-info}
|
||||
|
||||
`Code 10060`
|
||||
- There is an issue with your ports. Please check you have port forwarded and opened it on incoming on your firewall
|
||||
|
||||
`Code 10022`
|
||||
- This is an issue with binding to the port. Check if the port is in use or use a different port
|
||||
|
||||
`Code 10048`
|
||||
- address already in use, another BeamMP server or program is already running on that port
|
||||
|
||||
`Code 10051`
|
||||
- bad port forwarding or other similar "unreachable" issue - verify that its all setup properly
|
||||
|
||||
`Code 10052`
|
||||
- network reset, happens if the network drops connection while a connection is being established. should never happen. just retry
|
||||
|
||||
`Code 10053`
|
||||
- connection aborted, timeout or other network error, just retry
|
||||
|
||||
`Code 10054`
|
||||
- on launcher: server closed
|
||||
- on server: client disconnected
|
||||
|
||||
`Code 10060 / 10061`
|
||||
- network timed out, on launcher, this usually means that the server wasnt port forwarded properly
|
||||
|
||||
`Code 10064`
|
||||
- unlikely error, but it means that the host died, so server shutdown or ports were closed, connection died some other way
|
||||
|
||||
`Code 10065`
|
||||
- host not reachable: no internet or bad port forwarding, or any other similar issue*
|
126
fr/error-codes.md
Normal file
@ -0,0 +1,126 @@
|
||||
---
|
||||
title: Codes d'erreur & signification
|
||||
description: Vous trouverez la liste des codes d'erreur du serveur du launcher et du jeu et leur signification Codes d'erreur & signification
|
||||
published: true
|
||||
date: 2022-12-22T09:23:17.645Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-04-22T12:05:34.390Z
|
||||
---
|
||||
|
||||
> Si votre code d'erreur n'apparait pas sur cette page, vous pouvez vous referer à ce document https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
|
||||
{.is-warning}
|
||||
|
||||
# Codes d'erreur du launcher
|
||||
|
||||
> Note: Si le launcher s'arrête immédiatement vous pouvez vérifier le fichier log
|
||||
{.is-info}
|
||||
|
||||
> Si le launcher bloque lors du téléchargement, vous pouvez essayer de le démarrer en mode administrateur. Parfois désactiver l'antivirus ou le pare-feu peut également aider
|
||||
{.is-info}
|
||||
|
||||
`Code 2`
|
||||
- Le processus qui a executé le launcher n'est plus valide, vous devriez essayer de démarrer le launcher sans utiliser de raccourci, directement dans le dossier d'installation
|
||||
|
||||
`Code 3`
|
||||
- Le processus qui a executé le launcher est valide mais n'est pas un executable (.exe)
|
||||
|
||||
`Code 4`
|
||||
- Le processus qui a executé le launcher est valide mais n'est pas l'explorateur ou une cmd
|
||||
|
||||
`Logger file init failed`
|
||||
- Le launcher n'a pas la permission de créer de fichiers dans son dossier, démarrez le launcher en mode administrateur
|
||||
|
||||
`Sorry Backend System Outage! Don't worry it will back on soon!`
|
||||
- La backend n'a pas répondue, cela peut parfois être dû au pare-feu ou à l'antivirus.
|
||||
|
||||
`Primary Servers Offline! sorry for the inconvenience!`
|
||||
- Le launcher n'a pas réussi à vérifier les mises à jour, cela peut parfois être dû au pare-feu ou à l'antivirus.
|
||||
|
||||
`Launcher Update failed!`
|
||||
- Le launcher n'a pas réussi à télécharger sa mise à jour
|
||||
|
||||
`Cannot Create BeamNG Directory! Retrying...`
|
||||
- Le launcher n'a pas réussi à créer le dossier BeamNG Drive, ce dernier se relancera en mode administrateur après 3 secondes
|
||||
|
||||
`Please close the game and try again`
|
||||
- Une instance du jeu est déjà en cours, cela est dû aux fichiers du jeu étant déjà utilisé par un autre processus. Vérifier que BeamNG.drive ou le launcher ne sont pas déjà ouvert
|
||||
|
||||
`Cannot Create Mods Directory! Retrying...`
|
||||
- Le launcher n'a pas réussi à créer le dossier Mods, ce dernier se relancera en mode administrateur après 3 secondes
|
||||
|
||||
`Cannot Create Settings Directory! Retrying...`
|
||||
- Le launcher n'a pas réussi à créer le dossier Settings, ce dernier se relancera en mode administrateur après 3 secondes
|
||||
|
||||
`Please launch the game at least once`
|
||||
- Cela arrive lorsque le launcher essaye de modifier des fichiers qui n'ont pas été crées par le jeu. Lancer le jeu une fois puis le fermer devrait résoudre le problème
|
||||
|
||||
`Failed to launch the game`
|
||||
- Cela arrive lorsque le launcher n'a pas réussi à modifier le dossier Profile, essayez de lancer en mode administrateur.
|
||||
|
||||
`Failed to Launch the game! launcher closing soon`
|
||||
- Le launcher n'a pas réussi à démarrer le jeu, démarrer le jeu une fois puis le fermer devrait résoudre ce problème
|
||||
|
||||
`Game Closed! launcher closing soon`
|
||||
- Cela arrive lorsque le jeu est fermé. Cela peut être dû à un bug du jeu ou si vous quitter simplement le jeu
|
||||
|
||||
`Mod did not load! launcher closing soon`
|
||||
- Le mod BeamMP n'est pas chargé ni trouvé au bout de 35 secondes. Cela arrive lorsque BeamNG.drive est corrompu ou si l'utilisateur tente de modifier le mod
|
||||
|
||||
`Failed to find the game please launch it. Report this if the issue persists`
|
||||
- Code 1 Le launcher n'a pas réussi à trouver le jeu dans Steam, un correctif potentiel serait de réinstaller le jeu ou de se mettre en mode EN LIGNE sur Steam
|
||||
- Code 2 Voir Code 1
|
||||
- Code 3 Le launcher n'a pas réussi à trouver les informations du jeu (dernier démarrage etc...)
|
||||
- Code 4 Le launcher n'a pas réussi à ouvrir le fichier qui contient les informations du jeu, démarrer en administrateur pourrait résoudre le problème
|
||||
- Code 5 Les fichiers du jeu n'ont pas été trouvés. Essayez de démarrer le jeu une fois puis de le fermer
|
||||
|
||||
`Sorry. We do not support cracked copies report this if you believe this is a mistake`
|
||||
- Code 1 Le système a été trouvé mais pas son dossier d'installation, essayez de démarrer Steam ou de réinstaller Steam
|
||||
- Code 2 l'identifiant du jeu n'a pas été trouvé dans le dossier Steam
|
||||
- Code 3 le dossier du jeu n'a pas été trouvé dans Steam
|
||||
- Code 4 Steam n'est pas installé ou n'a pas été trouvé
|
||||
- Code 5 Le jeu n'a pas été trouvé dans le dossier steamapps, il pourrait avoir été déplacé manuellement
|
||||
- Code 6 Le launcher n'a pas réussi à faire le lien entre l'identifiant Steam et l'identifiant Steam du jeu. Cela pourrait signifier que vous ne possédez pas le jeu
|
||||
|
||||
`Illegal steam modifications detected report this if you believe this is a mistake`
|
||||
- Code 1 Des fichiers anormaux ont été trouvés dans le dossier Steam
|
||||
|
||||
|
||||
# Autres codes d'erreur (Serveur et Launcher)
|
||||
|
||||
> Note: Si le launcher ou le serveur s'arrêtent immédiatement vous pouvez vérifier le fichier log
|
||||
{.is-info}
|
||||
|
||||
`Code 10060`
|
||||
- Il y un problème avec la redirection des ports. Vérifiez que vous avez redirigé vos ports correctement dans votre routeur
|
||||
|
||||
`Code 10022`
|
||||
- Un problème est survenu lors de la tentative de démarrer sur le port. Le plus souvent ce problème est causé par un autre serveur ou un autre launcher déjà démarrés. Cela peut également être dû à un programme utilisant le même port que celui du launcher ou du serveur
|
||||
|
||||
`Code 10048`
|
||||
- Le port est déjà en cours d'utilisation. Le plus souvent ce problème est causé par un autre serveur ou un autre launcher déjà démarrés. Cela peut également être dû à un programme utilisant le même port que celui du launcher ou du serveur
|
||||
|
||||
`Code 10051`
|
||||
- Il y un problème avec la redirection des ports. Vérifiez que vous avez redirigé vos ports correctement dans votre routeur
|
||||
|
||||
`Code 10052`
|
||||
- Une coupure réseau est survenue, essayez de redémarrer le launcher ou le serveur
|
||||
|
||||
`Code 10053`
|
||||
- Erreur réseau inconnue, essayez de redémarrer le launcher ou le serveur
|
||||
|
||||
`Code 10054`
|
||||
- Launcher: le serveur a été fermé
|
||||
- Serveur: Client deconnecté
|
||||
|
||||
`Code 10060`
|
||||
- Timeout du réseau, sur le launcher cela signifie souvent que les ports ont mal été redirigés
|
||||
|
||||
`Code 10061`
|
||||
- Voir 10060
|
||||
|
||||
`Code 10064`
|
||||
- Cette erreur est peu probable, elle peut être causée sur le launcher par (mais pas seulement) un crash du serveur ou si les ports ont été fermés lorsque la connection était déjà ouverte
|
||||
|
||||
`Code 10065`
|
||||
- Impossible de joindre l'hôte de destination, cela peut être dû a une coupure internet ou une mauvaise redirection des ports
|
13
fr/home.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!--
|
||||
title: Menu Principal
|
||||
description: Le wiki officiel de BeamMP.
|
||||
published: true
|
||||
date: 2022-12-22T09:23:21.059Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-18T23:20:27.767Z
|
||||
-->
|
||||
|
||||
<h1>Bonjour!</h1>
|
||||
<p>Bienvenue sur le <strong>Wiki officiel de BeamMP</strong>.<br><br>Ce wiki parcours en détails les différents aspects du mod. Du launcher à l'interface utilisateur, en passant par la création de serveurs,... Pour vous aider à avoir la meilleure expérience possible sur BeamMP!</p>
|
||||
<p><span class="text-huge"><i><strong>(Ce wiki est actuellement en train d'être traduit depuis le Wiki anglais.)</strong></i></span></p>
|
22
fr/home/early-access-setup.md
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
title: Avantages Early Access
|
||||
description: Comment profiter des avantages Early Access
|
||||
published: true
|
||||
date: 2022-12-22T09:24:00.505Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-04-22T12:19:23.897Z
|
||||
---
|
||||
|
||||
# Ajouter le prefix Early Access en jeu
|
||||
Tout d'abord, merci de supporter le projet !
|
||||
|
||||
Dans un premier temps, rendez-vous dans Edit Profile
|
||||

|
||||
|
||||
Vous devriez voir une paga similaire à celle-ci
|
||||

|
||||
|
||||
Ici vous pourrez voir tous les groupes auxquels vous appartenez et que vous pouvez montrer en jeu. Pour changer votre prefix, il vous suffit simplement de cliquer sur le groupe que vous souhaitez utiliser. Si vous voulez afficher plusieurs groupes sur le forum vous pouvez en selectionner plusieurs en restant appuyé sur la touche SHIFT.
|
||||
|
||||
Une fois cela fait, cliquez sur Save en bas à droite.
|
54
fr/home/faq.html
Normal file
@ -0,0 +1,54 @@
|
||||
<!--
|
||||
title: F.A.Q. et problèmes connus
|
||||
description: Liste de questions demandées régulièrement et problèmes connus
|
||||
published: true
|
||||
date: 2022-12-22T09:24:04.440Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2021-04-11T21:35:32.959Z
|
||||
-->
|
||||
|
||||
<h1>Client</h1>
|
||||
<p><strong>Comment installer BeamMP ?</strong></p>
|
||||
<ul>
|
||||
<li>Nous avons un guide complet pour installer BeamMP sur Windows, vous pouvez le trouver <a href="https://wiki.beammp.com/en/home/installation-guide">ici</a>.</li>
|
||||
</ul>
|
||||
<p><strong>BeamMP fonctionne-t'il sur une version crackée de BeamNG.drive ?</strong></p>
|
||||
<ul>
|
||||
<li>Non, BeamMP ne fonctionne pas sur les versions crackées ni sur les versions qui ne sont pas à jour du jeu. Si vous voulez jouer à BeamMP, vous pouvez acheter le jeu sur Steam.</li>
|
||||
</ul>
|
||||
<p><strong>BeamMP fonctionne-t'il sur Linux ?</strong></p>
|
||||
<ul>
|
||||
<li>Le client BeamMP ne fonctionne pas officiellement sur Linux, cependant il est possible de le faire fonctionner avec Wine.</li>
|
||||
<li>Le serveur peut être build sur Linux. Cependant les builds ne sont pas fournies, vous devrez le faire vous même. BeamMP est officiellement supporté sur Debian 9 et 10, un tutoriel peut être trouvé <a href="https://github.com/BeamMP/BeamMP-Server#how-to-build">ici</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Pourquoi le launcher est détecté comme un virus par Windows Defender ou mon antivirus ?</strong></p>
|
||||
<ul>
|
||||
<li>Afin d'empêcher Windows Defender de détecter le launcher comme un virus, l'achat d'une license est obligatoire, c'est dernière sont très coûteuses. Pour cette raison BeamMP pourrait être détecté comme un virus.</li>
|
||||
<li>Certains antivirus pourraient détecter BeamMP comme un virus car ce dernier intérargit avec le réseau. Cela est normal, si vous avez un doute le code source complet peut-être retrouvé sur notre <a href="https://github.com/BeamMP">Github</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Les performances sont mauvaises, que puis-je faire ?</strong></p>
|
||||
<ul>
|
||||
<li>Nous faisons notre meilleur afin de conserver les meilleures performances possible. Cependant il n'y a pas grand chose qui puisse être fait, si vos performances sont toujours mauvaises avec des graphismes réduits, nous vous invitons à jouer sur un serveur avec moins de joueurs. Le jeu est principalement affecté par le processeur, si votre processeur possède peu de coeurs (4 ou moins) nous vous invitons à eviter les serveurs avec trop de joueurs.</li>
|
||||
</ul>
|
||||
<h1><strong>Serveur</strong></h1>
|
||||
<p><strong>Comment créer mon propre serveur ?</strong></p>
|
||||
<ul>
|
||||
<li>Toutes les informations pour créer votre propre serveur peuvent être retrouvées <a href="https://wiki.beammp.com/en/home/Server_Mod">ici</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Le serveur fonctionne-t'il sur Linux ?</strong></p>
|
||||
<ul>
|
||||
<li>Le serveur peut être build sur Linux. Cependant les builds ne sont pas fournies, vous devrez le faire vous même. BeamMP est officiellement supporté sur Debian 9 et 10, un tutoriel peut être trouvé <a href="https://github.com/BeamMP/BeamMP-Server#how-to-build">ici</a>.</li>
|
||||
</ul>
|
||||
<h1>Autre</h1>
|
||||
<p><strong>Où puis-je avoir accès au code source ?</strong></p>
|
||||
<ul>
|
||||
<li>Le code source complet peut-être consulté sur notre <a href="https://github.com/BeamMP">Github</a>.</li>
|
||||
<li>Cependant notre code est soumis à des <a href="https://forum.beammp.com/topic/94/terms-of-use-v1-0">conditions d'utilisation</a></li>
|
||||
</ul>
|
||||
<p><strong>J'ai découvert un bug / une faille / un exploit, que dois-je faire ?</strong></p>
|
||||
<ul>
|
||||
<li>Si le problème est causé par le code et que vous avez un compte <a href="https://github.com/BeamMP">Github</a>, vous pouvez poster un ticket sur notre <a href="https://github.com/BeamMP">Github</a>.</li>
|
||||
<li>Si ce n'est pas quelque chose de sensible, vous pouvez créer un poste sur notre forum ou sur notre <a href="https://discord.gg/beammp">Discord</a>.</li>
|
||||
<li>Si l'information est sensible, vous pouvez envoyer un message privé à l'un des membres de notre staff sur <a href="https://discord.gg/beammp">Discord</a>.</li>
|
||||
</ul>
|
37
fr/home/installation-guide.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!--
|
||||
title: Installation
|
||||
description: Guide d'installation du mod BeamMP
|
||||
published: true
|
||||
date: 2022-12-22T09:24:08.413Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2021-04-11T21:49:54.787Z
|
||||
-->
|
||||
|
||||
<h1>Avant de commencer</h1>
|
||||
<ul>
|
||||
<li>BeamMP est compatible uniquement avec les versions officielles, Steam, de BeamNG.drive.</li>
|
||||
<li>Les mods fonctionnent uniquement sur les serveurs sur lesquels ces derniers sont installés. Tenter d'utiliser un mod qui n'est pas autorisé par un serveur pourra résulter en un banissement.</li>
|
||||
</ul>
|
||||
<h1>Installation sur Windows</h1>
|
||||
<ol>
|
||||
<li>Rendez vous sur notre <a href="https://beammp.com/">site officiel</a> et téléchargez le fichier BeamMP_Installer.zip le plus récent.</li>
|
||||
<li><i><strong>Téléchargez soit </strong></i><a href="https://www.win-rar.com/postdownload.html?&L=10"><i><strong>Winrar</strong></i></a><i><strong> soit </strong></i><a href="https://www.7-zip.org/"><i><strong>7zip</strong></i></a><i><strong>. Un de ces deux programmes sera nécessaire pour la suite.</strong></i></li>
|
||||
<li>Décompressez le fichier BeamMP_Installer.zip n'importe où. Pour ce faire, faites un clic droit sur le fichier .zip puis Extraire ici.</li>
|
||||
<li>Lancez BeamMP_Installer.exe et suivez les instructions.</li>
|
||||
<li>Une icone BeamMP devrait apparaître sur votre bureau à la fin de l'installation, double cliquez dessus.</li>
|
||||
<li>C'est fini ! Appuyez simplement sur Jouer puis Multiplayer</li>
|
||||
<li>Il vous sera demandé de vous connecter, vous pouvez soit vous connecter en tant que visiteur ou bien créer un compte sur notre forum <a href="https://forum.beammp.com/">ici </a>! Attention, certains serveurs n'acceptent pas les comptes visiteurs.</li>
|
||||
<li>Cliquez sur le serveur qui vous intéresse le plus et cliquez sur Connect !</li>
|
||||
</ol>
|
||||
<p><i><strong>Problèmes connus:</strong></i></p>
|
||||
<ul>
|
||||
<li>Les caractères spéciaux dans votre nom d'utilisateur pourraient ne pas apparaître aux yeux des autres joueurs. S'il vous plaît assurez vous que votre nom d'utilisateur ne contient pas les caractères <mark class="marker-yellow"><strong>[ ] ; / \</strong></mark> ou tout autre caractère spécial exotique.</li>
|
||||
<li>Si vous ne voyez pas le bouton Multiplayer, essayez d'appuyer sur CTRL puis L, en même temps. Ensuite appuyez sur F5.</li>
|
||||
</ul>
|
||||
<p>Pour toute autre aide vous êtes la bienvenue sur notre<a href="https://forum.beammp.com/"> forum</a> !</p>
|
||||
<p>Bon jeu !</p>
|
||||
<h1>Installation sur Linux</h1>
|
||||
<ul>
|
||||
<li>BeamMP devrait fonctionner avec Wine, cependant le processus d'installation varie selon les distributions, nous vous invitons à vous renseigner sur l'installation de Wine pour votre distribution.</li>
|
||||
</ul>
|
243
fr/home/server-installation.html
Normal file
@ -0,0 +1,243 @@
|
||||
<!--
|
||||
title: Créer un serveur
|
||||
description: Comment créer un serveur fonctionnel de A à Z
|
||||
published: true
|
||||
date: 2022-12-22T09:24:11.917Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2021-04-12T14:10:39.390Z
|
||||
-->
|
||||
|
||||
<h1>Avant de commencer</h1>
|
||||
<p><span class="text-big">Créer un serveur BeamMP est facile et gratuit</span></p>
|
||||
<p>Les serveurs sont une partie importante au fonctionnement de BeamMP. Sans ces derniers, les clients ne pourraient pas communiquer entre eux.<br>Un serveur BeamMP consiste en un fichier .exe, un fichier de configuration (ce dernier contient le port, le nombre de joueurs maximum etc...), un fichier log et un dossier ressources.</p>
|
||||
<figure class="image image-style-align-left"><img src="/server1.png" alt="Image of server folder (Contains 4 items total)">
|
||||
<figcaption>A look inside the server folder</figcaption>
|
||||
</figure>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<h1>Redirection des ports</h1>
|
||||
<p>Si vous voulez que des joueurs d'internet puissent rejoindre votre serveur, vous devrez opérer une redirection de ports. Ce processus peut faire peur aux premiers abords mais il est relativement simple si bien effectué. Nous vous invitons à suivre un tutoriel adapté à votre opérateur internet et à votre box. Voici <a href="https://assistance.orange.fr/livebox-modem/toutes-les-livebox-et-modems/installer-et-utiliser/piloter-et-parametrer-votre-materiel/le-parametrage-avance-reseau-nat-pat-ip/configurer-des-regles-nat-pat/livebox-4-configurer-pour-utiliser-un-jeu-ou-une-application-serveur_189538-735102">un exemple</a> avec l'opérateur Orange.</p>
|
||||
<p>Le port que vous redirigez devra être le <strong>même </strong>que celui indiqué dans le fichier Server.cfg du serveur. Le serveur utilise les protocoles TCP et UDP.</p>
|
||||
<p>Notez que pour l'instant le serveur supporte uniquement le protocole IPv4.</p>
|
||||
<h1>Obtenir une clé d'authentification</h1>
|
||||
<p>Dans un premier temps, rendez-vous sur le <a href="https://beammp.com/keymaster">Keymaster</a>, cliquez sur "Keys" dans le menu à gauche puis sur "here". Remplissez le champ Server Name et Server IP. Notez que ces deux champs sont uniquemement pour reconnaître vos serveurs, si vous ne souhaitez pas indiquer d'adresse IP mettez 0.0.0.0. Par défaut vous aurez un nombre limité de clés. Une clé peut être utilisée pour un seul serveur. Cette limitation a été posée afin d'éviter les abus potentiels sur la création de multiple serveurs.</p>
|
||||
<p>Une fois que vous avez crée votre clé, copiez celle-ci et rentrez la dans le champ <strong>AuthKey</strong> du fichier de configuration du serveur. Cette dernière devrait être gardée privée, elle sera indiquée par le champ "--------------" tout au long de ce tutoriel. </p>
|
||||
<p> </p>
|
||||
<h1>Installation</h1>
|
||||
<h2>Windows</h2>
|
||||
<h3>Avant de commencer</h3>
|
||||
<p>Vérifiez que vous avez bien redirigés les ports de votre routeur avant de commencer ! Cette étape est cruciale pour le bon fonctionnement du serveur.</p>
|
||||
<p>Pour commencer, téléchargez le fichier du serveur sur <a href="https://www.beammp.com/">beammp.com</a> puis décompressez le fichier .zip téléchargé dans un dossier. Double cliquez sur le fichier <span style="font-family:'Courier New', Courier, monospace;"><strong>BeamMP-Server</strong>.exe</span> pour l'ouvrir. Le serveur va générer les fichiers nécessaires à son bon fonctionnement, une fois que le fichier Server.cfg est apparu dans le dossier du serveur vous pouvez arrêter ce dernier.</p>
|
||||
<h3>Gérer le serveur</h3>
|
||||
<p>Une fois le serveur configuré (voir <i>Comment utiliser le fichier de configuration </i>plus bas) ouvez<span style="font-family:'Courier New', Courier, monospace;"> <strong>BeamMP-Server</strong>.exe</span> pour le démarrer.</p>
|
||||
<p>Pour arrêter le serveur vous pouvez simplement utilier la croix en haut à droite de la fenêtre.</p>
|
||||
<p> </p>
|
||||
<h2>Linux</h2>
|
||||
<h3>Build (recommandé)</h3>
|
||||
<p>Le serveur peut être build sur Linux. Cependant les builds ne sont pas fournies, vous devrez le faire vous même. BeamMP est officiellement supporté sur Debian 9 et 10, un tutoriel peut être trouvé <a href="https://github.com/BeamMP/BeamMP-Server#how-to-build">ici</a>.</p>
|
||||
<h3>En utilisant Wine (non recommandé, uniquement sur vous ne pouvez pas build le serveur)</h3>
|
||||
<p>Si vous voulez utiliser Wine, le processus est globalement le même, seulement vous devrez installer Wine avant.</p>
|
||||
<h4>Installation de Wine</h4>
|
||||
<p>Dans un premier, mettez à jour tous les paquets de votre distribution Linux à l'aide des commandes suivantes:</p>
|
||||
<blockquote>
|
||||
<p>$ sudo apt update</p>
|
||||
<p>$ sudo apt upgrade</p>
|
||||
</blockquote>
|
||||
<p>Le serveur fonctionne uniquement avec la version dev de Wine, pour l'installer servez vous de la commande suivante:</p>
|
||||
<blockquote>
|
||||
<p>$ sudo apt install wine</p>
|
||||
</blockquote>
|
||||
<p>Une fois ces étapes terminées vous pouvez installer le serveur.</p>
|
||||
<h4>Installation du serveur</h4>
|
||||
<p>Une fois que Wine est installé, téléchargez le fichier .zip du serveur puis décompressez le dans un dossier de votre choix.</p>
|
||||
<p>Enfin, pour lancer le serveur, utilisez:</p>
|
||||
<blockquote>
|
||||
<p>$ wine BeamMP-Server.exe</p>
|
||||
</blockquote>
|
||||
<p>Pour quitter le serveur utilisez CTRL + C</p>
|
||||
<p>Si vous avez une erreur de Wine ntlm_auth, vous devrez installer le paquet winbind.</p>
|
||||
<h1>Comment utiliser le fichier de configuration</h1>
|
||||
<p>Le fichier de configuration (Server.cfg) peut être ouvert avec n'importe quel editeur de texte tel que notepad ou notepad++.</p>
|
||||
<figure class="image"><img src="/capture.png"></figure>
|
||||
<ul>
|
||||
<li>Note: Le fichier de configuration utilise un format</li>
|
||||
<li><span style="font-family:'Courier New', Courier, monospace;">Clé = "valeur"</span></li>
|
||||
<li>N'utilisez pas de caractères spéciaux tel que <span style="font-family:'Courier New', Courier, monospace;"><i>#</i></span> ou<i> </i><span style="font-family:'Courier New', Courier, monospace;"><i><strong>"</strong></i></span><strong>.</strong></li>
|
||||
</ul>
|
||||
<p>Une fois dans le fichier de configuration, vous devrez modifier une multitude de lignes.</p>
|
||||
<p>La première est le nom du serveur (<strong>Name</strong>), c'est celui qui sera affiché dans la liste des serveurs en jeu.</p>
|
||||
<p>Ensuite, vous devrez générer une clé d'authentification (<strong>AuthKey</strong>), les étapes sont expliqué à <i>Obtenir une clé d'authentification</i> plus haut.</p>
|
||||
<p>Voici un tableau de tous les paramètres:</p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Description</th>
|
||||
<th>Valeur par défaut</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Debug</td>
|
||||
<td>Permet d'afficher les lignes de débogage dans la console</td>
|
||||
<td>false</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Private</td>
|
||||
<td>Empêche le serveur de s'afficher dans la liste des serveurs en jeu</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Port</td>
|
||||
<td>Le port du serveur, laissez pas défaut sauf si vous avez plusieurs serveur sur une même IP</td>
|
||||
<td>30814</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cars</td>
|
||||
<td>Combien de véhicules un seul joueur peut avoir au maximum</td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MaxPlayers</td>
|
||||
<td>La limite des joueurs sur le serveur</td>
|
||||
<td>10</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Map</td>
|
||||
<td>La map que le serveur utilisera</td>
|
||||
<td>/levels/gridmap/info.json</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Le nom du serveur dans la liste des serveurs en jeu</td>
|
||||
<td>BeamMP New Server</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Desc</td>
|
||||
<td>La description du serveur dans la liste des serveurs en jeu</td>
|
||||
<td>BeamMP Default Description</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>use</td>
|
||||
<td>Le dossier à utiliser pour les mods</td>
|
||||
<td>Resources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AuthKey</td>
|
||||
<td>La clé d'authentification du serveur (<strong>requis</strong>)</td>
|
||||
<td>aucune</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<p> </p>
|
||||
<h1>Comment ajouter des mods sur votre serveur</h1>
|
||||
<ul>
|
||||
<li>Les véhicules et les maps s'installent de la même façon. Cependant l'utilisation d'une map nécessite une étape suplémentaire. Pour installer un mod, glissez simplement le .zip de ce dernier dans le dossier <i><strong>Ressources\Client.</strong></i></li>
|
||||
<li>Si vous ne souhaitez pas utiliser une map moddé, il n'y a aucune étape supplémentaire, les mods devraient être téléchargés et installés automatiquement.</li>
|
||||
</ul>
|
||||
<p><strong>Utiliser une map custom:</strong></p>
|
||||
<ul>
|
||||
<li>Dans un premier temps, mettez le fichier .zip de votre map dans le dossier <strong>/Ressources/Client</strong></li>
|
||||
<li>Ensuite, ouvrez le fichier .zip de votre map, puis rendez vous dans le dossier <i><strong>levels</strong></i>. Vous devriez voir un dossier avec le nom de votre map.</li>
|
||||
<li>Copiez le <strong>nom </strong>de ce dossier puis dans le fichier Server.cfg à la ligne Map (/levels/gridmap/info.json) remplacez gridmap par le nom du dossier.</li>
|
||||
<li>Exemple: le dossier s'appelle <strong>ma_map_custom </strong>vous devrez mettre<strong> /levels/ma_map_custom/info.json </strong>à la ligne Map du fichier de configuration du serveur.</li>
|
||||
</ul>
|
||||
<p>C'est tout ! Votre map custom devrait fonctionner.</p>
|
||||
<p> </p>
|
||||
<h2>Liste des maps par défaut</h2>
|
||||
<p>Voici une liste de toutes les maps par défaut du jeu</p>
|
||||
<ul>
|
||||
<li>/levels/gridmap/info.json</li>
|
||||
<li>/levels/automation_test_track/info.json</li>
|
||||
<li>/levels/east_coast_usa/info.json</li>
|
||||
<li>/levels/hirochi_raceway/info.json</li>
|
||||
<li>/levels/italy/info.json</li>
|
||||
<li>/levels/jungle_rock_island/info.json</li>
|
||||
<li>/levels/industrial/info.json</li>
|
||||
<li>/levels/small_island/info.json</li>
|
||||
<li>/levels/smallgrid/info.json</li>
|
||||
<li>/levels/utah/info.json</li>
|
||||
<li>/levels/west_coast_usa/info.json</li>
|
||||
<li>/levels/driver_training/info.json</li>
|
||||
<li>/levels/derby/info.json</li>
|
||||
</ul>
|
||||
<h1>Mettre de la couleur dans le nom de votre serveur</h1>
|
||||
<p>Il vous suffit d'ajouter ces caractères dans le nom de votre serveur.</p>
|
||||
<p>Exemple: ^2Ce texte sera vert ^net celui ci vert et souligné. Pour finir, ^rce texte sera normal.</p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>^n - souligné</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^0 - noir</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^1 - bleu</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^2 - vert</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^3 - bleu clair</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^4 - rouge</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^5 - rose</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^6 - orange</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^7 - gris</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^8 - gris foncé</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^9 - violet clair</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^a - vert clair</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^b - cyan</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^c - orange foncé</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^d - rose clair</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^e - jaune</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^f - blanc</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^l - gras</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^r - par défaut</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^m - barré</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>^o - italique</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<p><br> </p>
|
12
fr/home/understanding-launcher.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!--
|
||||
title: Le launcher
|
||||
description: Comment comprendre le launcher BeamMP
|
||||
published: true
|
||||
date: 2022-12-22T09:24:14.985Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2021-04-11T22:02:47.492Z
|
||||
-->
|
||||
|
||||
<p>Le launcher est le point d'entrée principal de BeamMP, il permet de mettre à jour le mod. Le launcher se met à jour de lui même.<br> </p>
|
||||
<figure class="image"><img src="https://wiki.beammp.com/launcher_example_better.png"></figure>
|
BIN
groupup.png
Normal file
After Width: | Height: | Size: 43 KiB |
14
home.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!--
|
||||
title: Home
|
||||
description: Welcome to the BeamMP documentation site!
|
||||
published: true
|
||||
date: 2022-12-22T09:22:46.623Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-17T17:38:56.754Z
|
||||
-->
|
||||
|
||||
<h1>Hello!</h1>
|
||||
<p>Welcome to the <strong>official BeamMP wiki</strong>.<br><br>This wiki goes through everything you need to know about the mod, the launcher, servers and contains many useful bits to help you get the most out of BeamMP.</p>
|
||||
<p>To start playing BeamMP, begin by <a href="https://wiki.beammp.com/en/home/installation-guide">installing the mod</a>.</p>
|
||||
<p>If you have questions or see something that could be improved, feel free to contact our staff on the <a href="https://discord.com/invite/beammp">official discord</a> or open a thread on the <a href="https://forum.beammp.com/">forums</a>.<br> </p>
|
16
home/Server_Mod.md
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
title: Welcome Page
|
||||
description:
|
||||
published: true
|
||||
date: 2022-12-22T09:23:25.781Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-01-11T23:38:32.249Z
|
||||
---
|
||||
|
||||
# Welcome
|
||||
This is the BeamMP Wiki!
|
||||
|
||||
Navigate using the tabs on the left - whilst some pieces of the Wiki are still under construction, you will be able to find all of the information you need to get the mod up and running, as well as a server.
|
||||
|
||||
Any questions or issues? Please had over to our forum and make a post, our community will be able to help :)
|
42
home/early-access-setup.md
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
title: Early Access Setup
|
||||
description: How to setup Early Access
|
||||
published: true
|
||||
date: 2022-12-22T09:23:29.486Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-01-16T19:48:17.235Z
|
||||
---
|
||||
|
||||
# Adding the Early Access Group Title!
|
||||
Firstly thank you for supporting the mod!
|
||||
|
||||
Please note you must use the same email to make a account on the fourms as on patreon.
|
||||
|
||||
First click here so that we can edit your profile.
|
||||
|
||||

|
||||
|
||||
Next you will be presented with a page similar to this:
|
||||

|
||||
|
||||
From here you can see the groups that you are a part of and that you can proudly show off.
|
||||
To select one just click on the title button then click one from there.
|
||||
|
||||
Once done click save on the bottom.
|
||||
Thats it :)
|
||||
|
||||
# What Are the Perks of Early Access?
|
||||
You may be wondering whats included in Early Access, After you've linked your Discord and Forum account, you should be able to take full advantage of these perks.
|
||||
|
||||
The things included are as follows:
|
||||
|
||||
- Exclusive access to our EA Discord Channels.
|
||||
|
||||
- Access to BeamMP Pre Release Server and Client Builds.
|
||||
|
||||
- An Early Access in-game badge.
|
||||
|
||||
|
||||
|
||||
|
54
home/faq.html
Normal file
@ -0,0 +1,54 @@
|
||||
<!--
|
||||
title: F.A.Q. and Known Issues
|
||||
description: List of commonly asked questions and known bugs
|
||||
published: true
|
||||
date: 2022-12-22T09:23:33.261Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-07-02T21:06:26.786Z
|
||||
-->
|
||||
|
||||
<h1>Client</h1>
|
||||
<p><strong>How do I install BeamMP?</strong></p>
|
||||
<ul>
|
||||
<li>There is a full guide on how to install BeamMP on Windows, you can find it <a href="https://wiki.beammp.com/en/home/installation-guide">here</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Does BeamMP works on a cracked version of BeamNG.drive?</strong></p>
|
||||
<ul>
|
||||
<li>BeamMP does not work with cracked versions of BeamNG.drive nor that it does on outdated versions. If you want to use BeamMP please consider buying the game.</li>
|
||||
</ul>
|
||||
<p><strong>Does BeamMP work on Linux?</strong></p>
|
||||
<ul>
|
||||
<li>BeamMP client is not officially supported on Linux. However, you might be able to get it working by running the launcher in the same proton prefix as the game.</li>
|
||||
<li>BeamMP Server builds can be found in the BeamMP_Server.zip download on the <a href="https://beammp.com">BeamMP website</a>, or in the <a href="https://github.com/BeamMP/BeamMP-Server/releases">releases tab on the Github</a>. For building instructions see <a href="https://github.com/BeamMP/BeamMP-Server#how-to-build">here</a>.</li>
|
||||
</ul>
|
||||
<p><strong>Why is the launcher flagged by my antivirus or by Windows Defender?</strong></p>
|
||||
<ul>
|
||||
<li>In order to prevent Windows Defender from flagging a specific .exe, we need to buy a license which is very expensive, therefor, BeamMP might get flagged by Windows Defender.</li>
|
||||
<li>Some antivirus may flag BeamMP as a virus because it does some interactions with network and other stuff. There are <strong>no viruses</strong> in any of the code. The code for the launcher, server, and Lua client can be seen on our <a href="https://github.com/BeamMP">Github</a>.</li>
|
||||
</ul>
|
||||
<p><strong>I have poor performance, what should I do?</strong></p>
|
||||
<ul>
|
||||
<li>We are working hard to make performance as good as possible. Sadly, there isn't a lot you can do about it, if you have already lowered your graphic settings and your performance is still poor, consider playing on a server with less players. The game is mainly CPU bound when you play with lots of people, so older CPUs (even quadcores) will suffer with more than a handful of people.</li>
|
||||
</ul>
|
||||
<h1><strong>Server</strong></h1>
|
||||
<p><strong>How can I setup my own server?</strong></p>
|
||||
<ul>
|
||||
<li>All the information to setup your own server can be found on <a href="https://wiki.beammp.com/en/home/Server_Mod">this page</a> of our wiki.</li>
|
||||
</ul>
|
||||
<p><strong>Is the server working on Linux?</strong></p>
|
||||
<ul>
|
||||
<li>BeamMP server can be built on Linux, however builds are not provided, you should build it yourself. It is officially supported on Debian 9 and Debian 10 a tutorial can be found <a href="https://github.com/BeamMP/BeamMP-Server#how-to-build">here</a>.</li>
|
||||
</ul>
|
||||
<h1>Miscellaneous</h1>
|
||||
<p><strong>Where can I find the code?</strong></p>
|
||||
<ul>
|
||||
<li>All the source code can be found on our <a href="https://github.com/BeamMP">Github</a>.</li>
|
||||
<li>Before doing anything keep in mind that the code is under <a href="https://forum.beammp.com/topic/94/terms-of-use-v1-0">terms of use</a></li>
|
||||
</ul>
|
||||
<p><strong>I have found a bug, an exploit or anything so, what should I do?</strong></p>
|
||||
<ul>
|
||||
<li>If the issue is code related and you know how to use Github, you can post the issue on our <a href="https://github.com/BeamMP">Github</a>.</li>
|
||||
<li>If it is not something sensitive, you can create a post on our <a href="https://forum.beammp.com">forum</a> or you can report this on our <a href="https://discord.gg/beammp">Discord</a>.</li>
|
||||
<li>If the information is sensitive you can directly report the issue to a staff member on our <a href="https://discord.gg/beammp">Discord</a>.</li>
|
||||
</ul>
|
85
home/git-snippets.md
Normal file
@ -0,0 +1,85 @@
|
||||
---
|
||||
title: Git Snippets
|
||||
description: Git snippets for frequent git-related issues
|
||||
published: true
|
||||
date: 2022-12-22T09:23:37.803Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-10-04T10:32:51.318Z
|
||||
---
|
||||
|
||||
# Nomenclature
|
||||
|
||||
- `fork`: When forking, this is the resulting fork repository
|
||||
- `upstream`: When forking, this is the original repository that was forked from
|
||||
- `remote`: When you clone a repository, the repository you cloned from is called a `remote`. It's usually the `remote` called `origin`.
|
||||
|
||||
# Setup
|
||||
|
||||
Code in here will be git commands. If you don't have [git for windows](https://gitforwindows.org/) installed, you should do so.
|
||||
|
||||
To open a git terminal in a folder, you should be able to right-click and open a git bash. A terminal (black window) should open.
|
||||
|
||||
You should also have a merge tool installed, such as `kdiff3` or similar. It needs to support 3-way merges. To set a tool as mergetool, run
|
||||
```sh
|
||||
git config --global merge.tool <tool>
|
||||
```
|
||||
For example, for kdiff3:
|
||||
```sh
|
||||
git config --global merge.tool kdiff3
|
||||
```
|
||||
|
||||
# Common Issues
|
||||
|
||||
## Reset a fork to the state of upstream
|
||||
|
||||
Problem: You made a fork but it's not up-to-date with the upstream, and it has changes that you'd like to **get rid of**. Basically, you want to **reset** your fork's status to the one of the upstream repository.
|
||||
|
||||
Assuming
|
||||
- `https://github.com/example/example` is the upstream repo
|
||||
- `https://github.com/me/example` is your fork
|
||||
- `<branch>` is the branch you want to reset
|
||||
|
||||
We're also assuming that your fork's repo is already set up as `origin` (this is usually the case).
|
||||
|
||||
1. Add the upstream repository:
|
||||
```sh
|
||||
git remote add upstream https://github.com/example/example
|
||||
```
|
||||
|
||||
2. Pull from upstream and reset:
|
||||
```sh
|
||||
git pull -f upstream <branch>
|
||||
git reset --hard upstream/<branch>
|
||||
```
|
||||
**This will NUKE your local changes on that branch.**
|
||||
|
||||
3. Push to origin:
|
||||
```sh
|
||||
git push --force-with-lease origin <branch>
|
||||
```
|
||||
|
||||
## Push: Not possible to fast-forward
|
||||
|
||||
Problem: You made a change to `a.txt` on `main`, but the remote also changed `a.txt` on `master`, and you can't push your commit because it fails with `fatal: Not possible to fast-forward, aborting.`.
|
||||
|
||||
In our example, we add `cruel` but origin adds `beautiful` to our `a.txt`.
|
||||
|
||||
To fix:
|
||||
|
||||
1. `git rebase origin main` - Replace `main` with the branch you're working on. This will set our "base" (the starting point for our work) to the latest version of origin's main branch. That way our change to `a.txt` will appear to be *after* the change to `a.txt` from origin's main branch.
|
||||
2. You will likely see something like this:
|
||||
```sh
|
||||
Auto-merging a.txt
|
||||
CONFLICT (content): Merge conflict in a.txt
|
||||
error: could not apply 751b0ad... Added "cruel" to a.txt
|
||||
Resolve all conflicts manually, mark them as resolved with
|
||||
"git add/rm <conflicted_files>", then run "git rebase --continue".
|
||||
You can instead skip this commit: run "git rebase --skip".
|
||||
To abort and get back to the state before "git rebase", run "git rebase --abort".
|
||||
Could not apply 751b0ad... Added "cruel" to a.txt
|
||||
```
|
||||
3. As it says `Resolve all conflicts manually`, we need to resolve them by running `git mergetool`. This should open the merge tool of your choice. How to use your merge tool will not be expanded on here. Resolve all conflicts now. In our example we make it so that the file has both `cruel` and `beautiful`. Once all conflicts are resolved, close your merge tool.
|
||||
4. `git rebase --continue` - If your editor opens after this, just save and close it. If you get the error from 2., go to step 3. and repeat. Do this until you don't get it anymore. This will go through all commits and rebase them onto the newer branch, one-by-one.
|
||||
5. Eventually you should see `Successfully rebased and updated refs/heads/main`.
|
||||
6. You can now push your changes - but it won't let you `push` just like that (thanks, git). Instead, you want to **make sure you have successfully rebased and your history is "ahead" of the remote**. Then `git push --force-with-lease origin main`. **Never force-push to an official branch** (like BeamMP's `development` or BeamMP-Server's `master`), **ever**. Always use a feature-branch and PR it into the branch you want.
|
35
home/installation-guide.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!--
|
||||
title: Installation
|
||||
description: Installation guide for the BeamMP mod
|
||||
published: true
|
||||
date: 2022-12-22T09:23:41.349Z
|
||||
tags: install, tutorial
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-17T23:04:09.658Z
|
||||
-->
|
||||
|
||||
<h1>Before You Get Started</h1>
|
||||
<ul>
|
||||
<li>This mod is only compatible with legitimate, Steam versions of the game. “Cracked” game copies are not supported.</li>
|
||||
<li>Local mods are not supported, all mods must be server-side mods that are installed on the server. Trying to go around this might lead to suspension of your account.</li>
|
||||
</ul>
|
||||
<h1>Windows Installation</h1>
|
||||
<ol>
|
||||
<li>Go to our <a href="https://beammp.com/">official website</a> and download the latest <code>BeamMP_Installer.zip</code> by clicking the green <strong>Download Client</strong> button.</li>
|
||||
<li>Open the <code>BeamMP_Installer.zip</code> archive.</li>
|
||||
<li>Launch <code>BeamMP_Installer.exe</code> and follow the instructions.</li>
|
||||
<li>An icon should appear on your desktop, double click it to run it. You should see a little black window appear and shortly after BeamNG.drive should start.</li>
|
||||
<li>Once it started, press “Play” and then “Multiplayer”.</li>
|
||||
<li>You will be prompted with a login pop-up, you can either play as a guest (not all servers will allow guests), or create an account on our <a href="https://forum.beammp.com/">forums</a> and then login with those credentials.</li>
|
||||
<li>Select any server you like and join it. Enjoy!</li>
|
||||
</ol>
|
||||
<h2>Known Issues</h2>
|
||||
<ul>
|
||||
<li>If you don't see the multiplayer button, make sure the BeamMP mod is activated, then try pressing CTRL + L.</li>
|
||||
</ul>
|
||||
<p>If you need further help with installation, you are welcome to create a post on our <a href="https://forum.beammp.com/">forum</a> or ask in the <a href="https://discord.com/invite/beammp">official discord server</a>! </p>
|
||||
<p>Have fun!</p>
|
||||
<h1>Linux Installation</h1>
|
||||
<ul>
|
||||
<li>BeamMP should work with <code>wine</code>, but is not officially supported (yet).</li>
|
||||
</ul>
|
131
home/server-installation.html
Normal file
@ -0,0 +1,131 @@
|
||||
<!--
|
||||
title: Server
|
||||
description: Basics of setting up the server application
|
||||
published: true
|
||||
date: 2022-12-22T09:23:45.618Z
|
||||
tags: server, tutorial
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-17T21:05:01.162Z
|
||||
-->
|
||||
|
||||
<h1>Overview</h1>
|
||||
<p><span class="text-big">Making a server for BeamMP is very easy and free!</span></p>
|
||||
<p>Servers are an integral part of BeamMP; players are connected to each other through the server. They run natively on Windows and Linux.</p>
|
||||
<p>You can make private servers, which only people you invite can join, or public servers, which will show in our official server list.</p>
|
||||
<p>Getting a server up and running is a process with a few steps! It's quite easy, but if you run into any issues, feel free to ask on our <a href="https://forum.beammp.com">Forum</a> or on our <a href="https://discord.gg/beammp">Discord server</a> in the <code>#server-support</code> channel. Also refer to the <a href="https://wiki.beammp.com/en/home/server-maintenance">Server Maintenance</a> section for more info. </p>
|
||||
<p>Please make sure to read the <a href="https://raw.githubusercontent.com/BeamMP/BeamMP-Server/master/LICENSE">LICENSE</a> of the server before use.</p>
|
||||
<p>Note: <i>The server only supports IPv4. If you don't know which one you have, look at the IP address you see on </i><a href="https://www.whatsmyip.org/"><i>whatsmyip.org</i></a><i> - if it contains </i><code><i>:</i></code><i> colons, it's <strong>IPv6</strong>. In that case, you should investigate further whether you also have an IPv4. You can call your ISP to find this out, or ask someone who lives with you (if they're tech-savvy, they might know!). IPv6 support is planned.</i></p>
|
||||
<h1>Setting up the Server</h1>
|
||||
<p>Setup consists of a few steps, you should follow all of them.</p>
|
||||
<p> </p>
|
||||
<h2>1. Port forwarding</h2>
|
||||
<p><i>If you are on a VPS (Virtual Private Server) or Rootserver, you can usually skip this step. If you're unsure about what a VPS or Rootserver is, you aren't on one.</i></p>
|
||||
<p>This step is necessary if you want someone outside of your household to join ("outside of your local network").</p>
|
||||
<p>This step is the same for almost every game's server, such as Minecraft Servers, so you can find many tutorials online for this, even for your specific router model. A good full guide is <a href="https://www.noip.com/support/knowledgebase/general-port-forwarding-guide/">this tutorial</a>. Make sure you forward port <strong>30814</strong>, as <strong>TCP</strong> and <strong>UDP</strong>. </p>
|
||||
<p>While the default <strong>Port</strong> you want to “forward” is <strong>30814</strong>, you can choose any other number >1024, but you need to note down what you picked if it's not 30814. You need to forward both <strong>TCP</strong> and <strong>UDP</strong>. </p>
|
||||
<p>If you have issues, also feel free to ask on our <a href="https://forum.beammp.com">Forum</a> or on our <a href="https://discord.gg/beammp">Discord server</a> in the <code>#server-support</code> channel.</p>
|
||||
<h3>1.1 Firewall</h3>
|
||||
<p>Depending on your setup, you may need to let BeamMP-Server through your firewall. This is the case on Windows (turning the firewall off does <strong>not</strong> work usually), and on a lot of preinstalled Linux servers. </p>
|
||||
<p>There, just like with the port forwarding, you want to allow the BeamMP-Server through the firewall, <strong>both incoming and outgoing connections</strong>, and <strong>both TCP and UDP</strong>. If your firewall asks for a port instead, that will have to be the same port you used in step “1. Port Forwarding” (usually 30814).</p>
|
||||
<h2>2. Obtaining an Authentication Key</h2>
|
||||
<p>The “Authentication Key”, often called “AuthKey”, is necessary for making a <strong>public</strong> server, but <strong>should</strong> be done for private servers, too.</p>
|
||||
<p>You will need a <a href="https://discord.com">Discord</a> account for this step. This is necessary to prevent spam.</p>
|
||||
<h3>2.1. </h3>
|
||||
<p>To get your key, head to the <a href="https://beammp.com/keymaster">Keymaster</a>, click on "Keys” on the left (key symbol) and then click on the blue '<i>here</i>' text. </p>
|
||||
<figure class="image"><img src="/keymaster1.png"></figure>
|
||||
<h3>2.2.</h3>
|
||||
<p> Next, fill out the Server Name field (this is just the key name not the actual name of the server on the list). Example:</p>
|
||||
<figure class="image image_resized" style="width:44.84%;"><img src="/keymaster_key.png"></figure>
|
||||
<p>It should, in the end, look something like this:</p>
|
||||
<figure class="image"><img src="/keymaster3.png"></figure>
|
||||
<p>Ignore the IP field as it doesn't do anything.</p>
|
||||
<p><strong>DO NOT EVER SHARE THIS KEY OR SHOW IT TO ANYONE. TREAT THIS LIKE A PASSWORD.</strong></p>
|
||||
<p>You have a limited number of keys. One key can be used on one server at a time, so you cannot start two servers at the same time with the same key.</p>
|
||||
<h3>2.3.</h3>
|
||||
<p>Now copy the text in the “Key” field, in this example that is <code>3173a2e-6az0-4542-a3p0-ddqq5ff95558</code> and hold onto it for the next step.</p>
|
||||
<p> </p>
|
||||
<h2>3. Installation</h2>
|
||||
<p>The BeamMP-Server is available for Windows and Linux. The next two sections are dedicated to Windows and Linux each. </p>
|
||||
<p> </p>
|
||||
<h2>3.a. Installation on Windows</h2>
|
||||
<p>For the Linux installation, see the next step.</p>
|
||||
<p>Please ensure you have port-forwarded before attempting to host a server! Without you ports being forwarded, you cannot host a server to the public!</p>
|
||||
<ol>
|
||||
<li>Download the server zip from <a href="https://www.beammp.com/">beammp.com</a>. You should end up with a compressed <code>.zip</code> archive, called something like <code>BeamMP-Server.zip</code>.</li>
|
||||
<li>Extract the <code>BeamMP-Server.zip</code>. You will end up with a <code>BeamMP-Server.exe</code> file, among others which you can ignore for now. Make a folder somewhere and put the <code>BeamMP-Server.exe</code> there. This is where your server will live.</li>
|
||||
<li>Start the server once by double-clicking on it. This will generate all the necessary files for you, once you see text you can close it and proceed to the next step. You should see a <code>Server.log</code> file and a <code>ServerConfig.toml</code> file next to your <code>BeamMP-Server.exe</code>.</li>
|
||||
<li>(optional) For quick access in the future you can easily create a desktop shortcut to <code>BeamMP-Server.exe</code> using<strong> [Right click]</strong> > <strong>Send to</strong> > <strong>Desktop (create shortcut).</strong></li>
|
||||
</ol>
|
||||
<p>Now proceed to the next step.</p>
|
||||
<p> </p>
|
||||
<h2>3.b. Installation on Linux</h2>
|
||||
<p>Skip this if you did “Installation on Windows”.</p>
|
||||
<h3>Using our build (recommended)</h3>
|
||||
<p>This step will work on Debian, Ubuntu, and similar Debian-derivatives on x86_64. If you're on a different distribution or architecture, refer to the "Building from source” step below.</p>
|
||||
<ol>
|
||||
<li>Ensure you have the dependencies installed which are listed <a href="https://github.com/BeamMP/BeamMP-Server#prerequisites">here</a>.</li>
|
||||
<li>Download the server zip from <a href="https://www.beammp.com/">beammp.com</a>. You should end up with a compressed <code>.zip</code> archive, called something like <code>BeamMP-Server.zip</code>.</li>
|
||||
<li>Extract the <code>BeamMP-Server.zip</code>. You will end up with a <code>BeamMP-Server-linux</code> file, among others which you can ignore for now. Make a folder somewhere and put the <code>BeamMP-Server-linux</code> there. This is where your server will live.</li>
|
||||
<li>Open a terminal, go to that folder you put the <code>BeamMP-Server-linux</code> in, and run <code>chmod +x BeamMP-Server-linux</code>. This ensures that you have permissions to run it.</li>
|
||||
<li>Start the server once by running it with <code>./BeamMP-Server-linux</code>. This will generate all the necessary files for you, once you see text you can close it and proceed to the next step. You should see a <code>Server.log</code> file and a <code>ServerConfig.toml</code> file next to your <code>BeamMP-Server-linux</code>.</li>
|
||||
<li>(optional) It is heavily recommended to set up a user called <code>beammpserver</code> (or similar), as we do NOT recommend running the server as root, sudo or with your personal user account. You should then take steps to make sure that you start the server as this user only.</li>
|
||||
</ol>
|
||||
<p>Now proceed to the next step.</p>
|
||||
<p> </p>
|
||||
<h3>Building from source</h3>
|
||||
<p>BeamMP-Server for Linux can be officially built on both Debian, Ubuntu, other Debian-derivatives, and ArchLinux. Other distributions are likely to work, too, but aren't officially supported. If you want to build it yourself you can do it by downloading the source on our <a href="https://github.com/BeamMP/BeamMP-Server">GitHub</a>, a tutorial can be found <a href="https://github.com/BeamMP/BeamMP-Server#build-instructions">here</a>.</p>
|
||||
<p>At the end, make sure to run your server once with <code>./BeamMP-Server</code> and then proceed to the next step.</p>
|
||||
<p> </p>
|
||||
<h2>4. Configuration</h2>
|
||||
<p>Now that you ran the server once, it should have created some files and probably uttered an error or two. This is because we are not yet done. Your folder should have these files:</p>
|
||||
<figure class="image"><img src="/after-running-once.png"></figure>
|
||||
<p>They might be called “ServerConfig”, “Server” and “BeamMP-Server” (no extensions like “.exe”), but that's correct, too!</p>
|
||||
<p>Open the <code>ServerConfig.toml</code> with a text editor such as <code>Notepad</code>. You can do this with [Right Click] → “Open With…” and then selecting a text editor.</p>
|
||||
<p>You should see something like this:</p>
|
||||
<pre><code class="language-c">[General]
|
||||
AuthKey = ''
|
||||
Debug = false
|
||||
Description = 'BeamMP Default Description'
|
||||
Map = '/levels/gridmap_v2/info.json'
|
||||
MaxCars = 1
|
||||
MaxPlayers = 10
|
||||
Name = 'BeamMP Server'
|
||||
Port = 30814
|
||||
Private = false
|
||||
ResourceFolder = 'Resources'</code></pre>
|
||||
<p>This is your configuration file. It uses a format called TOML. Refer to the <a href="https://wiki.beammp.com/en/home/server-maintenance">Server Maintenance</a> section for more info on this file.</p>
|
||||
<p>For now, we only care about the <code>AuthKey</code> field. Between the quotes <code>''</code>, you want to paste in your AuthKey you copied in the first step.</p>
|
||||
<p>For our example key, it should then look like this:</p>
|
||||
<pre><code class="language-c">AuthKey = '3173a2e-6az0-4542-a3p0-ddqq5ff95558'</code></pre>
|
||||
<p>Give your server a name, too, in the <code>Name</code> field. You can format this with colors and more, please refer to <a href="https://wiki.beammp.com/en/home/server-maintenance#customize-the-look-of-your-server-name">this section on Name customization</a> in the server maintenance page.</p>
|
||||
<p>If you picked a different <strong>Port</strong> other than <strong>30814</strong>, make sure to replace it here under <code>Port</code>.</p>
|
||||
<p><strong>IMPORTANT:</strong> Your server will <strong>NOT</strong> show in the server list as long as <code>Private = True</code>. <i>If</i> you want it to show in the list, set that to <code><strong>Private = False</strong></code>.</p>
|
||||
<h2>5. Validation</h2>
|
||||
<p>Now run your server again, and see if it spits out any more <code>[ERROR]</code> messages. It should just stay open. At this point, you can start BeamMP through the BeamMP-Launcher and you should find your server by the Name you entered in the <code>ServerConfig.toml</code> in the server list.</p>
|
||||
<h1>How to add mods to your server</h1>
|
||||
<p>Vehicle mods and map mods are different to install, but both require you to put them in your server's (<code>Resources/Client</code>) folder. Simply slide any mod you want to add in that folder. </p>
|
||||
<p> </p>
|
||||
<h2>General Mods</h2>
|
||||
<p>If you only wanted to add modded vehicles, you simply put the zip file of the mod in the <code>Resources/Client</code> folder. They will automatically be downloaded by anyone who joins your server.</p>
|
||||
<p> </p>
|
||||
<h2>Maps</h2>
|
||||
<p>All default maps (maps which aren't mods) work out-of-the-box and do not have to be installed. You simply change the <code>Map</code> setting in the <code>ServerConfig.toml</code> file to any of <a href="https://wiki.beammp.com/en/home/server-maintenance#all-vanilla-maps-names">these</a>. For any other modded maps, do this:</p>
|
||||
<ol>
|
||||
<li>Put your map's <code>.zip</code> file in your server's (<code>Resources/Client</code>) folder.</li>
|
||||
<li>Next, have a look inside the map's zip file (don't extract it) and open the <code>levels</code> folder. In this folder there should be simply one other folder with the name of the map, for example “myawesomedriftmap2021”. Make sure to copy or remember this name <i>exactly as it is written in that folder's name.</i></li>
|
||||
<li>Open your <code>ServerConfig.toml</code>. In the <code>Map</code> setting, you should see <code>/levels/MAPNAME/info.json</code>, where <code>MAPNAME</code> is likely something like <code>gridmap_v2</code>. You want to now replace this <code>MAPNAME</code> with the name of the folder from the last step, in that example it was <code>myawesomedriftmap2021</code>. In the end it should look like this (for this example) and <i><strong>should</strong></i> have <code>/info.json</code> at the end.</li>
|
||||
</ol>
|
||||
<pre><code class="language-c">Map = '/levels/myawesomedriftmap2021/info.json'</code></pre>
|
||||
<p>Now, when someone joins your server, it should download the map automatically and work as expected. </p>
|
||||
<p><strong>If this does NOT work</strong>, install the map in your singleplayer BeamNG.drive, launch it and enter the map. Then, open the Console by pressing the <code>~</code> (<i>tilde</i>) key (if you're on a non-US keyboard, look at the <strong>Toggle System Console</strong> action in the <strong>Options > Controls > Bindings</strong> menu, under the <strong>General Debug</strong> section), and run <code>print(getMissionFilename())</code>. This should then show you the name to use. </p>
|
||||
<p>That's it! Your modded map should now be available to join!</p>
|
||||
<h1>How to join your server</h1>
|
||||
<p>How you and other people can join your server.</p>
|
||||
<h2>Joining your own server</h2>
|
||||
<p>You must join your server by direct connecting, to do this, click the <strong>Direct Connect Tab</strong> on the left from the server list. Leave the default info in there (should be 127.0.0.1 and a port of 30814) then hit connect.<strong> </strong>If you server is hosted outside of your house you must <a href="https://whatismyipaddress.com/">find your IP </a>on that machine and direct connect that way.</p>
|
||||
<h2>Other people joining your server (Public)</h2>
|
||||
<p>For anyone else to join your server, it first must be port forwarded (<a href="https://www.noip.com/support/knowledgebase/general-port-forwarding-guide/">A good guide here</a>). To join your public server they can simply go to the server list, type the name of the server, and click connect. If you are unsure of what your server name is, it will be the name you put in the <code>ServerConfig.toml</code></p>
|
||||
<h2>Other people joining your server (Private)</h2>
|
||||
<p>For anyone else to join your server, it first must be port forwarded (<a href="https://www.noip.com/support/knowledgebase/general-port-forwarding-guide/">A good guide here</a>). To join your private server they must go to the <strong>Direct Connect</strong> T<strong>ab</strong> in BeamMP, then type your IP and Port. If you are unsure of your IP <a href="https://whatismyipaddress.com/">here's a good website</a>. If you are unsure of your port the default is 30814, the port will be the same as the port you port forwarded.</p>
|
||||
<h2>Other people joining your server (Hamachi)</h2>
|
||||
<p>For someone to join your server, they must be on your Hamachi network, you do not need to be port forwarded for this. After joining your Hamachi network they will use the Hamachi IP and default port to direct connect to your server. For more info see our <a href="https://forum.beammp.com/t/tutorial-how-to-host-a-server-with-logmein-hamachi/52">Hamachi</a> guide.</p>
|
235
home/server-maintenance.html
Normal file
@ -0,0 +1,235 @@
|
||||
<!--
|
||||
title: Server Maintenance
|
||||
description: Guides, tips and tricks on how to configure and take care of a BeamMP Server.
|
||||
published: true
|
||||
date: 2022-12-22T09:23:49.906Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2021-06-20T08:48:03.720Z
|
||||
-->
|
||||
|
||||
<h1>How to Install</h1>
|
||||
<p>For installation instructions, please see <a href="https://wiki.beammp.com/en/home/server-installation">server installation</a>.</p>
|
||||
<h1>The ServerConfig File</h1>
|
||||
<p>The server config, which is a file called <code>ServerConfig.toml</code>, uses the <a href="https://toml.io/en/">TOML format</a>. (NOTE: The <i>old</i> server config file was called Server.cfg, but this is no longer used, and the server will warn when this is still present. Please also note that the two config formats are <strong>not</strong> compatible with each other.)</p>
|
||||
<p>The config has one section by default, called <code>[General]</code>, which holds the following values:<br> </p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Key</td>
|
||||
<td>Value Type</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AuthKey</td>
|
||||
<td>
|
||||
<p>AuthKey format ‘xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’</p>
|
||||
<p>where all x's are alphanumeric characters (numbers and letters). </p>
|
||||
</td>
|
||||
<td>Used to identify your server with the backend. You should have gotten one while following the installation instructions.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Debug</td>
|
||||
<td>true / false</td>
|
||||
<td>When enabled (true), will show more messages in the log and provide more information. Enable this if you run into issues. Enabling this will <i>drastically</i> increase the size of the log file.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Private</td>
|
||||
<td>true / false</td>
|
||||
<td>When enabled (true), your server will not be shown in the server list. Anyone with the correct IP and port can still connect.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>Any "text"</td>
|
||||
<td>Shown as the description of the server in the server list (if the server is public). You can use special characters to format this with colors and styles.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Any “text”</td>
|
||||
<td>Shown as the name / title of your server in the server list. You can use special characters to format this with colors and styles.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Map</td>
|
||||
<td>A valid map location, such as <code>'/levels/gridmap_v2/info.json'</code></td>
|
||||
<td>The map your server will host. Has to be installed either by default (a list can be found below) or as a server mod.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MaxCars</td>
|
||||
<td>Any number ≥ 1</td>
|
||||
<td>The maximum number of cars per player. Any additional cars a player tries to spawn will be deleted instantly.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Port</td>
|
||||
<td>1024–65535</td>
|
||||
<td>The networking port on which the server will be accessible. For a player to connect to your server directly, they will need your IP and this port.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<p>Other sections can and should be used by server plugins (Lua API coming soon), like so: <code>[MyMod]</code>.</p>
|
||||
<p>The AuthKey <strong><u>HAS</u></strong> to be set by you. It will be empty by default, and needs to be filled with your AuthKey from the installation step earlier. Do not share this Key with anyone and, in screenshots, blur it fully.</p>
|
||||
<h2>All Vanilla Maps Names</h2>
|
||||
<p>Here are all the stock maps </p>
|
||||
<ul>
|
||||
<li>/levels/gridmap_v2/info.json</li>
|
||||
<li>/levels/johnson_valley/info.json</li>
|
||||
<li>/levels/automation_test_track/info.json</li>
|
||||
<li>/levels/east_coast_usa/info.json</li>
|
||||
<li>/levels/hirochi_raceway/info.json</li>
|
||||
<li>/levels/italy/info.json</li>
|
||||
<li>/levels/jungle_rock_island/info.json</li>
|
||||
<li>/levels/industrial/info.json</li>
|
||||
<li>/levels/small_island/info.json</li>
|
||||
<li>/levels/smallgrid/info.json</li>
|
||||
<li>/levels/utah/info.json</li>
|
||||
<li>/levels/west_coast_usa/info.json</li>
|
||||
<li>/levels/driver_training/info.json</li>
|
||||
<li>/levels/derby/info.json</li>
|
||||
</ul>
|
||||
<h2>Customize the look of your server name</h2>
|
||||
<p>Use these special symbols before your text and it'll apply an effect to that text in the server list<br> </p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^r</span></td>
|
||||
<td>reset</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^p</span></td>
|
||||
<td>newline (descriptions only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^n</span></td>
|
||||
<td>underline</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^l</span></td>
|
||||
<td>bold</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^m</span></td>
|
||||
<td>strike-through</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^o</span></td>
|
||||
<td>italic</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^0</span></td>
|
||||
<td>black</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^1</span></td>
|
||||
<td>blue</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^2</span></td>
|
||||
<td>green</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^3</span></td>
|
||||
<td>light blue</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^4</span></td>
|
||||
<td>red</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^5</span></td>
|
||||
<td>pink</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^6</span></td>
|
||||
<td>orange</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^7</span></td>
|
||||
<td>grey</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^8</span></td>
|
||||
<td>dark grey</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^9</span></td>
|
||||
<td>light purple</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^a</span></td>
|
||||
<td>light green</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^b</span></td>
|
||||
<td>light blue</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^c</span></td>
|
||||
<td>dark orange</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^d</span></td>
|
||||
<td>light pink</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^e</span></td>
|
||||
<td>yellow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="font-family:'Courier New', Courier, monospace;">^f</span></td>
|
||||
<td>white</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<h1>The Server.log file</h1>
|
||||
<p>This file will be generated when the server runs. It's a mirror of the messages you see in the console when you run the server. You should attach this file every time you need support from our support staff, and it will never show your AuthKey, so you can usually send it without modifications.</p>
|
||||
<p>The format is as follows ($ prefix means “variable”, explained below):<br> </p>
|
||||
<pre><code class="language-plaintext">[$DATE $TIME] $CONTEXT [$LOG_LEVEL] $MESSAGE</code></pre>
|
||||
<p>Where:</p>
|
||||
<ul>
|
||||
<li><code>$DATE</code> is the date of the message, for example 21/07/2021</li>
|
||||
<li><code>$TIME</code> is the time of the message, for example 11:05:23</li>
|
||||
<li><code>$CONTEXT</code> (only visible if in Debug mode and mostly relevant to developers) is the context of the message, which is either:<ul>
|
||||
<li><code>(Player ID) “Player Name”</code>, where the Player's ID is useful for moderation</li>
|
||||
<li>A short name such as “HeartbeatThread”</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><code>$LOG_LEVEL</code> is one of the levels of importance of a message:<ul>
|
||||
<li><code>DEBUG</code>: Only visible in Debug mode, usually spammy and only important to developers</li>
|
||||
<li><code>INFO</code>: General information</li>
|
||||
<li><code>LUA</code>: Message from a Lua plugin</li>
|
||||
<li><code>WARN</code>: Describes something that isn't supposed to happen, usually</li>
|
||||
<li><code>ERROR</code>: Something went very wrong, or was very unexpected</li>
|
||||
<li><code>FATAL</code>: Something happened that causes the server to shut down</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><code>$MESSAGE</code> the message itself, usually something that you should pay attention to and understand. In some cases this might be cryptic, but the general rule is that, as long as nothing is visibly wrong with the server and there are no <code>ERROR</code>s, all is good.</li>
|
||||
</ul>
|
||||
<h1>Updating The Server</h1>
|
||||
<h2>Why to Update</h2>
|
||||
<p>Whenever a new update is released, you're advised to update your server. Usually this involves bug fixes, stability improvements and security improvements, next to the general new features etc. that are introduced.</p>
|
||||
<p>To receive news about updates when they come out, either follow the discord server's “update” channel, look out for it on the forums, or look at / ask the <a href="https://github.com/BeamMP/BeamMP-Server/releases">GitHub releases page</a>.</p>
|
||||
<h2>How to Update</h2>
|
||||
<p>The server is updated by replacing the old executable with the new one. If you are unsure how to do this, there are step-by-step instructions for Windows and Linux below.</p>
|
||||
<p>If you built from source, you just rebuild. Make sure to run <code>git submodule update --init --recursive</code> before you rebuild.</p>
|
||||
<h3>On Windows</h3>
|
||||
<ol>
|
||||
<li>Go to <a href="https://beammp.com/">BeamMP.com</a> and click the “Download Server” button.</li>
|
||||
<li>Once downloaded, extract the zip file. You should see a few files, one of them the <code>BeamMP-Server.exe</code>. We will call this one the “new executable”.</li>
|
||||
<li>Go to the folder where your current <code>BeamMP-Server.exe</code> executable is located (same folder where your <code>ServerConfig.toml</code> is, usually). We will call this one the “old executable”.</li>
|
||||
<li>Replace the old executable with the new executable (for example by copying or moving the new executable into the folder).</li>
|
||||
</ol>
|
||||
<h3>On Linux</h3>
|
||||
<ol>
|
||||
<li>Go to <a href="https://beammp.com/">BeamMP.com</a> and click the “Download Server” button.</li>
|
||||
<li>Once downloaded, extract the zip file. You should see a few files, one of them the <code>BeamMP-Server-linux</code>. We will call this one the “new executable”.</li>
|
||||
<li>Go to the folder where your current <code>BeamMP-Server-linux</code> executable is located (same folder where your <code>ServerConfig.toml</code> is, usually). We will call this one the “old executable”.</li>
|
||||
<li>Replace the old executable with the new executable (for example by copying or moving the new executable into the folder).</li>
|
||||
<li>Open a terminal in that folder where you just replaced the executable, and run <code>sudo chmod +x BeamMP-Server-linux</code>. This will make sure the server can be run.</li>
|
||||
</ol>
|
||||
<h2>Automated Updates</h2>
|
||||
<p>The server does not support automatic updates or update notifications (yet).</p>
|
||||
<p>You can, however, ask the GitHub API for the lastest release by checking the server's version against the tags. You can get that by GET'ing from <code>https://api.github.com/repos/BeamMP/BeamMP-Server/git/refs/tags</code>.</p>
|
||||
<h1> </h1>
|
16
home/understanding-launcher.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!--
|
||||
title: Launcher Basics
|
||||
description: This will guide you through the different elements of the BeamMP Launcher
|
||||
published: true
|
||||
date: 2022-12-22T09:23:53.339Z
|
||||
tags: launcher
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-17T20:56:47.594Z
|
||||
-->
|
||||
|
||||
<p>The launcher is the <strong>main access point to the MP mod</strong>. It updates automatically, and updates the mod automatically too.<br> </p>
|
||||
<p>Since BeamMP Lua V4.0 Discord is not required anymore in order to use the mod.</p>
|
||||
<p> </p>
|
||||
<figure class="image image_resized" style="width:84.59%;"><img src="/launcher_example_better.png">
|
||||
<figcaption>The Launcher</figcaption>
|
||||
</figure>
|
16
home/understanding-project.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!--
|
||||
title: General Information about the Mod
|
||||
description: The past, present and future of BeamMP.
|
||||
published: true
|
||||
date: 2022-12-22T09:23:57.075Z
|
||||
tags: project
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-17T21:16:54.859Z
|
||||
-->
|
||||
|
||||
<h2>v1.0</h2>
|
||||
<p>BeamMP started late 2019, with the first version being based on JavaScript, and still using the old Bridge (which at the time didn't have a server selection menu). - The bridge was used to suppliment the ingame UI mod, it was the cause of a few problems, and ultimately bulked the ease of installation.<br> </p>
|
||||
<h2>v1.5</h2>
|
||||
<p>It later evolved into a more complex version, featuring a revamped UI (added palyer list, ping, and chat), and the Bridge got a server selection menu. It was still very primitive and hard to use, the syncing was bad as players only teleported. It was still cumbersome to get up and running, requiring a mod to be installed into the mods folder, and for the bridge application to be run simultaneously to the game being launched... sounds complicated? it wasn't ideal.<br> </p>
|
||||
<h2>v2.0</h2>
|
||||
<p>Now the MP mod has been completely rebuilt in C++, introducing a brand new UI fully integrated into the in-game UI, including an in-game server browser. Everything has been packed into a single and easy to use .exe, resulting in a one-click-run mod, making for a super easy to use multiplayer experince. It's just like openining the vanilla game, but now you can play with your friends!</p>
|
BIN
keymaster1.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
keymaster2.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
keymaster3.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
keymaster_key.png
Normal file
After Width: | Height: | Size: 9.1 KiB |
BIN
launcher_example_better.png
Normal file
After Width: | Height: | Size: 86 KiB |
BIN
logo-white.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
main_menu_mp.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
BIN
profile.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
select-edit-profile-forum.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
select-group-title-forum.png
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
server.config-screenshot.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
server1.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
server_config_file.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
server_selection_mp.png
Normal file
After Width: | Height: | Size: 1.2 MiB |