MatchmakingService

Pokaż przestarzałe

*Ta zawartość została przetłumaczona przy użyciu narzędzi AI (w wersji beta) i może zawierać błędy. Aby wyświetlić tę stronę w języku angielskim, kliknij tutaj.

Brak możliwości tworzenia
Usługa
Bez replikacji

MatchmakingService jest odpowiedzialny za zarządzanie niestandardowymi atrybutami matchmakingowymi. Użyj go do odczytu i zapisu danych matchmakingowych.

Podsumowanie

Metody

Właściwości

Metody

GetServerAttribute

Parametry

name: string
Wartość domyślna: ""

Zwroty

InitializeServerAttributesForStudio

Parametry

serverAttributes: Dictionary
Wartość domyślna: ""

Zwroty

SetServerAttribute

Parametry

name: string
Wartość domyślna: ""
value: Variant
Wartość domyślna: ""

Zwroty

Przykłady kodu

MarketplaceService sample

local MatchmakingService = game::GetService("MatchmakingService")
local RunService = game:GetService("RunService")
if RunService:IsStudio() then
-- Sets up initial attributes and schema for testing
MatchmakingService:InitializeServerAttributesForStudio(
{
Level = "Advanced",
Elo = 123.456,
TrainingMode = true
})
end
-- Retrieves the Level attribute
local currentLevel, error = MatchmakingService:GetServerAttribute("Level")
if error then
print(error)
else
print("Current level: " .. currentLevel)
end
-- Updates the Level attribute value to Advanced
local success, error = MatchmakingService:SetServerAttribute("Level", "Advanced")
if not success then
print("Failed to update server attribute [Level] to [Advanced] due to error: " .. error)
else
print("Successfully set [Level] to [Advanced]")
end

Zdarzenia