Skip to main content

Matchmaking

Start matchmaking for any world.

🗿Static Class
This is a Static Class. Access it's methods directly with .. It's not possible to spawn new instances.
💂Authority
This static class can be accessed only on 🟦 Server side.

Examples​

Server/Index.lua
print("Matchmaking example")

local matchmaking_id

function EnterMatchmaking(player)
Matchmaking.LeaveAllMatchmaking(player, function (success)
if success then
Matchmaking.JoinMatchmaking("helix-casino-games", player, 5, function(sucess, match_id, current_players, min_players)
matchmaking_id = match_id
print(sucess)
print("Matchmaking ID = " .. match_id)
print("Current players =" .. current_players)
print("Min players to start = " .. min_players)
end)
end
end)
end

-- Check matchmaking status every second
Timer.SetInterval(function ()
if (matchmaking_id ~= nil) then
Matchmaking.CheckMatchmakingStatus(matchmaking_id, function(sucess, match_id, current_players, min_players, status, ip)
print("Matchmaking Status:")
print(sucess)
print(match_id)
print(current_players)
print(min_players)
print(status)
print(ip)

if (ip ~= '') then
-- connect
end
end)
end
end, 1000)

Static Functions​

ReturnsNameDescription
JoinMatchmakingJoin matchmaking for any world
CheckMatchmakingStatusCheck matchmaking status
LeaveMatchmakingRemove player from specified matchmaking
LeaveAllMatchmakingRemove player from specified matchmaking

JoinMatchmaking​

Join matchmaking for any world

Matchmaking.JoinMatchmaking(world_name, player, min_players, callback)
TypeParameterDefaultDescription
stringworld_nameWorld name to join
PlayerplayerPlayer joining matchmaking
integermin_playersMinimum players to start
functioncallbackMatchmaking callback in the format (success, match_id, current_players, min_players)

CheckMatchmakingStatus​

Check matchmaking status

Matchmaking.CheckMatchmakingStatus(match_id, callback)
TypeParameterDefaultDescription
stringmatch_idMatchmaking ID
functioncallbackMatchmaking status callback in the format (success, match_id, current_players, min_players, match_status, addr_to_connect)

LeaveMatchmaking​

Remove player from specified matchmaking

Matchmaking.LeaveMatchmaking(match_id, player, callback)
TypeParameterDefaultDescription
stringmatch_idMatchmaking ID
PlayerplayerPlayer to be removed from matchmaking
functioncallbackMatchmaking status callback in the format (success)

LeaveAllMatchmaking​

Remove player from specified matchmaking

Matchmaking.LeaveAllMatchmaking(player, callback)
TypeParameterDefaultDescription
PlayerplayerPlayer to be removed from matchmaking
functioncallbackMatchmaking status callback in the format (success)

Events​

This entity doesn't have own events.