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

Function

setPlayerName

ServerPlayersIdentical to MTA:SA

Changes the player's nickname. Fires onPlayerChangeNick.

Syntax

bool setPlayerName(player thePlayer, string newName)

Arguments

thePlayerplayer
The player.
newNamestring
The new nickname.

Returns

true on success.

Example

addEventHandler("onPlayerLogin", root, function(_, account)
    setPlayerName(source, getAccountName(account))
end)

See also