- Documentation
- Server functions
- getPlayerLocalization
Function
getPlayerLocalization
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
getLocalizationReturns the player's language (the same one chosen in the launcher and game settings) as a table with a code and a name. Codes:pl,en,de,es,fr,it,pt,ru,uk,tr,cs,ro. The server knows the same language throughgetPlayerLocalization.outputChatBoxWrites a message in chat. On the server to one player or everyone, on the client in the local player's chat.