RU/getPlayerName

From Multi Theft Auto: Wiki
Revision as of 08:33, 14 July 2010 by KGB (talk | contribs)
Jump to navigation Jump to search

Функция возвращает строку, содержащую имя указанного игрока.

Синтаксис

string getPlayerName ( player thePlayer )

Обязательные параметры

  • thePlayer: Игрок, имя которого необходимо получить.

Возвращаемое значение

Возвращает строку, содержащую имя указанного игрока, или false, если параметр (игрок), переданный в функцию - неверный.

Пример

Click to collapse [-]
Server
addCommandHandler("myname",
  function(playerSource)
    outputChatBox("Your name: "..getPlayerName(playerSource), playerSource)
  end
)
Click to collapse [-]
Client

This example outputs the local player name to the chatbox.

addCommandHandler("myname",
  function()
   local localPlayerName = getPlayerName(getLocalPlayer())
   --and we output it to the chatbox
   outputChatBox(localPlayerName)
  end
)

Смотрите также