SetPlayerName: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|Sets a players name which will appear on the nametag. Overrides the Steam nickname.}} {{FuncSyntax|SetPlayerName(player, name)...")
 
(Undo revision 3389 by 28days (talk))
Tag: Undo
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|player|The player identifier.}}
{{FuncParam|player|The player identifier.}}
{{FuncParam|name|The new name to set for the player.}}
{{FuncParam|name|The new name to set for the player. Limited to 32 characters.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|This function returns nothing.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua>
AddCommand("superman", function(playerid)
    SetPlayerName(playerid, "Superman")
    AddPlayerChat(playerid, "Your name is now Superman.")
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[GetPlayerName]]

Latest revision as of 14:30, 30 December 2019

SetPlayerName

Type: Function
Context: Server
Introduced: v1.0

Description

Sets a players name which will appear on the nametag. Overrides the Steam nickname.

Syntax

SetPlayerName(player, name)

Parameters

  • player
    The player identifier.
  • name
    The new name to set for the player. Limited to 32 characters.

Return Value

  • This function returns nothing.

Example

AddCommand("superman", function(playerid)
    SetPlayerName(playerid, "Superman")
    AddPlayerChat(playerid, "Your name is now Superman.")
end)

See also