SetPlayerNameplateFor
What one player alone sees over another player’s body - a name they were told, a rank only they know.
The label over target’s body on viewer’s screen, in the place of the label everyone else sees (SetPlayerNameplate,
else the player’s name). "" takes it away and viewer sees the label everyone sees again. At most 48 characters; the
label keeps the target’s color (SetPlayerColor). One text for each pair of players.
It is the mode’s to remember: the text goes when the target leaves (their id is the next player’s to take) and with a
reload of the mode, so a mode that keeps who knows whom sets it again when either player joins. With the name plates
showing a player’s id and only while a key is held (the text and peek_key options of SetPlayerInterfaceOptions) this
is the whole of “you do not know them until they say who they are”.
Syntax
Section titled “Syntax”SetPlayerNameplateFor(viewer, target, text)| Parameter | Type | |
|---|---|---|
viewer |
number | the player whose screen shows the text |
target |
number | the player the text hangs over |
text |
string | the label for this viewer alone; "" = the label everyone sees again |
Returns
Section titled “Returns”boolean - false when either player is not connected
Example
Section titled “Example”-- the plates show a player's id while Left Alt is held; "/meet 3 Toto" teaches the id 3 a name, for the player who typed itfunction OnGameModeInit() SetInterfaceOptionsForAll("nameplates", { text = "id", peek_key = "lalt" })end
function OnPlayerCommandText(pid, cmd, args) if cmd ~= "meet" then return false end local id, name = args:match("^(%d+)%s+(.+)$") if not id or not SetPlayerNameplateFor(pid, tonumber(id), name .. " (" .. id .. ")") then SendClientMessage(pid, COLOR_RED, "Use /meet <id> <name>") end return trueendSee also
Section titled “See also”GetPlayerNameplateFor · SetPlayerNameplate · SetPlayerInterfaceOptions · SetPlayerColor · the Players group of the index
