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.
MatchmakingService jest odpowiedzialny za zarządzanie niestandardowymi atrybutami matchmakingowymi. Użyj go do odczytu i zapisu danych matchmakingowych.
Podsumowanie
Metody
Zwraca wartość określonego atrybutu serwera.
Inicjuje schemat atrybutów serwera i jego wartości do testowania w Studio.
Przydziela wartość do określonego atrybutu serwera.
Właściwości
Metody
InitializeServerAttributesForStudio
Parametry
Wartość domyślna: ""
Zwroty
SetServerAttribute
Parametry
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