ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getPlayerLocalization

Function

getPlayerLocalization

ServerPlayersTrilogy Hub only

Returns the player's language chosen in the launcher (the same one the client sees in getLocalization). Useful for sending messages to everyone in their own language. A player with an older client gets Polish.

Syntax

table getPlayerLocalization(player thePlayer)

Arguments

thePlayerplayer
The player.

Returns

{ code, name }, e.g. { code = "de", name = "Deutsch" }; false for a bad argument.

Example

local HELLO = { pl = "Witaj!", en = "Welcome!", de = "Willkommen!" }
addEventHandler("onPlayerJoin", root, function()
    local lang = getPlayerLocalization(source)
    outputChatBox(HELLO[lang.code] or HELLO.en, source)
end)

See also